資源簡介
采用全局變換的思路實現的太陽系模型,功能有:三個球體、一個表示太陽、一個表示地球、一個表示月亮;地球不停地繞太陽旋轉,月亮繞地球旋轉,期間它們三者都發生自轉。之后擴展功能如下:地球有兩個月亮,畫上軌道線,使軌道傾斜,放縮效果
代碼片段和文件信息
////需要包含的頭文件
//#include?
//#include?
//#include?
////定義窗口大小
//#define?WINDOW_HEIGHT?700
//#define?WINDOW_WIDTH?1000
//#define?pi?3.1415926
//
////定義球體轉動的距離
//GLfloat?xstep?=?0.01f;
//GLfloat?zstep?=?0.01f;
//
//GLfloat?curTheta?=?0.0f;//地球相對于太陽的旋轉角度
//GLfloat?theta?=?0.005f;//地球旋轉角度每次的角度增加值
//GLfloat?curFar?=?0.0f;//月亮相對于地球的旋轉角度
//GLfloat?Far?=?0.015f;//月亮旋轉角度每次的增加值
//GLfloat?curSpeed?=?0.0f;
//GLfloat?speed?=?1.0f;//自轉速度
//const?GLfloat?earthBound?=?2.5f;//地球中心離太陽的距離
//const?GLfloat?monthBound?=?0.6f;//月亮中心離地球的距離
//
////地球的坐標
//GLfloat?earthPosX?=?2.5f;
//GLfloat?earthPosZ?=?0.0f;
//
////月亮的坐標
//GLfloat?monthPosX?=?3.1f;
//GLfloat?monthPosZ?=?0.0f;
//
////第二個月亮的坐標
//GLfloat?month2PosX?=?1.9f;
//GLfloat?month2PosZ?=?0.0f;
/
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-03-22?14:53??MyTask04-SunEarthMoon\
?????文件????????7502??2020-03-21?23:18??MyTask04-SunEarthMoon\1.1.cpp
?????文件????????7425??2020-03-22?01:22??MyTask04-SunEarthMoon\main.cpp
?????文件???????65024??2020-03-22?01:23??MyTask04-SunEarthMoon\MyTask04-SunEarthMoon.exe
?????文件????????1461??2020-03-20?18:51??MyTask04-SunEarthMoon\MyTask04-SunEarthMoon.sln
?????文件????????6512??2020-03-21?23:31??MyTask04-SunEarthMoon\MyTask04-SunEarthMoon.vcxproj
?????文件????????1124??2020-03-21?23:31??MyTask04-SunEarthMoon\MyTask04-SunEarthMoon.vcxproj.filters
?????文件?????????168??2020-03-20?18:51??MyTask04-SunEarthMoon\MyTask04-SunEarthMoon.vcxproj.user
?????文件????????9699??2020-03-21?22:17??MyTask04-SunEarthMoon\test.cpp
?????文件?????????367??2020-03-22?01:35??readme.md
?????文件??????274113??2020-03-20?23:36??SunEarthMonth.gif
?????文件??????392265??2020-03-20?23:49??SunEarthMonth2.gif
?????文件??????462927??2020-03-21?00:57??SunEarthMonth3.gif
?????文件?????1905777??2020-03-22?01:26??SunEarthMonth4.gif
- 上一篇:MFC聊天室的設計與實現
- 下一篇:數據結構第一章作業答案參考C語言
評論
共有 條評論