Difference between revisions of "Loading models"

From JPCT
Jump to: navigation, search
(OBJ and 3DS-format and textures)
(OBJ and 3DS-format and textures)
Line 25: Line 25:
 
</pre>
 
</pre>
  
That's all...no magic involved. Just make sure that the names match you are done. Keep in mind that it's case sensitive.
+
That's all...no magic involved. Just make sure that the names match and you are done. Keep in mind that it's case sensitive.

Revision as of 15:01, 20 November 2009

Blender related

Loading 3ds Models from Blender

Loading 3ds Keyframes from Blender


OBJ and 3DS-format and textures

It's a common problem how to assign textures to a model loaded with the 3DS- or the OBJ-loader. Actually, jPCT does this automatically if one precondition is met: The texture have to be assigned to the TextureManager with the exact same names that the textures have in the model's material definition. Here's an example of a material definition opened in Deep Exploration:

Dogskin.jpg

You can see the name of the texture in the select-box at the bottom: DOGSKIN.JPG To make the loader assign this texture to the corresponding dog-model, the TextureManager has to know a texture with this name, i.e. you have to do something like this before:

TextureManager.getInstance().addTexture("DOGSKIN.JPG", skinTex);

Please note that DOGSKIN.JPG is just the name in the manager. It has absolutely nothing to do with the name of the actual texture file. What this means is, that skinTex in the example-code above can be instatiated from a different file like:

Texture skinTex=new Texture("textures/dogtex.png");

That's all...no magic involved. Just make sure that the names match and you are done. Keep in mind that it's case sensitive.