MD5Importer and texture states

I am trying to access the texture state of an md5 model I have loaded with MD5Importer by using the following code:



TextureState ts = modelNode.getRenderState(RenderState.RS_TEXTURE);



The texture state is returned as null and obviously any code that then tries to use this variable causes a severe exception.



What I want to be able to do is alter the texture filter settings for instance or change the texture from what is defined in the md5mesh file. Is this possible or is this something that would need to be added?

Ok, I managed to get the texture state by allowing access to the triangleBatch variable in the Mesh class. Maybe having a getter for this variable, or maybe a getter for the texture state of a mesh would be nice. Please forgive me if something like this already exists and I have managed to overlook it.

I have edited the Mesh.java file which is found in "src/com/model/md5/resource/mesh". I just added this method:



public TextureState getTextureState()

{

return (TextureState) this.triangleBatch.getRenderState(RenderState.RS_TEXTURE);

}



Maybe we could get this added? Or better yet a method that you could specify the type of RenderState and it would return it, a bit more versatile than having just this one function, or a different method for each RenderState type.

the texture state is applied to the mesh not the model node.



coz a single model node could contain more than 1 meshes and each one could have a different texture.

Yeah, I understand that, but I was unable to get the texturestate from the meshes either - it kept returning null, hence why I added the getTextureState() method to the Mesh.java class.



As far as I could see the texture state is applied to the trianglebatch, but trianglebatch is private to the mesh class.



If there is another way to do this already please let me know as I would like to stay in line with the rest of the community and keep compatibility for future updates.

there is a getTriangleBatch() method in Mesh class. u can just use that one.

Doh! Thanks a lot, totally missed that somehow.  :smiley: