Difference between revisions of "Loading models"

From JPCT
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 13: Line 13:
  
 
You can see the name of the texture in the select-box at the bottom: 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 make something like this before:
+
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:
  
 
<pre>
 
<pre>
Line 19: Line 19:
 
</pre>
 
</pre>
  
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:
+
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:
  
 
<pre>
 
<pre>
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 they are case sensitive.
 +
 
 +
[[Category:jPCT]]
 +
[[Category:jPCT-AE]]

Latest revision as of 07:16, 18 September 2015

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.