资源简介
OPenGL采用LOD等技术对地形进行时适渲染.该程序为一论坛中下载保存,感觉不错.需要的朋友可参考.

代码片段和文件信息
/*
Class Name:
CCommandscript.h.
Created by:
Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com).
Description:
This class represents a simple command scripting system.
*/
#include“CCommandscript.h“
#include
using std::ifstream;
using std::filebuf;
using std::ios;
CCommandscript::CCommandscript() : totalscriptLines(0) currentLine(0)
currentLineChar(0) m_script(0)
{
}
CCommandscript::~CCommandscript()
{
Shutdown();
}
bool CCommandscript::LoadscriptFile(char *filename)
{
ifstream input input2;
char tempLine[MAX_LINE_SIZE];
input.open(filename);
if(!input.is_open())
return false;
Shutdown();
// Open and get number of lines.
while(!input.eof())
{
input.getline(tempLine MAX_LINE_SIZE ‘\n‘);
totalscriptLines++;
}
input.close();
input2.open(filename);
if(!input2.is_open()) return false;
// Load in every line of text.
m_script = new char*[totalscriptLines];
for(int i = 0; i < totalscriptLines; i++)
{
m_script[i] = new char[MAX_LINE_SIZE + 1];
input2.getline(m_script[i] MAX_LINE_SIZE ‘\n‘);
}
input2.close();
return true;
}
void CCommandscript::ParseCommand(char *destCommand)
{
// This function will take the first word of the current
// line and save it in destCommand.
int commandSize = 0;
// If destcommand is NULL or if we run out of lines or at the end
// of the current line then we return.
if(!destCommand) return;
if(currentLine >= totalscriptLines) return;
if(currentLineChar >= (int)strlen(m_script[currentLine]))
{
// Its easier to just treat it as a comment.
destCommand[0] = ‘#‘;
destCommand[1] = ‘\0‘;
return;
}
// Init string.
destCommand[0] = ‘\0‘;
// Since commands start each line we can say that if there is
// a # at the start of the line then this is a comment.
if(IsLineComment())
{
destCommand[0] = ‘#‘;
destCommand[1] = ‘\0‘;
return;
}
// Loop through every character until you find a space or newline.
// That means we are at the end of a command.
while(currentLineChar < (int)strlen(m_script[currentLine]))
{
if(m_script[currentLine][currentLineChar] == ‘ ‘ ||
m_script[currentLine][currentLineChar] == ‘\n‘)
break;
// Save the text in the array.
destCommand[commandSize] = m_script[currentLine][currentLineChar];
commandSize++;
currentLineChar++;
}
// Skip next space or newline.
currentLineChar++;
destCommand[commandSize] = ‘\0‘;
}
void CCommandscript::ParseStringParam(char *destString)
{
// This function will take a text inside “ and “ and sa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8955 2007-03-06 22:22 地层时适渲染(LOD)\APP.CPP
文件 8663 2007-03-06 22:16 地层时适渲染(LOD)\CAMERA.CPP
文件 1549 2007-03-06 21:57 地层时适渲染(LOD)\CAMERA.H
文件 8807 2007-03-05 18:45 地层时适渲染(LOD)\CCommandsc
文件 1188 2006-12-12 18:43 地层时适渲染(LOD)\CCommandsc
文件 475 2007-03-07 15:03 地层时适渲染(LOD)\CONFIG.INI
文件 4085 2007-03-06 20:07 地层时适渲染(LOD)\CTgaLoader.cpp
文件 853 2007-03-05 19:36 地层时适渲染(LOD)\CTgaLoader.h
文件 1050625 2007-02-12 23:10 地层时适渲染(LOD)\DATA\1.RAW
文件 197147 2000-12-11 21:13 地层时适渲染(LOD)\DATA\Colour0.tga
文件 196626 2001-03-04 14:26 地层时适渲染(LOD)\DATA\Colour1.tga
文件 3145728 2009-05-22 18:03 地层时适渲染(LOD)\DATA\Colour1024.raw
文件 196626 2001-02-16 23:52 地层时适渲染(LOD)\DATA\Colour2.tga
文件 196626 2001-03-04 15:27 地层时适渲染(LOD)\DATA\Colour3.tga
文件 786971 2000-11-13 15:17 地层时适渲染(LOD)\DATA\DETAIL.TGA
文件 196626 2001-03-05 13:18 地层时适渲染(LOD)\DATA\sky.tga
文件 1050625 2009-05-22 17:57 地层时适渲染(LOD)\DATA\vars.raw
文件 4449 2005-11-25 15:01 地层时适渲染(LOD)\Demo.cpp
文件 84672 2005-11-25 14:59 地层时适渲染(LOD)\DEMO.DAT
文件 1698 2005-11-25 14:55 地层时适渲染(LOD)\Demo.h
文件 775 2004-02-25 15:28 地层时适渲染(LOD)\Doc\threadmarks.files\FEATURES.CSS
文件 4858 2004-02-25 15:27 地层时适渲染(LOD)\Doc\threadmarks.files\turner_01.gif
文件 5865 2004-02-25 15:27 地层时适渲染(LOD)\Doc\threadmarks.files\turner_02.gif
文件 5925 2004-02-25 15:27 地层时适渲染(LOD)\Doc\threadmarks.files\turner_03a.gif
文件 7538 2004-02-25 15:27 地层时适渲染(LOD)\Doc\threadmarks.files\turner_03b.gif
文件 9654 2004-02-25 15:27 地层时适渲染(LOD)\Doc\threadmarks.files\turner_03c.gif
文件 13278 2004-02-25 15:28 地层时适渲染(LOD)\Doc\threadmarks.files\turner_04.gif
文件 7498 2004-02-25 15:28 地层时适渲染(LOD)\Doc\threadmarks.files\turner_05a.gif
文件 13438 2004-02-25 15:28 地层时适渲染(LOD)\Doc\threadmarks.files\turner_05b.gif
文件 16779 2004-02-25 15:28 地层时适渲染(LOD)\Doc\threadmarks.files\turner_05c.gif
............此处省略43个文件信息
- 上一篇:DELPHI 抓取PDF内容
- 下一篇:PXA270 电气规格
相关资源
- OpenGL参考手册
- Qt Creator opengl实现四元数鼠标控制轨迹
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- OPENGL实现世界上最小的3D游戏
- VS2012OpenGL配置所需要的全部libdllh文件
- 普光气田高频层序地层格架与储层发
- 松散地层深部沉降变形的光纤Bragg光栅
- 不规则分层地层中电磁波透地传输的
- reportdesign基于lodop的vue简单打印设计工
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- 用OPENGL画的一个简单的直升飞机
- opengl完美天空盒
评论
共有 条评论