The MakeMyMesh Function

The MyScene function calls the MakeMyMesh function to load and set the spherical mesh used in Helworld.c. MakeMyMesh calls the IDirect3DRM::CreateMeshBuilder method to create an IDirect3DRMMeshBuilder interface. Then it calls the IDirect3DRMMeshBuilder::Load, IDirect3DRMMeshBuilder::Scale, and IDirect3DRMMeshBuilder::SetColorRGB methods to prepare the mesh represented by the Sphere3.x file. (The Sphere3.x file is included in the DirectX SDK, as part of the media provided for use with the sample code.)

/////////////////////////////////////////////////////////////////////

//

// MakeMyMesh

// Create MeshBuilder object, load, scale, and color the mesh.

//

/////////////////////////////////////////////////////////////////////

void MakeMyMesh(LPDIRECT3DRMMESHBUILDER * lplpSphere3_builder)

{

lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, lplpSphere3_builder);

(*lplpSphere3_builder)->lpVtbl->Load(*lplpSphere3_builder,

"sphere3.x", NULL, D3DRMLOAD_FROMFILE, NULL, NULL);

(*lplpSphere3_builder)->lpVtbl->Scale(*lplpSphere3_builder,

D3DVAL(2), D3DVAL(2), D3DVAL(2));

// Set sphere to white to avoid unexpected texture-blending results.

(*lplpSphere3_builder)->lpVtbl->SetColorRGB(*lplpSphere3_builder,

D3DVAL(1), D3DVAL(1), D3DVAL(1));

}