SwordPencil

scene.cpp

Dec 12th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. #include "trexmovementanimation.h"
  2.  
  3. void DisplayApplication()
  4. {//Функция, которая рендерит наше приложение.
  5.     //SetLightSources();
  6.     glutSetCursor(GLUT_CURSOR_INFO);
  7.     Rexy.RenderTRex(); //Рендерим его
  8.     glFlush();
  9.     glutSwapBuffers();
  10. }
  11.  
  12. void CameraView()
  13. {//Функция настройки вида в 3д пространстве.
  14.     glClearColor(0.4, 0.9, 0.95, 0);
  15.     glRotatef(60.0, 0, 1, 0);
  16.     glScalef(1.2, 1.2, 1.2);
  17. }
  18.  
  19. void SetLightSources()
  20. {//Функция, которая дает освещение сцены.
  21.     glShadeModel( GL_SMOOTH );
  22.     glClearDepth( 1.0f );                                                      
  23.     glEnable( GL_DEPTH_TEST );
  24.     glDepthFunc( GL_LEQUAL );
  25.     GLfloat amb_light[] = { 0.1, 0.1, 0.1, 1.0 };
  26.     GLfloat diffuse[] = { 0.6, 0.6, 0.6, 1 };
  27.     GLfloat specular[] = { 0.7, 0.7, 0.3, 1 };
  28.     glLightModelfv( GL_LIGHT_MODEL_AMBIENT, amb_light );
  29.     glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse );
  30.     glLightfv( GL_LIGHT0, GL_SPECULAR, specular );
  31.     glEnable( GL_LIGHT0 );
  32.     glEnable( GL_COLOR_MATERIAL );
  33.     glShadeModel( GL_SMOOTH );
  34.     glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
  35.     glDepthFunc( GL_LEQUAL );
  36.     glEnable( GL_DEPTH_TEST );
  37.     glEnable(GL_LIGHTING);
  38.     glEnable(GL_LIGHT0);
  39. }
  40.  
  41. void AnimationFunc(int value)
  42. {
  43.     Rexy.WalkingCycle();
  44.     DisplayApplication();
  45.     glutPostRedisplay();
  46.     glutTimerFunc(100, AnimationFunc, 0);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment