Precaching (models and stuff)

Is there any class that does precaching already integrated in jme?

What exactly is the RessourceLocater for ? (Javadoc says needs more description :confused: )

Does anyone maybee wrote himself a precacher I can use?

if by stuff you mean Textures then yes, the TextureManager has a method preloadCache(), dont ask me how it works. For models, i dont know, but if you load models in .jme format its fast as lightning anyway. maybe load all your .jme models in some init() method manually?!

Thanks for the help, currently I'm loading my models from 3ds, and well its not that fast XD.

After playing a bit around with it, I'm now able to convert them to jme at the start.

Also i got another idea for unanimated models, theoretically i should be able to load one instance from any model at the start, and then use the sharedtrimesh in order to save memory and time ?

yes, SharedNode and its relatives can save you time. If you want to convert your models to .jme format, you shouldnt do it at startup, just convert them with the ModelLoader and use the .jme models directly. The ModelLoader loads all supported model formats and saves the loaded model as .jme in the same directory as the original model.

The question is are you using the same models more often and therefore loading them everytime again (and everytime it has to be converted?) If yes, there is the CloneImportExport-Class.

With that you load the model once, and then Clone the model everytime you need it.

Like this:

Class ModelManager

  public static CloneImportExport humanModel;

      Node model = LOAD_YOUR_MODEL;
      humanModel= new CloneImportExport();


now you can use it anywhere you want:

Node player = (Node)ModelManager.humanModel.loadClone();
Node npc1 = (Node)ModelManager.humanModel.loadClone();

Otherwise I just can agree with the other users. Load your model, export it after it is converted to jme-format and from then on you are on the fast side of life.

The CloneImport sounds really intresting, cause a very little amout of models will be used quite often.

Another thing to the norma loading (even if its in .jme) Are there any multithreading problems, if i load the model in another thread, and then attach it in the opengl one? (Do i have to attach it there even? not quite sure)

Creating and attaching a model outside of the openGL thread should be safe…

basixs said:

Creating and attaching a model outside of the openGL thread should be safe...

except when you load textures with the model. Texture loading has to be inside the OpenGL thread i think  :| plz correct me if I'm wrong basixs

Im pretty sure loading textures outside of the openGL thread is safe, its just data…

Loading images is safe - but creating a texture via opengl isnt as the implementation send the texture to the gpu and gets back an id.