As i would expect it sometimes takes 1-3 seconds for my model to come up the 1st time it loads (subsequent loads are almost instant)
From previous panda version, I remembered the model cache where egg files are saved as bam files to be used in game? (or am I remmebering this totally wrong?) I thought this cache happened automatically, but I cannot find any BAM files on my PC (did a search).
I checked config.prc (which I have not edited at all) and found this:
Enable the model-cache, but only for models, not textures.
Have you looked in $USER_APPDATA? Your USER_APPDATA folder is c:/Documents and Settings//Application Data, on XP. On Vista or Win7, it’s c:/Users//AppData.
You can also edit the model-cache-dir setting to put it somewhere else, somewhere specific like /c/panda-cache, if you like.
Well, the model-cache-dir is defined, then. It should be storing it in the expected place. You can check ExecutionEnvironment.getEnvironmentVariable(“USER_APPDATA”) to prove that $USER_APPDATA has the expected value.
As to cpMgr not being defined, you may have to import DirectStart first. If you haven’t, you can define cpMgr yourself with:
Thx , was able to use
ExecutionEnvironment.getEnvironmentVariable(“USER_APPDATA”)
to find it under:
C:\Documents and Settings\myname\Local Settings\Application Data\Panda3D-1.7.0\cache
and there are bam files there.
For my understanding, these BAM files seem to speed up model loading after the 1st time a model is loded. but the next time i start the program from scratch the models are slow again (the 1st time) - this is std behavior, unless I explicitly create bam files for my models, right?
I think you might be confusing the model-cache-dir with the ModelPool.
The ModelPool keeps a copy of every model you loaded, in the current session, in RAM. So this means the second time you load a given model (without restarting), it doesn’t even have to look at the disk, it just returns immediately.
Once you exit the program and restart, the first time you load a model it has to find and read the model from disk, and this can take a couple of seconds. If the model is not in the model-cache-dir, it will find the egg file and read it, which can take a few more seconds (depending on the size of your model). But, if the model is found in the model-cache-dir, it will read the bam file instead, which is faster than the egg file but not instant.
Exiting the program and restarting won’t clear out the model-cache-dir. But running the program on a new computer will.