Hello Guest

Assimp how get Textures from Material and where is texture coord

  • 2 Replies
  • 6909 Views
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

*

Offline spasi

  • *****
  • 2253
    • WebHotelier
Re: Assimp how get Textures from Material and where is texture coord
« Reply #1 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));
}

Re: Assimp how get Textures from Material and where is texture coord
« Reply #2 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.