SphereCylDemo::SphereCylDemo(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP) : D3DApp(hInstance, winCaption, devType, requestedVP) { if(!checkDeviceCaps()) { MessageBox(0, "checkDeviceCaps() Failed", 0, 0); PostQuitMessage(0); } InitAllVertexDeclarations(); mGfxStats = new GfxStats(); mCameraRadius = 50.0f; mCameraRotationY = 1.2 * D3DX_PI; mCameraHeight = 20.0f; mAmbientLight = WHITE; mDiffuseLight = WHITE; mSpecLight = WHITE; mLightVecW = D3DXVECTOR3(0.0, 0.0f, -1.0f); mGridMtrl = Mtrl(WHITE*0.7f, WHITE, WHITE*0.5f, 16.0f); mCylinderMtrl = Mtrl(WHITE*0.4f, WHITE, WHITE*0.8f, 8.0f); mSphereMtrl = Mtrl(WHITE*0.4f, WHITE, WHITE*0.8f, 8.0f); HR(D3DXCreateCylinder(gd3dDevice, 1.0f, 1.0f, 6.0f, 20, 20, &mCylinder, 0)); HR(D3DXCreateSphere(gd3dDevice, 1.0f, 20, 20, &mSphere, 0)); genSphericalTexCoords(); genCylTexCoords(Z_AXIS); HR(D3DXCreateTextureFromFile(gd3dDevice, "marble.bmp", &mSphereTex)); HR(D3DXCreateTextureFromFile(gd3dDevice, "stone2.dds", &mCylTex)); HR(D3DXCreateTextureFromFile(gd3dDevice, "ground0.dds", &mGridTex)); buildGeoBuffers(); buildFX(); // If you look at the drawCylinders and drawSpheres functions, you see // that we draw 14 cylinders and 14 spheres. int numCylVerts = mCylinder->GetNumVertices() * 14; int numSphereVerts = mSphere->GetNumVertices() * 14; int numCylTris = mCylinder->GetNumFaces() * 14; int numSphereTris = mSphere->GetNumFaces() * 14; mGfxStats->addVertices(mNumGridVertices); mGfxStats->addVertices(numCylVerts); mGfxStats->addVertices(numSphereVerts); mGfxStats->addTriangles(mNumGridTriangles); mGfxStats->addTriangles(numCylTris); mGfxStats->addTriangles(numSphereTris); onResetDevice(); }
SpotlightDemo::SpotlightDemo(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP) : D3DApp(hInstance, winCaption, devType, requestedVP) { if(!checkDeviceCaps()) { MessageBox(0, "checkDeviceCaps() Failed", 0, 0); PostQuitMessage(0); } mGfxStats = new GfxStats(); mCameraRadius = 50.0f; mCameraRotationY = 1.2 * D3DX_PI; mCameraHeight = 20.0f; mAmbientLight = 0.4f*WHITE; mDiffuseLight = WHITE; mSpecLight = WHITE; mAttenuation012 = D3DXVECTOR3(1.0f, 0.0f, 0.0f); mSpotPower = 16.0f; mGridMtrl = Mtrl(BLUE, BLUE, WHITE, 16.0f); mCylinderMtrl = Mtrl(RED, RED, WHITE, 8.0f); mSphereMtrl = Mtrl(GREEN, GREEN, WHITE, 8.0f); HR(D3DXCreateCylinder(gd3dDevice, 1.0f, 1.0f, 6.0f, 20, 20, &mCylinder, 0)); HR(D3DXCreateSphere(gd3dDevice, 1.0f, 20, 20, &mSphere, 0)); buildGeoBuffers(); buildFX(); // If you look at the drawCylinders and drawSpheres functions, you see // that we draw 14 cylinders and 14 spheres. int numCylVerts = mCylinder->GetNumVertices() * 14; int numSphereVerts = mSphere->GetNumVertices() * 14; int numCylTris = mCylinder->GetNumFaces() * 14; int numSphereTris = mSphere->GetNumFaces() * 14; mGfxStats->addVertices(mNumGridVertices); mGfxStats->addVertices(numCylVerts); mGfxStats->addVertices(numSphereVerts); mGfxStats->addTriangles(mNumGridTriangles); mGfxStats->addTriangles(numCylTris); mGfxStats->addTriangles(numSphereTris); onResetDevice(); InitAllVertexDeclarations(); }
TriGridDemo::TriGridDemo(HINSTANCE hInstance, std::wstring winCaption) : D3DApp(hInstance, winCaption) { mGfxStats = new GfxStats(); mCameraRadius = 10.0f; mCameraRotationY = 1.2 * D3DX_PI; mCameraHeight = 5.0f; buildGeoBuffers(); buildFX(); onResetDevice(); InitAllVertexDeclarations(); }