How do I load 3D meshes from a .x file, and extract the material data from it? Also, how do I apply a texture to the loaded mesh?
tomtetlaw
-1
Posting Pro
Recommended Answers
Jump to PostThis is code for DirectX 9:
void LoadModel(Model* model, LPCTSTR File){ D3DXCreateBuffer(NumBytes, &bufMaterial); LPD3DXBUFFER bufMaterial; D3DXLoadMeshFromX(File, D3DXMESH_SYSTEMMEM, d3ddev, NULL, &bufMaterial, NULL, &model->numMaterials, &model->Mesh); OutputDebugString("LOAD MESH \n"); D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)bufMaterial->GetBufferPointer(); OutputDebugString("GET BUFFER\n"); model->Material = new D3DMATERIAL9[model->numMaterials]; model->Texture = new LPDIRECT3DTEXTURE9[model->numMaterials]; OutputDebugString("LOAD MESH \n"); for(DWORD index = 0; …
Jump to PostThe code that I used was from directxtutorial.com and model refers to the object model that will hold all of the mesh information. I have not tested the code, but do see the …
Jump to PostDid you get the code to compile? I should probably install .NET anyway
All 10 Replies
zortec
11
Junior Poster
tomtetlaw
-1
Posting Pro
zortec
11
Junior Poster
tomtetlaw
-1
Posting Pro
zortec
11
Junior Poster
tomtetlaw
-1
Posting Pro
zortec
11
Junior Poster
tomtetlaw
-1
Posting Pro
zortec
11
Junior Poster
tomtetlaw
-1
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.