Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
WORLD.CPP
Package: openglsystem.rar [view]
Upload User: nthssl
Upload Date: 2022-04-05
Package Size: 25357k
Code Size: 1k
Category:
OpenCV
Development Platform:
Visual C++
- #include "world.h"
- CWorld::CWorld()
- {
- terrain = new CTerrain(256, 0.5);
- }
- CWorld::~CWorld()
- {
- audioSystem->Shutdown();
- delete terrain;
- delete audioSystem;
- delete worldSound;
- }
- CWorld::CWorld(CCamera *c)
- {
- camera = c;
- terrain = new CTerrain(256, 0.4f);
- enemy = new CEntity;
- enemy2 = new CEntity;
- audioSystem = new CAudioSystem;
- audioSystem->InitDirectXAudio(NULL);
- enemy->AttachTo(terrain);
- enemy2->AttachTo(terrain);
- worldSound = audioSystem->Create("ambient.wav", false);
- audioSystem->Play(worldSound, DMUS_SEG_REPEAT_INFINITE);
- enemy->Load("models\sodf8\tris.md2", "models\sodf8\abarlith.pcx");
- enemy->SetState(MODEL_RUN);
- enemy->direction = 45.0;
- enemy2->Load("models\ogro\tris.md2", "models\ogro\ogrobase.pcx");
- enemy2->SetState(MODEL_RUN);
- enemy2->direction = 225.0;
- enemy2->position = CVector(200.0, 0.0, 200.0);
- }
- void CWorld::Animate(float deltaTime)
- {
- // 根据地形设置摄像机的高度位置
- camera->position.y = terrain->GetHeight(camera->position.x, camera->position.z) + 10.0f;
- terrain->Animate(deltaTime);
- }
- void CWorld::Draw(CCamera *camera)
- {
- terrain->Draw(camera);
- }
- void CWorld::OnPrepare()
- {
- glClearColor(terrain->fogColor[0], terrain->fogColor[1], terrain->fogColor[2], terrain->fogColor[3]);
- terrain->Prepare();
- }