render_data.h
上传用户:gzqinmao
上传日期:2022-07-13
资源大小:472k
文件大小:1k
源码类别:

OpenGL

开发平台:

Visual C++

  1. #include "Vector4.h"
  2. #include "Matrix4x4.h"
  3. struct Vertex_VC
  4. {
  5. float m_Position[3];
  6. // R,G,B,A in OpenGL
  7. // B,G,R,A in Direct3D 9
  8. // Direct3D 10可是是两种其中之1, 看设置而定.
  9. unsigned char m_RGBA[4];
  10. };
  11. // 球的数据
  12. extern Vertex_VC *g_pSunVertices;
  13. extern Vertex_VC *g_pEarthVertices;
  14. extern Vertex_VC *g_pMoonVertices;
  15. extern unsigned short *g_pSphereIndices;
  16. extern int g_iNumSphereVertices;
  17. extern int g_iNumSphereTriangles;
  18. extern int g_iNumSphereIndices;
  19. // 镜头位置
  20. extern Vector4 g_eye; 
  21. // 镜头对准的点
  22. extern Vector4 g_lookat; 
  23. // 镜头正上方的方向
  24. extern Vector4 g_up; 
  25. // 镜头转换矩阵
  26. extern Matrix4x4 g_view_matrix;
  27. // 
  28. extern Matrix4x4 g_sun_matrix, g_earth_matrix, g_moon_matrix;
  29. // 生成球模型的程序
  30. bool CreateSphere(float radius, Vertex_VC **ppVertices, unsigned short **ppIndices, float *color=NULL, int stacks = 20, int pieces = 20);