• 大小: 296KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: C/C++
  • 标签:

资源简介

ROAM Simplistic Implementation By Bryan Turner brturn@bellsouth.net January, 2000 Project file for MS Visual C++ 6.0. Requires GLUT DLL (www.opengl.org) Adjust program constants in Landscape.h and Utility.cpp. MAPS: Default map is read from HeghtXXX.raw where XXX is the MAP_SIZE (as defined in Landscape.h). If this map is not found, the program attempts to open "Map.ved", a Tread Marks map file. Tread Marks maps will only work for MAP_SIZE == 1024. Also, the MULT_SCALE to view Tread Marks maps correctly is "0.25f". (www.TreadMarks.com) CONTROLS: MOUSE - Hold Left Mouse Button to Rotate View Angle Q - Change Rendering Mode (Wireframe, Lit, Fill, Texture) O - Change View Mode (Observe, Follow, Drive, Fly) W/S - Move forward/back A/D - Rotate left/right (in Observe Mode only) F - Stop Animation R - Toggle Frustum Drawing 0/9 - More/Less Triangles per frame 1/2 - Adjust FOV

资源截图

代码片段和文件信息

//
// RoamMain.cpp (GLUT Version)
// Bryan Turner
//
// Parts of the code in this file were borrowed from numerous public sources &
//   literature.  I reserve NO rights to this code and give a hearty thank-you to all the
//   excellent sources used in this project.  These include but are not limited to:
//
//   Longbow Digital Arts Programming Forum (www.LongbowDigitalArts.com)
//   Gamasutra Features (www.Gamasutra.com)
//   GameDev References (www.GameDev.net)
//   C. Cookson‘s ROAM implementation (C.J.Cookson@dcs.warwick.ac.uk OR cjcookson@hotmail.com)
//   OpenGL Super Bible (Waite Group Press)
//   And many more...
//

#include 
#include 
#include 
#include 
#include  // OpenGL
#include  // GLUT

#include “utility.h“
#include “landscape.h“


void GLUTRenderScene(void)
{
RenderScene();

// Copy image to window
glutSwapBuffers();
}

void GLUTIdleFunction(void)
{
IdleFunction();
GLUTRenderScene();
}

void GLUTKeyDown( unsigned char key int x int y )
{
// Key Bindings
switch( key )
{
case ‘w‘: KeyForward(); break;
case ‘a‘: KeyLeft(); break;
case ‘s‘: KeyBackward(); break;
case ‘d‘: KeyRight(); break;

case ‘f‘: KeyAnimateToggle(); break;
case ‘o‘: KeyObserveToggle(); break;
case ‘q‘: KeyDrawModeSurf(); break;
case ‘r‘: KeyDrawFrustumToggle(); break;

case ‘0‘: KeyMoreDetail(); break;
case ‘9‘: KeyLessDetail(); break;

case ‘1‘: KeyFOVDown(); break;
case ‘2‘: KeyFOVUp(); break;
}
}

void GLUTKeySpecialDown( int key int x int y )
{
// More key bindings
switch( key )
{
case GLUT_KEY_UP: KeyUp(); break;
case GLUT_KEY_DOWN: KeyDown(); break;
}
}

void GLUTMouseClick(int button int state int x int y)
{
// Handle LEFT mouse button UP/DOWN events...
if ( button == GLUT_LEFT_BUTTON )
{
if ( state == GLUT_DOWN )
{
gRotating = 1;
gStartX = -1;
}
else
gRotating = 0;
}
}

// ---------------------------------------------------------------------
// Main body of program
//
int main(int argc char *argv[])
{
// GLUT window setup and initialization
glutInit(&argc argv);
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(0 0);
glutInitWindowSize(WINDOW_WIDTH WINDOW_HEIGHT);

if ( glutCreateWindow(“ROAM Terrain View“) < 0)
{
printf(“ERROR: Create Window Failed!\n“);
exit(0);
}

glutReshapeFunc(ChangeSize); // Set function to call when window is resized
glutIdleFunc(GLUTIdleFunction); // Set function to call when program is idle
glutKeyboardFunc(GLUTKeyDown);
glutSpecialFunc(GLUTKeySpecialDown);
glutMouseFunc(GLUTMouseClick);
glutMotionFunc(MouseMove);
glutDisplayFunc(GLUTRenderScene);

// Setup OpenGL
SetupRC();
SetDrawModeContext();

// Load landscape data file
loadTerrain(MAP_SIZE &gHeightMap);

int nAvgframes = -1;
if ( roamInit(gHeightMap) =

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     208956  2000-03-12 13:51  中文版ROAM实时动态LOD地形渲染代码\RoamSimple.exe

     文件    1048576  2000-01-26 13:06  中文版ROAM实时动态LOD地形渲染代码\Height1024.raw

     文件       2619  2000-01-26 12:34  中文版ROAM实时动态LOD地形渲染代码\Landscape.h

     文件       2493  2000-01-26 00:25  中文版ROAM实时动态LOD地形渲染代码\Patch.h

     文件        931  2000-03-12 13:56  中文版ROAM实时动态LOD地形渲染代码\ReadMe.txt

     文件      19838  2000-03-06 22:12  中文版ROAM实时动态LOD地形渲染代码\Roamsimple.cpp

     文件       4386  2000-03-12 14:00  中文版ROAM实时动态LOD地形渲染代码\RoamSimple.dsp

     文件       3666  2000-03-12 13:44  中文版ROAM实时动态LOD地形渲染代码\GlutMain.cpp

     文件      20145  2000-03-12 13:33  中文版ROAM实时动态LOD地形渲染代码\Utility.cpp

     文件       1242  2000-03-12 13:33  中文版ROAM实时动态LOD地形渲染代码\Utility.h

     目录          0  2009-01-29 19:52  中文版ROAM实时动态LOD地形渲染代码

----------- ---------  ---------- -----  ----

              1312852                    11


评论

共有 条评论

相关资源