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

資源簡介

使用OpenGL實(shí)現(xiàn)的3D場景和模型導(dǎo)入,這里有點(diǎn)像游戲的3d界面,但是是一個低配版,里面有exe可以直接打開,也有源碼

資源截圖

代碼片段和文件信息

#ifdef?_WINDOWS
#include?
#endif

#include?“glee.h“
#include?
#include?“CGfxOpenGL.h“
#include?


extern?long?windowHeight;
extern?long?windowWidth;

const?char?heightmapFilename[]?=?“heightmap.raw“;


const?float?EYE_HEIGHT?=?40.0f;
const?float?TERRAIN_HEIGHT_SCALE?=?0.4f;
const?float?TERRAIN_MAX_HEIGHT?=?256?*?TERRAIN_HEIGHT_SCALE;
const?float?CREATURE_MIN_DISTANCE?=?140.0f;
const?float?CREATURE_SCALE?=?TERRAIN_SCALE?*?0.9f;

//?returns?a?number?ranging?from?-1.0?to?1.0
#define?FRAND()???(((float)rand()-(float)rand())/RAND_MAX)


bool?SphereInFrustum(sphere_t?sphere?frustum_t?frustum)
{
??GLfloat?dist;
??for?(int?i?=?0;?i???{
????dist?=?frustum.planes[i].A?*?sphere.center.x?+
???????????frustum.planes[i].B?*?sphere.center.y?+
???????????frustum.planes[i].C?*?sphere.center.z?+
???????????frustum.planes[i].D;

????if?(dist?<=?-sphere.radius)
??????return?false;
??}

??return?true;
}


CGfxOpenGL::CGfxOpenGL()
{
??m_terrain?=?NULL;
??m_terrainUVs?=?NULL;
??m_terrainIndices?=?NULL;
??m_terrainColors?=?NULL;
??m_angle?=?0.0;
??m_rotateRight?=?false;
??m_rotateLeft?=?false;
??m_useCulling?=?true;
}

CGfxOpenGL::~CGfxOpenGL()
{
}

bool?CGfxOpenGL::Init()
{
??GLeeInit();
??
??glLineWidth(3.0);

??glEnable(GL_DEPTH_TEST);
??glEnable(GL_TEXTURE_2D);

??InitializeTerrain();
??InitializeCreatures();

??CTargaImage?image;

??image.Load(“grass.tga“);
??glGenTextures(1?&m_grassTexture);
??glBindTexture(GL_TEXTURE_2D?m_grassTexture);
??gluBuild2DMipmaps(GL_TEXTURE_2D?GL_RGB?image.GetWidth()?image.GetHeight()?GL_RGB?GL_UNSIGNED_BYTE?image.GetImage());
??image.Release();

??m_skybox.Initialize(5.0);
??m_skybox.LoadTextures(“skybox/up.tga“?“skybox/dn.tga“?“skybox/ft.tga“?“skybox/bk.tga“?“skybox/lt.tga“?“skybox/rt.tga“);
??return?true;
}

bool?CGfxOpenGL::Shutdown()
{
??delete?[]?m_terrain;
??m_terrain?=?NULL;
??delete?[]?m_terrainUVs;
??m_terrainUVs?=?NULL;
??delete?[]?m_terrainColors;
??m_terrainColors?=?NULL;
??delete?[]?m_terrainIndices;
??m_terrainIndices?=?NULL;
??return?true;
??m_skybox.Release();
??glDeleteTextures(1?&m_grassTexture);
}


void?CGfxOpenGL::SetupProjection(int?width?int?height)
{
if?(height?==?0) //?don‘t?want?a?divide?by?zero
{
height?=?1;
}

glViewport(0?0?width?height); //?reset?the?viewport?to?new?dimensions
glMatrixMode(GL_PROJECTION); //?set?projection?matrix?current?matrix
glLoadIdentity(); //?reset?projection?matrix

//?calculate?aspect?ratio?of?window
gluPerspective(45.0f?(GLfloat)width/(GLfloat)height?2.0f?3000.0f);

glMatrixMode(GL_MODELVIEW); //?set?modelview?matrix
glLoadIdentity(); //?reset?modelview?matrix

m_windowWidth?=?width;
m_windowHeight?=?height;
}

void?CGfxOpenGL::Prepare(float?dt)
{
??if?(m_rotateRight)
????m_angle?+=?dt?*?ROTATION_SPEED;
??else?if?(m_rotateLeft)
????m_angle?-=?dt?*?ROTATION_SPE

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-06-11?11:42??FrustumCulling\
?????文件???????11370??2017-06-11?11:34??FrustumCulling\CGfxOpenGL.cpp
?????文件????????1652??2004-02-09?14:23??FrustumCulling\CGfxOpenGL.h
?????文件????????7038??2004-02-09?14:23??FrustumCulling\CTargaImage.cpp
?????文件????????2241??2004-02-09?14:23??FrustumCulling\CTargaImage.h
?????目錄???????????0??2017-06-11?11:37??FrustumCulling\Debug\
?????文件???????83229??2017-06-11?11:36??FrustumCulling\Debug\CGfxOpenGL.obj
?????文件???????????0??2017-06-11?11:37??FrustumCulling\Debug\CGfxOpenGL.sbr
?????文件???????22057??2017-06-11?11:36??FrustumCulling\Debug\CTargaImage.obj
?????文件???????????0??2017-06-11?11:37??FrustumCulling\Debug\CTargaImage.sbr
?????文件?????2778112??2017-06-11?11:37??FrustumCulling\Debug\FrustumCulling.bsc
?????文件??????421991??2017-06-11?11:36??FrustumCulling\Debug\FrustumCulling.exe
?????文件??????835532??2017-06-11?11:36??FrustumCulling\Debug\FrustumCulling.ilk
?????文件?????3515508??2017-06-11?11:36??FrustumCulling\Debug\FrustumCulling.pch
?????文件?????1229824??2017-06-11?11:36??FrustumCulling\Debug\FrustumCulling.pdb
?????文件??????489448??2017-06-11?11:36??FrustumCulling\Debug\GLee.obj
?????文件???????????0??2017-06-11?11:37??FrustumCulling\Debug\GLee.sbr
?????文件???????28677??2017-06-11?11:36??FrustumCulling\Debug\MD2.obj
?????文件???????????0??2017-06-11?11:37??FrustumCulling\Debug\MD2.sbr
?????文件???????62216??2017-06-11?11:36??FrustumCulling\Debug\Skybox.obj
?????文件???????????0??2017-06-11?11:37??FrustumCulling\Debug\Skybox.sbr
?????文件??????214016??2017-06-11?11:37??FrustumCulling\Debug\vc60.idb
?????文件??????159744??2017-06-11?11:36??FrustumCulling\Debug\vc60.pdb
?????文件???????59128??2017-06-11?11:36??FrustumCulling\Debug\winmain.obj
?????文件???????????0??2017-06-11?11:37??FrustumCulling\Debug\winmain.sbr
?????文件????????4759??2017-06-11?11:42??FrustumCulling\FrustumCulling.dsp
?????文件?????????551??2004-02-09?14:23??FrustumCulling\FrustumCulling.dsw
?????文件??????147456??2004-02-09?14:23??FrustumCulling\FrustumCulling.exe
?????文件??????345088??2017-06-11?11:42??FrustumCulling\FrustumCulling.ncb
?????文件???????48640??2017-06-11?11:42??FrustumCulling\FrustumCulling.opt
?????文件????????2113??2017-06-11?11:37??FrustumCulling\FrustumCulling.plg
............此處省略115個文件信息

評論

共有 條評論