Direct3D



         

CreateScene()


CreateScene()  10.10.

10.10. CreateScene()

BOOL FullScreenWin::CreateScene() { //-------- FPS -------- selectmode = GetCurDisplayMode();

CreateMenuSurface(); UpdateMenuSurface();

CreateFPSSurface();

// ------- -------- D3DRMLOADRESOURCE resinfo; resinfo.hModule = 0; resinfo.lpName = MAKEINTRESOURCE(IDR_SWIRLMESH); resinfo.lpType = "MESH"; d3drm->CreateMeshBuilder(&meshbuilder); meshbuilder->Load(&resinfo, 0, D3DRMLOAD_FROMRESOURCE, 0, 0); ScaleMesh(meshbuilder, D3DVALUE(15));

//------- -------- LPDIRECT3DRMFRAME meshframe; d3drm->CreateFrame(scene, &meshframe); meshframe->AddVisual(meshbuilder); meshframe->SetRotation(scene, D3DVALUE(0), D3DVALUE(1), D3DVALUE(0), D3DVALUE(.1)); meshframe->AddMoveCallback(UpdateAnimation, 0);

//-------- -------- d3drm->CreateAnimation(&animation);

for (int i = 0; i < 11; i++) { D3DRMQUATERNION quat; D3DRMQuaternionFromRotation(&quat, &vect[i], rot[i]); animation->AddRotateKey(D3DVALUE(i), &quat); animation->AddPositionKey(D3DVALUE(i), trans[i].x, trans[i].y, trans[i].z); }

animation->SetOptions(D3DRMANIMATION_SPLINEPOSITION | D3DRMANIMATION_CLOSED | D3DRMANIMATION_POSITION | D3DRMANIMATION_SCALEANDROTATION); animation->SetFrame(meshframe);

meshframe->Release(); meshframe = 0;

// -------- -------- LPDIRECT3DRMFRAME dlightframe; LPDIRECT3DRMLIGHT dlight;

d3drm->CreateLightRGB(D3DRMLIGHT_DIRECTIONAL, D3DVALUE(1.00), D3DVALUE(1.00), D3DVALUE(1.00), &dlight);

d3drm->CreateFrame(scene, &dlightframe); dlightframe->SetOrientation(scene, D3DVALUE(0), D3DVALUE(-1), D3DVALUE(1), D3DVALUE(0), D3DVALUE(1), D3DVALUE(0)); dlightframe->AddLight(dlight);

dlightframe->Release(); dlightframe = 0; dlight->Release(); dlight = 0;

//------ ---------- d3drm->CreateFrame(scene, &camera); camera->SetPosition(scene, D3DVALUE(0), D3DVALUE(0), D3DVALUE(-50)); d3drm->CreateViewport(device, camera, 0, 0, device->GetWidth(), device->GetHeight(), &viewport);

return TRUE; }

<