renderer.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. #include "renderer.hpp"
  3. float renderer_t::quad_vert_cords [][2] = { {1.0,1.0}, {0.0,1.0}, {0.0,0.0}, {1.0,0.0} };
  4. //=====================================================================================================================================
  5. // UpdateMatrices =
  6. //=====================================================================================================================================
  7. void renderer_t::UpdateMatrices()
  8. {
  9. const Mat4& M = matrices.model;
  10. const Mat4& V = matrices.view;
  11. const Mat4& P = matrices.projection;
  12. Mat4& MV = matrices.model_view;
  13. Mat4& MVP = matrices.model_view_projection;
  14. Mat3& N = matrices.normal;
  15. Mat4& Mi = matrices.model_inv;
  16. Mat4& Vi = matrices.view_inv;
  17. Mat4& Pi = matrices.projection_inv;
  18. Mat4& MVi = matrices.model_view_inv;
  19. Mat4& MVPi = matrices.model_view_projection_inv;
  20. Mat3& Ni = matrices.normal_inv;
  21. // matrices
  22. MV = V * M;
  23. MVP = P * MV;
  24. N = MV.getRotationPart();
  25. // inv matrices
  26. Mi = M.getInverseTransformation();
  27. Vi = V.getInverseTransformation();
  28. Pi = P.getInverse();
  29. MV = Mi * Vi;
  30. MVPi = MVi * Pi;
  31. Ni = MVi.getRotationPart();
  32. }
  33. //=====================================================================================================================================
  34. // DrawQuad =
  35. //=====================================================================================================================================
  36. void renderer_t::DrawQuad()
  37. {
  38. glEnableClientState( GL_VERTEX_ARRAY );
  39. glVertexPointer( 2, GL_FLOAT, 0, quad_vert_cords );
  40. glDrawArrays( GL_QUADS, 0, 4 );
  41. glDisableClientState( GL_VERTEX_ARRAY );
  42. }
  43. */