.x file tutorials
Can anyone tell me where there is a good tutorial for loading DirectX .X files? I''ve been making things with DoGA-L1, which exports to .X, but the DX8 SDK reference is...decidedly less than helpful.
I know you said you already looked in the SDK, but lots of times people miss the tutorials that are there so I''ll tell you how to reach them. If you''ve already tried this then disregard this message:
In the main help file for DX8.0, go to the contents tab, and expand DirectX Graphics, then expand under that DirectX Graphics C/C++ Tutorials, then go to Tutorial 6: Using Meshes.
In the main help file for DX8.0, go to the contents tab, and expand DirectX Graphics, then expand under that DirectX Graphics C/C++ Tutorials, then go to Tutorial 6: Using Meshes.
Thanks, but I had already checked the SDK and I knew that the mesh tutorial was there. However, for some reason, the included tutorials have been next to useless for me. Part of it is that they give you so many code snippets but don''t give you much idea of what goes where, and sometimes they forget to mention what type of variable you''ll need. Actually, under using X files under Advanced Topics, they do it a completely different way which didn''t work for me.
So, any other places?
So, any other places?
I think it´s easier to save the x file as text and parse the information out of it.
When the stars are right they will awake...
When the stars are right they will awake...
DWORD i; // for control variableLPD3DXBUFFER D3DXMtrlBuffer; // handles materialsLPD3DXBUFFER AdjacencyBuffer = NULL; char FilePath[30]; D3DXLoadMeshFromX( Filename, D3DXMESH_SYSTEMMEM, D3DDevice, NULL, &D3DXMtrlBuffer, &this->NumMaterials, &this->Mesh); // Load the materials from the .x fileD3DXMATERIAL* D3DXMaterials = (D3DXMATERIAL*)D3DXMtrlBuffer->GetBufferPointer();this->MeshMaterials = new D3DMATERIAL8[this->NumMaterials];this->MeshTextures = new LPDIRECT3DTEXTURE8[this->NumMaterials]; // Load the textures from the .x file for (i = 0; i < this->NumMaterials; i++ ) { this->MeshMaterials[i] = D3DXMaterials[i].MatD3D; this->MeshMaterials[i].Ambient = this->MeshMaterials[i].Diffuse; strcpy(FilePath, "Models\\"); strcat(FilePath, D3DXMaterials[i].pTextureFilename); if (FAILED(D3DXCreateTextureFromFile(D3DDevice, FilePath, &this->MeshTextures[i]))) this->MeshTextures[i] = NULL; D3DXMtrlBuffer->Release(); }}
that code was basically stolen from the SDK
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement