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

  • 大小: 400KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-29
  • 語言: 其他
  • 標(biāo)簽: OpenGL??房子????月亮??

資源簡介

OpenGL編程實(shí)現(xiàn)繪制房子,樹,月亮,3D,可以進(jìn)行旋轉(zhuǎn)

資源截圖

代碼片段和文件信息

#include?
#include
#include
#include
#include?
//---------------噴泉相關(guān)------------------------------------
struct?particle
{
??float?t;???????//?粒子的壽命
??float?v;???????//?粒子的運(yùn)動(dòng)速度
??float?d;???????//?粒子的運(yùn)動(dòng)方向
??float?x?y?z;?//?粒子的位置坐標(biāo)
??float?xd?zd;??//?X?和?Z?方向上的增量
??char?type;?????//?粒子的狀態(tài)(移動(dòng)或淡化)
??float?a;???????//?粒子淡化的?alpha?值
??struct?particle?*next?*prev;
};
struct?particle?*fn=NULL;???/*?Fountains?鏈表結(jié)構(gòu)*/
int?timep=17;
//--------------------------------------------------------------------
float?flag=1.0;
GLfloat?theta=3.1415*0.2fai=3.1415*0.7;
GLfloat?P0X=120.0*sin(theta)*sin(fai)P0Y=120*cos(fai)P0Z=120.0*cos(theta)*sin(fai);

int?windowwwindowh;????????????????????//窗口的寬和高
static?GLuint?texName;??????????????????//紋理組的名稱
//依序?yàn)樵铝痢?cè)面、地面
GLuint?drawwalllistmoonlistrooflisttreeliststoolliststartList;????????????????????//貼環(huán)境紋理的顯示列表
???GLUquadricObj?*qobj;
//------------------------------------------------------------

GLfloat?ctrlpoints[4][4][3];

GLfloat?texpts[2][2][2]?=?{{{0.7?0.7}?{0.7?1}}?
{{1?0.7}?{1?1}}};
//-----------------------噴泉相關(guān)-----------------------------
void?AddParticles()
{
??struct?particle?*tempp;
??int?i;
??
????for?(i=0;?i<15;?i++)
????{
??????tempp?=?(struct?particle?*)malloc(sizeof(struct?particle));
??????if?(fn)?fn->prev?=?tempp;
??????tempp->next?=?fn;
??????fn?=?tempp;
??
??????tempp->t?=?-9.9;
??????tempp->v?=?(float)(rand()?%?200000)/100000+1;?//?速度
??????tempp->d?=?(float)(rand()?%?400)/100-2;?????//?方向角度
??????//?開始運(yùn)動(dòng)的坐標(biāo)
??????tempp->x?=?0;
??????tempp->y?=?0;
??????tempp->z?=?i*2;
??????tempp->xd?=?cos((tempp->d*3.14159)/180)*tempp->v/4;
??????tempp->zd?=?sin((tempp->d*3.14159)/180)*tempp->v;
??????tempp->type?=?0;?
??????tempp->a?=?1;?
}
}
//??移動(dòng)粒子
void?MoveParticles()
{
??struct?particle?*tempp;

??{
????tempp?=?fn;?
????while?(tempp)
????{
??????if?(tempp->type?==?0)?//?如果粒子是運(yùn)動(dòng)的
??????{
????????tempp->x?+=?tempp->xd;
????????tempp->z?+=?tempp->zd;
????????tempp->y?=?-(9.8*(tempp->t*tempp->t/4))/2+122.5;?//?計(jì)算高度
????????tempp->t?+=?0.1;?//?壽命遞增
????????if?(tempp->y?type?=?1;?//?如果粒子落到地上,則粒子淡化
??????}
??????else?//?粒子落到地上
??????{
????????tempp->y?=?-(9.8*(tempp->t*tempp->t/4))/2+122.5;?
??????}
??????tempp?=?tempp->next;?//進(jìn)行下一個(gè)粒子的計(jì)算
????}
??}
}
//??刪除粒子
void?DeleteParticles()
{
??struct?particle?*tempp?*temp1;

??{
????tempp?=?fn;
????while?(tempp)
????{
??????if?((tempp->type?==?1)?&&?(tempp->a?<=?0))?//?粒子死亡
??????{
????????//?刪除粒子
????????temp1?=?tempp->prev;
????????tempp->prev->next?=?tempp->next;
????????if?(tempp->next)?tempp->next->prev?=?temp1;
????????free(tempp);
????????tempp?=?temp1;
??????}
??????tempp?=?tempp->next;
????}
??}
}

void?timf(int?value)
{
??glutPostRedisplay();
??glutTimerFunc(timep?timf?0);
}
//-------------------------------------------------------------
void?readimage(char

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件?????196664??2005-06-12?17:52??source?code\door.bmp

?????文件?????196664??2005-06-13?00:05??source?code\floor.bmp

?????文件?????196664??2005-06-12?15:10??source?code\moon.bmp

?????文件??????20534??2005-06-18?23:05??source?code\Pond.cpp

?????文件??????49208??2005-06-12?16:34??source?code\roof.bmp

?????文件??????49208??2005-06-12?19:05??source?code\starlow.bmp

????..A.SH.?????21504??2005-06-18?23:06??source?code\Thumbs.db

?????文件?????227071??2007-04-11?16:16??月色.pdf

?????目錄??????????0??2005-06-18?23:06??source?code

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

???????????????957735????????????????????10


評(píng)論

共有 條評(píng)論

相關(guān)資源