LWJGL Forum

Programming => General Java Game Development => Topic started by: wartemw on January 14, 2017, 08:17:52

Title: Assimp how get Textures from Material and where is texture coord
Post by: wartemw on January 14, 2017, 08:17:52
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
Title: Re: Assimp how get Textures from Material and where is texture coord
Post by: spasi on January 15, 2017, 15:38:28
This code should help:

Code: [Select]
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));
}
Title: Re: Assimp how get Textures from Material and where is texture coord
Post by: wartemw on January 17, 2017, 07:19:06
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.