91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 16.23MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-14
  • 語言: 其他
  • 標簽: opengl??三維??

資源簡介

opengl三維建模實例,代碼展示。蘑菇、天空、地形、螢火蟲、燈光效果。

資源截圖

代碼片段和文件信息

#include?
#include?
#include??
#include?
#include?
#include?“camera.h“
struct?MUSHROOM
{
float?x?y?z; //蘑菇的位置
int?texT?texM?texB; //蘑菇不同部分對應的紋理
};
extern?void?Display();
extern?void?Display2();
void?Reshape(int?width?int?height);

extern?CAMERA?camera;
extern?int?SPOT_LIGHT_ON; //聚光燈是否打開
extern?float?DEG_TO_RAD;
extern?float?viewDX?viewDY?viewDZ;
extern?float?eyePX?eyePY?eyePZ;
extern?int?Window_Width;
extern?int?Window_Height;
extern?int?L;
extern?float?W;
extern?int?H;
extern?float?PR;
float?BORDERW?=?60;
POINT?mousePos;
#define?MAX_MUSHROOM_ORG?30 //最大蘑菇數
extern?int?MAX_MUSHROOM;
extern?MUSHROOM*?mushroom;
extern?void?MushroomInit();
float?dx?=?0.0f;
float?dy?=?0.0f;
float?dz?=?-1.0f;

float?ax?=?0.0f;
float?ay?=?0.0f;

float?r?=?1000.0f;
extern?struct?mPOINT?oldpt;?????????????????
int?l_button_down=FALSE;?
struct?POLAR?polar={?150?0?45};?????????

const?float?FIT1?=?0.05;
const?float?FIT2?=?0.08;
int?UDSPEED?=?2.0f;
int?SPEED0?=?2.0f;
int?SPEED?=?SPEED0;
int?maxSPEED?=?8.0f;
int?ACC?=?2.0f;
int?JUMP?=?30.0f;
int?Jtag?=?1;

void?SetCamera(GLfloat?x?GLfloat?y)????????
{
ax?+=?x*FIT1;
ay?-=?y*FIT2;
if?(ay?>=?90)?ay?=?90;
if?(ay?<=?-90)?ay?=?-90;

dz?=?-r*cos(ax*DEG_TO_RAD);
dx?=?r*sin(ax*DEG_TO_RAD);

dy?=?r*sin(ay);

dy?=?r*sin(ay*DEG_TO_RAD);
????dx?=?dx?*?cos(ay*DEG_TO_RAD);
dz?=?dz?*?cos(ay*DEG_TO_RAD);
viewDX?=?eyePX?+?dx;
viewDY?=?eyePY?+?dy;
viewDZ?=?eyePZ?+?dz;???????????????
??????????????//Display();????????????????????
Display2();
}
?
void?onmousemove(int?x?int?y)?????????//鼠標按住移動
{
???????if(l_button_down)????????
???????{
??????????????SetCamera(float(x-oldpt.x)float(y-oldpt.y));??????
?
??????????????oldpt.x=x;?????????????
??????????????oldpt.y=y;
???????}
}
void?MouseMove(int?x?int?y) //鼠標移動
{
GetCursorPos(&mousePos);
if?((mousePos.x?!=?Window_Width/2)?||?(mousePos.y?!=?Window_Height/2))
{
??

??SetCamera(float(mousePos.x)-float(Window_Width/2)float(mousePos.y)-float(Window_Height/2));??????
??????????????SetCursorPos(Window_Width/2?Window_Height/2);
??oldpt.x=x;?????????????
??????????????oldpt.y=y;
}
}
void?Mouse(int?button?int?state?int?x?int?y)???????
{
???if?(button?==?GLUT_WHEEL_UP)
???{
if?((eyePY?-?UDSPEED)?>?-24)
eyePY?-=?UDSPEED;
viewDX?=?eyePX?+?dx;
viewDY?=?eyePY?+?dy;
viewDZ?=?eyePZ?+?dz;
Display2();
???}
???if?(button?==?GLUT_WHEEL_DOWN)
???{
if?((eyePY?+?UDSPEED)?>?-24)
eyePY?+=?UDSPEED;
viewDX?=?eyePX?+?dx;
viewDY?=?eyePY?+?dy;
viewDZ?=?eyePZ?+?dz;
Display2();
???}
???if?(button?==?GLUT_RIGHT_BUTTON?&&?state?==?GLUT_DOWN)
???{
if?(Jtag?==?1)
{
//eyePZ?-=?SPEED*cos(ax*DEG_TO_RAD);
//eyePX?+=?SPEED*sin(ax*DEG_TO_RAD);
eyePY?+=?JUMP;

viewDX?=?eyePX?+?dx;
viewDY?=?eyePY?+?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???17007320??2013-12-11?22:31??bin.rar

?????文件????????225??2013-12-13?22:59??操作說明.txt

?????文件???????6957??2013-12-11?14:57??src\camera.cpp

?????文件????????993??2013-12-07?03:39??src\camera.h

?????文件??????????0??2013-10-23?18:47??src\global.h

?????文件??????39800??2013-12-11?15:39??src\main.cpp

?????文件???????6353??2013-10-31?15:11??src\mushroom.cpp

?????文件????????155??2013-10-23?20:50??src\mushroom.h

?????文件????????387??2013-12-08?18:41??src\resource.h

?????目錄??????????0??2013-12-11?15:42??src

-----------?---------??----------?-----??----

?????????????17062190????????????????????10


評論

共有 條評論