Hello all!
I’m working on a GTA like geometry loading system where tiled data is loaded only when the user/camera is in its vicinity. The problem is I get tremendous lag every time a new geometry is read from my .bam files. I’ve implemented asynchronous geometry loading by specifying a callback function in the call to loader.loadModel(). The callback stashes the geometry in a dict which I later read and display with .reparentTo(). I’ve two collision events to this end: one to start the loading and the other to display the buffered geometry. Is this a sensible approach? I noticed that loading and immediately displaying the geometry results in even larger lags, hence the two-step approach.
I’m using Panda3D 1.8 dev build 20120107 on Ubuntu Oneiric. Thread.isThreadingSupported() returns True.
The .bam files are 50KB on average with an average of 9MB of .png textures.
The manual states that there are two different threading interfaces. Since I’m using a default build I guess I’m using SIMPLE_THREADS, right? The manual also states that SIMPLE_THREADS is the simple of the two. I then wonder whether SIMPLE_THREADS is capable of asynchronously loading files i.e. do I need to compile Panda with the more powerful threading interface? Is lag-less loading of geometry possible in Panda? rdb’s comment on ‘true threading’ in this thread makes me uncertain…
Any idea what might be causing the lag? Am I using loadModel() correctly or do I need to import other modules first e.g. Panda’s threaded file module (direct.stdpy.file)?
Thanks in advance for any insights!
Simeon
PS I’m building a proof-of-concept prototype for a memory limited mobile device, hence I want to be able to load and unload geometry on demand.