LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Assimp how get Textures from Material and where is texture coord  (Read 862 times)

wartemw

  • Newbie
  • *
  • Offline Offline
  • Posts: 24

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
Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1888
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));
}
Logged

wartemw

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
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.

Logged