The BuildScene function in Egg.c loads a simple egg-shaped mesh into the scene and rotates the frame containing the mesh.
A call to the IDirect3DRM::CreateMeshBuilder method retrieves the IDirect3DRMMeshBuilder COM interface. BuildScene uses this interface for only one call before releasing it; it calls the IDirect3DRMMeshBuilder::Load method to load a mesh file named Egg.x.
Next, BuildScene calls IDirect3DRM::CreateFrame to create a frame for the mesh, and then it calls IDirect3DRMFrame::AddVisual to add the mesh to that frame.
Then, BuildScene sets the position and orientation of the camera frame in relation to the scene frame by calling the IDirect3DRMFrame::SetPosition and IDirect3DRMFrame::SetOrientation methods. Finally, it rotates the mesh frame in relation to the scene frame by calling the IDirect3DRMFrame::SetRotation method.
LPDIRECT3DRMMESHBUILDER egg_builder = NULL;
LPDIRECT3DRMFRAME egg = NULL;
.
.
.
if (FAILED(lpD3DRM->lpVtbl->CreateMeshBuilder(lpD3DRM, &egg_builder)))
goto generic_error;
rval = egg_builder->lpVtbl->Load(egg_builder, "egg.x", NULL,
D3DRMLOAD_FROMFILE, NULL, NULL);
if (FAILED(lpD3DRM->lpVtbl->CreateFrame(lpD3DRM, scene, &egg)))
goto generic_error;
if (FAILED(egg->lpVtbl->AddVisual(
egg, (LPDIRECT3DRMVISUAL)egg_builder)))
goto generic_error;
if (FAILED(camera->lpVtbl->SetPosition(
camera, scene, D3DVAL(0), D3DVAL(0), -D3DVAL(10))))
goto generic_error;
if (FAILED(camera->lpVtbl->SetOrientation(
camera, scene, D3DVAL(0), D3DVAL(0), D3DVAL(1), D3DVAL(0),
D3DVAL(1), D3DVAL(0))))
goto generic_error;
if (FAILED(egg->lpVtbl->SetRotation(
egg, scene, D3DVAL(0), D3DVAL(1), D3DVAL(1), D3DVAL(0.02))))
goto generic_error;