Assimp how get Textures from Material and where is texture coord

Started by wartemw, January 14, 2017, 08:17:52

Previous topic - Next topic

wartemw

1) In AIScene there is: one Mesh, one Material.
    Mesh this cube.
    Material this Bitmap texture.
    how get Texture of Material?

2)  where is texture coord in AIScene

spasi

This code should help:

AIScene scene = ...;

PointerBuffer meshes = scene.mMeshes();
for ( int i = 0; i < meshes.remaining(); i++ ) {
	AIMesh mesh = AIMesh.create(meshes.get(i));
	AIVector3D.Buffer texCoords = mesh.mTextureCoords(0);
}

PointerBuffer textures = scene.mTextures();
for ( int i = 0; i < textures.remaining(); i++ ) {
	AITexture texture = AITexture.create(textures.get(i));
}

wartemw

Quote
PointerBuffer meshes = scene.mMeshes();
for ( int i = 0; i < meshes.remaining(); i++ ) {
    AIMesh mesh = AIMesh.create(meshes.get(i));
    AIVector3D.Buffer texCoords = mesh.mTextureCoords(0);
}
Thank you!

Quote
PointerBuffer textures = scene.mTextures();
for ( int i = 0; i < textures.remaining(); i++ ) {
    AITexture texture = AITexture.create(textures.get(i));
}
The problem is that the textures 0 (scene.mNumTextures () = 0 always), and the material is always the same amount as textures.