- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
render_data.h
资源名称:chap03.rar [点击查看]
上传用户:gzqinmao
上传日期:2022-07-13
资源大小:472k
文件大小:2k
源码类别:
OpenGL
开发平台:
Visual C++
- #include "Vector4.h"
- #include "Matrix4x4.h"
- struct Vertex_VC
- {
- float m_Position[3];
- // R,G,B,A in OpenGL
- // B,G,R,A in Direct3D 9
- // Direct3D 10可是是两种其中之1, 看设置而定.
- unsigned char m_RGBA[4];
- };
- // 球的数据
- extern Vertex_VC *g_pSunVertices;
- extern Vertex_VC *g_pEarthVertices;
- extern Vertex_VC *g_pMoonVertices;
- extern unsigned short *g_pSphereIndices;
- extern int g_iNumSphereVertices;
- extern int g_iNumSphereTriangles;
- extern int g_iNumSphereIndices;
- extern float g_simulation_days;
- extern float g_fRotate_X, g_fRotate_Y;
- const float PI = 3.14159;
- const float PI_double = PI * 2.0f;
- const float days_a_year = 365.0f;
- const float days_a_month = 28.0f;
- const float days_a_year_mercury = 88.0f;
- const float days_a_year_venus = 224.7f;
- const float sun_spin_x = 180.0f;
- const float earth_to_sun_distance = 8.0f; // 地球离太阳的假设值
- const float mercury_to_sun_distance = 3.0f; // 水星离太阳的假设值
- const float venus_to_sun_distance = 5.0f; // 水星离太阳的假设值
- const float moon_to_earth_distance = 2.0f; // 月球离地球的假设值
- const float simulation_speed = 60.0f; // 1秒相当于60天
- // 镜头位置
- extern Vector4 g_eye;
- // 镜头对准的点
- extern Vector4 g_lookat;
- // 镜头正上方的方向
- extern Vector4 g_up;
- // 镜头转换矩阵
- extern Matrix4x4 g_view_matrix;
- //
- extern Matrix4x4 g_sun_matrix, g_earth_matrix, g_moon_matrix;
- // 生成球模型的程序
- bool CreateSphere(float radius, Vertex_VC **ppVertices, unsigned short **ppIndices, float *color=NULL, int stacks = 20, int pieces = 20);