void display(void) { lPosition(); /////////////////////////////////////////////////////////////////////////////////////////////////////// glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glColor3f (1.0, 1.0, 1.0); glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); //Texturing Contour Anchored To The Object glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); //Texturing Contour Anchored To The Object //glEnable(GL_TEXTURE_GEN_S); //Auto Texture Generation //glEnable(GL_TEXTURE_GEN_T); //Auto Texture Generation glEnable(GL_TEXTURE_2D); /////////////////////////////////////////////////////////////////////////////////////////////////////// stars(); //glBindTexture(GL_TEXTURE_2D, g_cactus[1]); //gluSphere(g_text,0.4,48,48); stars(); sun(); adam(); hesper(); earth(); mars(); jupiter(); saturn(); uranus(); neptune(); /////////////////////////////////////////////////////////////////////////////////////////////////////// glDisable(GL_TEXTURE_2D); //glDisable(GL_TEXTURE_GEN_S); //Auto Texture Generation //glDisable(GL_TEXTURE_GEN_T); glutSwapBuffers(); }
void init(void) { glClearColor (0.0, 0.0, 0.0, 0.0); lPosition(); glShadeModel (GL_SMOOTH); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); g_text = gluNewQuadric(); LoadTexture("sun.bmp", g_cactus[0]); LoadTexture("mercury.bmp", g_cactus[1]); LoadTexture("venus.bmp", g_cactus[2]); LoadTexture("earth.bmp", g_cactus[3]); LoadTexture("mars.bmp", g_cactus[4]); LoadTexture("jupiter.bmp", g_cactus[5]); LoadTexture("saturn.bmp", g_cactus[6]); LoadTexture("uranus.bmp", g_cactus[7]); LoadTexture("neptune.bmp", g_cactus[8]); /* LPCWSTR filename=_T(L"sun.bmp"); LoadT8(filename,g_cactus[0]);//帖图 filename=_T(L"mercury.bmp"); LoadT8(filename,g_cactus[1]);//帖图 filename=_T(L"venus.bmp"); LoadT8(filename,g_cactus[2]);//帖图 filename=_T(L"earth.bmp"); LoadT8(filename,g_cactus[3]);//帖图 filename=_T(L"mars.bmp"); LoadT8(filename,g_cactus[4]);//帖图 filename=_T(L"jupiter.bmp"); LoadT8(filename,g_cactus[5]);//帖图 filename=_T(L"saturn.bmp"); LoadT8(filename,g_cactus[6]);//帖图uranus.bmp filename=_T(L"uranus.bmp"); LoadT8(filename,g_cactus[7]);//帖图Neptune filename=_T(L"neptune.bmp"); LoadT8(filename,g_cactus[8]);//帖图Neptune */ }
void CameraZoom(FbxScene* pScene, int pZoomDepth, int pZoomMode) { FbxCamera* lCamera = GetCurrentCamera(pScene); if( lCamera == NULL) return; if( pZoomMode == SceneContext::ZOOM_FOCAL_LENGTH) { if (lCamera->ProjectionType.Get() == FbxCamera::ePerspective) { double lTransform = 0 - pZoomDepth / 100.0; double lApertureW = lCamera->GetApertureWidth(); lApertureW = TransformAperture( lApertureW, lTransform); double lApertureH = lCamera->GetApertureHeight(); lApertureH = TransformAperture( lApertureH, lTransform); UpdatePerspCameraAttributes( lCamera, lApertureW, lApertureH); } else { if( pZoomDepth > 0) gsOrthoCameraScale *= 0.8; else gsOrthoCameraScale *= 1.25; } } else { FbxNode* lCameraNode = lCamera ? lCamera->GetNode() : NULL; // Compute the camera position and direction. FbxVector4 lEye(0,0,1); FbxVector4 lCenter(0,0,0); FbxVector4 lForward(0,0,0); if (lCamera) { lEye = lCamera->Position.Get(); } if (lCameraNode && lCameraNode->GetTarget()) { lCenter = lCameraNode->GetTarget()->LclTranslation.Get(); lForward = lCenter - lEye; } else { if (!lCameraNode || IsProducerCamera(pScene, lCamera)) { if (lCamera) { lCenter = lCamera->InterestPosition.Get(); lForward = lCenter - lEye; } } else { // Get the direction FbxAMatrix lGlobalRotation; FbxVector4 lRotationVector( lCameraNode->LclRotation.Get()); lGlobalRotation.SetR(lRotationVector); // Set the center. // A camera with rotation = {0,0,0} points to the X direction. So create a // vector in the X direction, rotate that vector by the global rotation amount // and then position the center by scaling and translating the resulting vector lRotationVector = FbxVector4(1.0,0,0); lForward = lGlobalRotation.MultT(lRotationVector); } } lForward.Normalize(); lEye += lForward * pZoomDepth; FbxDouble3 lPosition(lEye[0], lEye[1], lEye[2]); lCamera->Position.Set(lPosition); } }