Loading models

From JPCT
Revision as of 08:16, 18 September 2015 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 instantiated 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 they are case sensitive.