You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(25) |
Oct
(64) |
Nov
(74) |
Dec
(22) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(14) |
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Yohann C. <pl...@us...> - 2004-10-14 13:21:16
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16052 Modified Files: aicontroller.cc aicontroller.h Log Message: premier essai d'AI. pas une AI, c'est juste pour le debugage :) Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aicontroller.cc 10 Oct 2004 21:25:32 -0000 1.1 --- aicontroller.cc 14 Oct 2004 13:21:06 -0000 1.2 *************** *** 2,16 **** #include "game.h" void AIController::Think (float eTime) { - iForward += 1; ! CollisionResult c = Game::pSelf->GetSceneManager()->Trace(pPawn->GetPosition(), pPawn->GetPosition()+Vector3::UNIT_X*100); ! // std::cout << std::setprecision(0) << "Endpoint : " << c.EndPoint << "\t\tNormal : " << c.Normal << std::endl; } void AIController::Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { ! //std::cout << "aicontroller" << std::endl; } --- 2,61 ---- #include "game.h" + #include <time.h> + #include <stdlib.h> + #include <math.h> + + bool initialised = false; + + void AIController::Think (float eTime) { ! if (!initialised) // A mettre ailleurs... mais je ne vais pas hacker tggame.. je laisse ca aux experts ;) ! AIController::Initialize(); ! ! // Vector3 pos = pPawn->GetPosition(); // position du perso AI ! Vector3 vPos = Game::pSelf->GetSceneManager()->GetCamera()->GetPosition(); // position de la camera ! ! Vector3 vCentre = Game::pSelf->GetSceneManager()->Trace(vPos, ! vPos + ( Vector3::UNIT_Z*(-1000000) ) ).EndPoint; ! float fVarX = vCentre.x - vPos.x; ! float fVarZ = vCentre.z - vPos.z; ! float fDist = sqrt(fVarX*fVarX + fVarZ*fVarZ); ! std::cout << "EndPoint Z: " << vCentre.z ! << " Position : " << vPos ! << " Distance : " << abs(fVarZ) << std::endl; } void AIController::Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { ! // std::cout << "aicontroller" << std::endl; ! // fYaw=rand()%360; ! // std::cout << vPoint << std::endl; } + void AIController::Initialize() + { + std::cout << "\n\n---[AI]--- C'est parti pour l'IA" << std::endl; + initialised=true; + iForward=1; + // srand( (unsigned)time( NULL ) ); + } + + /* + ================================================================= + NOTES : JE SAIS, JE POURAIS LES METTRE AILLEURS, MAIS LA-DESSOUS, + JE TROUVE QUE C'EST BIEN AUSSI..... :P + merci de les laisser :) + ================================================================= + + + ## trouver l'altitude à une position donnee + CollisionResult c = Game::pSelf->GetSceneManager()->Trace(pPawn->GetPosition(), pPawn->GetPosition()+Vector3::UNIT_Y*100); + + ## affichage direct des vecteurs3: ca peut toujours etre utile.... + std::cout << std::setprecision(0) << "Endpoint : " << c.EndPoint << "\t\tNormal : " << c.Normal << std::endl; + + + */ + Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aicontroller.h 10 Oct 2004 21:25:32 -0000 1.1 --- aicontroller.h 14 Oct 2004 13:21:06 -0000 1.2 *************** *** 11,14 **** --- 11,15 ---- void Think (float); void Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); + void Initialize (); }; |
|
From: Seb <whi...@us...> - 2004-10-13 23:46:23
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14742 Modified Files: config.cfg game.cc Log Message: Ajout de -set sound 1 dans le fichier de config. Pour le moment, mettre -set sound 0 ne fonctionne pas tout a fait, a cause du moment ou est parse le fichier de config. Index: config.cfg =================================================================== RCS file: /cvsroot/epfl/tggame/config.cfg,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config.cfg 27 Sep 2004 21:41:34 -0000 1.4 --- config.cfg 13 Oct 2004 23:46:13 -0000 1.5 *************** *** 5,6 **** --- 5,7 ---- -set lightpos.y 0 -set bump 0 + -set sound 1 Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** game.cc 13 Oct 2004 18:59:55 -0000 1.11 --- game.cc 13 Oct 2004 23:46:13 -0000 1.12 *************** *** 52,56 **** pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); ! //On ajoute le son wind a la position 0,70,0 pSoundManager->SetSoundProperties("thunder",0,70,0,0,0,0); --- 52,56 ---- pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); ! //On ajoute le son thunder a la position 0,70,0 pSoundManager->SetSoundProperties("thunder",0,70,0,0,0,0); |
|
From: Seb <whi...@us...> - 2004-10-13 23:13:02
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3910 Modified Files: Makefile.OSX soundmanager.cc Log Message: Qq modif pour le soundmanager (entre autre pour le cvarmanager) Index: Makefile.OSX =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile.OSX,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.OSX 2 Oct 2004 22:45:46 -0000 1.5 --- Makefile.OSX 13 Oct 2004 23:12:52 -0000 1.6 *************** *** 6,10 **** OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) ! CFLAGS = -DTGOSX -O3 -DDEBUG CC = g++ --- 6,10 ---- OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) ! CFLAGS = -DTGOSX -O3 -DDEBUG -DSOUND_DEBUG CC = g++ Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soundmanager.cc 13 Oct 2004 19:05:42 -0000 1.3 --- soundmanager.cc 13 Oct 2004 23:12:52 -0000 1.4 *************** *** 98,102 **** { #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif --- 98,102 ---- { #ifdef SOUND_DEBUG ! //cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif *************** *** 109,113 **** { #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetListenerOrientation" << endl; #endif --- 109,113 ---- { #ifdef SOUND_DEBUG ! //cout << "OpenAL:: SetListenerOrientation" << endl; #endif *************** *** 502,513 **** // Sound properties (position and velocity) void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) ! { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; ! #endif ! //set the sounds position and velocity if(CheckSound(name)) ! { alSource3f(SoundList[name],AL_POSITION,x/100,y/100,z/100); alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); --- 502,513 ---- // Sound properties (position and velocity) void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) ! { //set the sounds position and velocity if(CheckSound(name)) ! { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; ! #endif ! alSource3f(SoundList[name],AL_POSITION,x/100,y/100,z/100); alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); *************** *** 517,528 **** // Sound volume void SoundManager::SetSoundVolume(string name, float x) ! { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; ! #endif ! //set the sounds volume if(CheckSound(name)) alSourcef (SoundList[name], AL_GAIN,x); } --- 517,530 ---- // Sound volume void SoundManager::SetSoundVolume(string name, float x) ! { //set the sounds volume if(CheckSound(name)) + { + #ifdef SOUND_DEBUG + cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; + #endif + alSourcef (SoundList[name], AL_GAIN,x); + } } *************** *** 530,550 **** void SoundManager::PlaySound(string name) { - #ifdef SOUND_DEBUG - cout << "OpenAL:: PlaySound: " << name << endl; - #endif - if(CheckSound(name)) alSourcePlay(SoundList[name]); } // Stop a sound void SoundManager::StopSound(string name) ! { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: StopSound: " << name << endl; ! #endif ! if(CheckSound(name)) alSourceStop(SoundList[name]); } --- 532,556 ---- void SoundManager::PlaySound(string name) { if(CheckSound(name)) + { + #ifdef SOUND_DEBUG + cout << "OpenAL:: PlaySound: " << name << endl; + #endif + alSourcePlay(SoundList[name]); + } } // Stop a sound void SoundManager::StopSound(string name) ! { if(CheckSound(name)) + { + #ifdef SOUND_DEBUG + cout << "OpenAL:: StopSound: " << name << endl; + #endif + alSourceStop(SoundList[name]); + } } *************** *** 553,563 **** { ALint state; - - #ifdef SOUND_DEBUG - cout << "OpenAL:: SoundStatus: " << name << endl; - #endif if(CheckSound(name)) { alGetSourcei(SoundList[name], AL_SOURCE_STATE, &state); --- 559,569 ---- { ALint state; if(CheckSound(name)) { + #ifdef SOUND_DEBUG + cout << "OpenAL:: SoundStatus: " << name << endl; + #endif + alGetSourcei(SoundList[name], AL_SOURCE_STATE, &state); |
|
From: Yohann C. <pl...@us...> - 2004-10-13 23:08:56
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2197 Modified Files: Makefile Log Message: Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 13 Oct 2004 19:37:44 -0000 1.9 --- Makefile 13 Oct 2004 23:08:37 -0000 1.10 *************** *** 6,10 **** clean: ! rm -f out/*.so rm -f *.o rm -f *~ --- 6,10 ---- clean: ! rm -f out/* rm -f *.o rm -f *~ |
|
From: Yohann C. <pl...@us...> - 2004-10-13 19:38:09
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5692 Modified Files: Makefile Log Message: Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 10 Oct 2004 20:49:08 -0000 1.8 --- Makefile 13 Oct 2004 19:37:44 -0000 1.9 *************** *** 6,12 **** clean: ! rm -f out/* rm -f *.o ! rm -f *~ linux: --- 6,12 ---- clean: ! rm -f out/*.so rm -f *.o ! rm -f *~ linux: |
|
From: Seb <whi...@us...> - 2004-10-13 19:05:52
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29496 Modified Files: soundmanager.cc Log Message: Changement pour les messages de debug: #ifdef DEBUG --> #ifdef SOUND_DEBUG pour eviter de faire defiler trop de messages ;-) Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soundmanager.cc 13 Oct 2004 18:38:19 -0000 1.2 --- soundmanager.cc 13 Oct 2004 19:05:42 -0000 1.3 *************** *** 19,23 **** SoundManager::SoundManager() { ! #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; #endif --- 19,23 ---- SoundManager::SoundManager() { ! #ifdef SOUND_DEBUG cout << "OpenAL:: Starting SoundManager" << endl; #endif *************** *** 29,33 **** SoundManager::~SoundManager() { ! #ifdef DEBUG cout << "OpenAL:: Ending SoundManager" << endl; #endif --- 29,33 ---- SoundManager::~SoundManager() { ! #ifdef SOUND_DEBUG cout << "OpenAL:: Ending SoundManager" << endl; #endif *************** *** 40,44 **** void SoundManager::init() { ! #ifdef DEBUG cout << "OpenAL:: Initializing SoundManager" << endl; #endif --- 40,44 ---- void SoundManager::init() { ! #ifdef SOUND_DEBUG cout << "OpenAL:: Initializing SoundManager" << endl; #endif *************** *** 46,50 **** if (Engine::pEndian->bLittle == true) { ! #ifdef DEBUG cout << "OpenAL:: Little Endian detected..." << endl; #endif --- 46,50 ---- if (Engine::pEndian->bLittle == true) { ! #ifdef SOUND_DEBUG cout << "OpenAL:: Little Endian detected..." << endl; #endif *************** *** 54,58 **** else { ! #ifdef DEBUG cout << "OpenAL:: Big Endian detected..." << endl; #endif --- 54,58 ---- else { ! #ifdef SOUND_DEBUG cout << "OpenAL:: Big Endian detected..." << endl; #endif *************** *** 69,73 **** alext = alGetString( AL_EXTENSIONS ); ! #ifdef DEBUG cout << "OpenAL:: Loading Lib: Vers = " << alversion << " | Renderer = " << alrenderer << " | Vendor = " << alvendor << endl; #endif --- 69,73 ---- alext = alGetString( AL_EXTENSIONS ); ! #ifdef SOUND_DEBUG cout << "OpenAL:: Loading Lib: Vers = " << alversion << " | Renderer = " << alrenderer << " | Vendor = " << alvendor << endl; #endif *************** *** 97,102 **** void SoundManager::SetListenerPosition(float x, float y, float z) { ! #ifdef DEBUG ! //cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif --- 97,102 ---- void SoundManager::SetListenerPosition(float x, float y, float z) { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif *************** *** 108,113 **** void SoundManager::SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz) { ! #ifdef DEBUG ! //cout << "OpenAL:: SetListenerOrientation" << endl; #endif --- 108,113 ---- void SoundManager::SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz) { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: SetListenerOrientation" << endl; #endif *************** *** 137,141 **** ALenum result; ! #ifdef DEBUG cout << "OpenAL:: LoadWavALBuffer: " << path << endl; #endif --- 137,141 ---- ALenum result; ! #ifdef SOUND_DEBUG cout << "OpenAL:: LoadWavALBuffer: " << path << endl; #endif *************** *** 187,191 **** ALuint buffer; // Buffer id for the loaded buffer. ! #ifdef DEBUG cout << "OpenAL:: GetLoadedWavALBuffer: " << path << endl; #endif --- 187,191 ---- ALuint buffer; // Buffer id for the loaded buffer. ! #ifdef SOUND_DEBUG cout << "OpenAL:: GetLoadedWavALBuffer: " << path << endl; #endif *************** *** 223,227 **** char *path = (char*) name.c_str(); ! #ifdef DEBUG cout << "OpenAL:: LoadWavALSample: " << name << endl; #endif --- 223,227 ---- char *path = (char*) name.c_str(); ! #ifdef SOUND_DEBUG cout << "OpenAL:: LoadWavALSample: " << name << endl; #endif *************** *** 260,264 **** try { ! #ifdef DEBUG cout << "OpenAL:: AddWAV: " << name << endl; #endif --- 260,264 ---- try { ! #ifdef SOUND_DEBUG cout << "OpenAL:: AddWAV: " << name << endl; #endif *************** *** 304,308 **** ALenum result; ! #ifdef DEBUG cout << "OpenAL:: LoadOggALBuffer: " << path << endl; #endif --- 304,308 ---- ALenum result; ! #ifdef SOUND_DEBUG cout << "OpenAL:: LoadOggALBuffer: " << path << endl; #endif *************** *** 337,341 **** ALuint buffer; // Buffer id for the loaded buffer. ! #ifdef DEBUG cout << "OpenAL:: GetLoadedOggALBuffer: " << path << endl; #endif --- 337,341 ---- ALuint buffer; // Buffer id for the loaded buffer. ! #ifdef SOUND_DEBUG cout << "OpenAL:: GetLoadedOggALBuffer: " << path << endl; #endif *************** *** 373,377 **** char *path = (char*) name.c_str(); ! #ifdef DEBUG cout << "OpenAL:: LoadOggALSample: " << name << endl; #endif --- 373,377 ---- char *path = (char*) name.c_str(); ! #ifdef SOUND_DEBUG cout << "OpenAL:: LoadOggALSample: " << name << endl; #endif *************** *** 410,414 **** try { ! #ifdef DEBUG cout << "OpenAL:: AddOGG: " << name << endl; #endif --- 410,414 ---- try { ! #ifdef SOUND_DEBUG cout << "OpenAL:: AddOGG: " << name << endl; #endif *************** *** 503,507 **** void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) { ! #ifdef DEBUG cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; #endif --- 503,507 ---- void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) { ! #ifdef SOUND_DEBUG cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; #endif *************** *** 518,522 **** void SoundManager::SetSoundVolume(string name, float x) { ! #ifdef DEBUG cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; #endif --- 518,522 ---- void SoundManager::SetSoundVolume(string name, float x) { ! #ifdef SOUND_DEBUG cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; #endif *************** *** 530,534 **** void SoundManager::PlaySound(string name) { ! #ifdef DEBUG cout << "OpenAL:: PlaySound: " << name << endl; #endif --- 530,534 ---- void SoundManager::PlaySound(string name) { ! #ifdef SOUND_DEBUG cout << "OpenAL:: PlaySound: " << name << endl; #endif *************** *** 541,545 **** void SoundManager::StopSound(string name) { ! #ifdef DEBUG cout << "OpenAL:: StopSound: " << name << endl; #endif --- 541,545 ---- void SoundManager::StopSound(string name) { ! #ifdef SOUND_DEBUG cout << "OpenAL:: StopSound: " << name << endl; #endif *************** *** 554,558 **** ALint state; ! #ifdef DEBUG cout << "OpenAL:: SoundStatus: " << name << endl; #endif --- 554,558 ---- ALint state; ! #ifdef SOUND_DEBUG cout << "OpenAL:: SoundStatus: " << name << endl; #endif *************** *** 607,611 **** alDeleteBuffers(1, (ALuint*)(*iter)); ! #ifdef DEBUG cout << "OpenAL:: KillALData" << endl; #endif --- 607,611 ---- alDeleteBuffers(1, (ALuint*)(*iter)); ! #ifdef SOUND_DEBUG cout << "OpenAL:: KillALData" << endl; #endif |
|
From: Seb <whi...@us...> - 2004-10-13 19:00:05
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27973 Modified Files: game.cc playercontroller.cc Log Message: Ajout des bruit de pas et d'un coup de feu (ESPACE) Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** game.cc 13 Oct 2004 18:39:09 -0000 1.10 --- game.cc 13 Oct 2004 18:59:55 -0000 1.11 *************** *** 37,47 **** _CreatePlayers (); - /* - //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... pSoundManager->AddWAV("fire",false,true); pSoundManager->AddWAV("thunder",false,true); ! pSoundManager->AddWAV("Music",true,true); pSoundManager->AddWAV("step",true,true); --- 37,45 ---- _CreatePlayers (); //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... pSoundManager->AddWAV("fire",false,true); pSoundManager->AddWAV("thunder",false,true); ! pSoundManager->AddOGG("Music",true,true); pSoundManager->AddWAV("step",true,true); *************** *** 65,69 **** pSoundManager->PlaySound("Music"); - */ } --- 63,66 ---- *************** *** 125,130 **** void Game::PreFrame () { - /* - Camera* myCam = pSceneManager->GetCamera(); --- 122,125 ---- *************** *** 137,142 **** pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z); - */ - float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) --- 132,135 ---- Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** playercontroller.cc 10 Oct 2004 20:54:47 -0000 1.4 --- playercontroller.cc 13 Oct 2004 18:59:55 -0000 1.5 *************** *** 1,3 **** --- 1,4 ---- #include "playercontroller.h" + #include <soundmanager.h> using namespace tg; *************** *** 26,38 **** --- 27,46 ---- case TGKEY_w: iForward += 1; + SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_s: iForward -= 1; + SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_a: iStrafe -= 1; + SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_d: iStrafe += 1; + SoundManager::pSoundManager->PlaySound("step"); + break; + case TGKEY_SPACE: + SoundManager::pSoundManager->PlaySound("gun"); break; default: *************** *** 47,54 **** --- 55,64 ---- case TGKEY_s: iForward = 0; + SoundManager::pSoundManager->StopSound("step"); break; case TGKEY_a: case TGKEY_d: iStrafe = 0; + SoundManager::pSoundManager->StopSound("step"); break; default: |
|
From: Seb <whi...@us...> - 2004-10-13 18:39:21
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21578 Modified Files: game.cc Log Message: Sound manager Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** game.cc 10 Oct 2004 21:18:41 -0000 1.9 --- game.cc 13 Oct 2004 18:39:09 -0000 1.10 *************** *** 9,18 **** pEngine = new Engine (pTimer); ! if (pEngine->pEndian->bLittle == true) ! pSoundManager = new SoundManager(true); ! else ! pSoundManager = new SoundManager(false); Engine::pEngine = pEngine; pSceneManager = new SceneManager (pTimer); pPhysicEngine = new PhysicEngine (); --- 9,19 ---- pEngine = new Engine (pTimer); ! //On cree un nouveau soundmanager ! pSoundManager = new SoundManager(); Engine::pEngine = pEngine; + + SoundManager::pSoundManager = pSoundManager; + pSceneManager = new SceneManager (pTimer); pPhysicEngine = new PhysicEngine (); *************** *** 36,51 **** _CreatePlayers (); ! //pSoundManager->AddWAV("bubbles",false,true); ! //pSoundManager->AddOGG("Music",true,true); ! /*Vector3 soundtestpos = pWorld->GetPointLightPos(9); ! //pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); ! pSoundManager->SetSoundProperties("bubbles",0,70,0,0,0,0); pSoundManager->SetSoundVolume("Music",0.5); ! pSoundManager->PlaySound("bubbles"); ! pSoundManager->PlaySound("Music");*/ } --- 37,69 ---- _CreatePlayers (); ! /* ! //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. ! //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... ! pSoundManager->AddWAV("fire",false,true); ! pSoundManager->AddWAV("thunder",false,true); ! pSoundManager->AddWAV("Music",true,true); ! pSoundManager->AddWAV("step",true,true); ! pSoundManager->AddWAV("gun",true,false); ! ! //On prend les coordonnees de la tete de mort avec la lumiere rose ! Vector3 soundtestpos = pWorld->GetPointLightPos(5); + //On ajoute le son de feu a cette position + pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); + + //On ajoute le son wind a la position 0,70,0 + pSoundManager->SetSoundProperties("thunder",0,70,0,0,0,0); + + //On baisse le volume de la musique d'ambiance pSoundManager->SetSoundVolume("Music",0.5); ! //On joue les sons ! pSoundManager->PlaySound("fire"); ! pSoundManager->PlaySound("thunder"); ! pSoundManager->PlaySound("Music"); ! ! */ } *************** *** 107,111 **** void Game::PreFrame () { ! /* Camera* myCam = pSceneManager->GetCamera(); Vector3 position = myCam->GetPosition(); --- 125,131 ---- void Game::PreFrame () { ! /* ! ! Camera* myCam = pSceneManager->GetCamera(); Vector3 position = myCam->GetPosition(); *************** *** 115,119 **** pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z);*/ float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) --- 135,142 ---- pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z); ! ! */ ! float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) |
|
From: Seb <whi...@us...> - 2004-10-13 18:38:41
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21015 Modified Files: soundmanager.cc soundmanager.h Log Message: Nouvelle version du Sound Manager. Detection automatique de l'endian. Nouvelles methodes pour gerer le sound manager. Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** soundmanager.cc 10 Oct 2004 21:16:13 -0000 1.1 --- soundmanager.cc 13 Oct 2004 18:38:19 -0000 1.2 *************** *** 1,25 **** // Sebastien "Whistle Master or Seb" Samyn: sebastien.samyn *at* epfl.ch - #include <map> - #include <vector> - #include <string> - #include <iostream> - - #ifdef TGOSX - #include <OpenAL/al.h> - #include <OpenAL/alut.h> - #include <OpenAL/alc.h> - #include <OpenAL/altypes.h> - #else - #include <AL/al.h> - #include <AL/alut.h> - #include <AL/alc.h> - #include <AL/altypes.h> - #endif - - #include <vorbis/vorbisfile.h> - #include "soundmanager.h" - #include "engine.h" --- 1,5 ---- *************** *** 30,33 **** --- 10,19 ---- using namespace std; + namespace tg + { + + SoundManager* SoundManager::pSoundManager = NULL; + + // Constructor SoundManager::SoundManager() *************** *** 40,68 **** } - // Constructor - SoundManager::SoundManager(bool little) - { - if(little == true) - { - endian = 0; - - #ifdef DEBUG - cout << "OpenAL:: Starting SoundManager" << endl; - cout << "OpenAL:: Little Endian detected..." << endl; - #endif - } - else - { - endian = 1; - - #ifdef DEBUG - cout << "OpenAL:: Starting SoundManager" << endl; - cout << "OpenAL:: Big Endian detected..." << endl; - #endif - } - - init(); - } - // Destructor SoundManager::~SoundManager() --- 26,29 ---- *************** *** 83,86 **** --- 44,64 ---- #endif + if (Engine::pEndian->bLittle == true) + { + #ifdef DEBUG + cout << "OpenAL:: Little Endian detected..." << endl; + #endif + + endian = 0; + } + else + { + #ifdef DEBUG + cout << "OpenAL:: Big Endian detected..." << endl; + #endif + + endian = 1; + } + alutInit(NULL, 0); *************** *** 94,97 **** --- 72,95 ---- cout << "OpenAL:: Loading Lib: Vers = " << alversion << " | Renderer = " << alrenderer << " | Vendor = " << alvendor << endl; #endif + + Engine::pVarManager->AddVar("sound", 1); + enable = &Engine::pVarManager->GetVar("sound")->intValue; + + } + + // Disable the Sound Manager and stop all sounds in list + void SoundManager::DisableSoundManager() + { + map<string, ALuint>::iterator iter = SoundList.begin (); + for (; iter!=SoundList.end(); iter++) + alSourceStop(iter->second); + + Engine::pVarManager->AddVar("sound", 0); + } + + // Enable the Sound Manager + void SoundManager::EnableSoundManager() + { + Engine::pVarManager->AddVar("sound", 1); } *************** *** 100,104 **** { #ifdef DEBUG ! cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif --- 98,102 ---- { #ifdef DEBUG ! //cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif *************** *** 111,115 **** { #ifdef DEBUG ! cout << "OpenAL:: SetListenerOrientation" << endl; #endif --- 109,113 ---- { #ifdef DEBUG ! //cout << "OpenAL:: SetListenerOrientation" << endl; #endif *************** *** 146,152 **** alGenBuffers(1, &buffer); ! if ((result = alGetError()) != AL_NO_ERROR) ! throw GetALErrorString(result); ! // Read in the wav data from file. Check that it loaded correctly. --- 144,150 ---- alGenBuffers(1, &buffer); ! if ((result = alGetError()) != AL_NO_ERROR) ! throw GetALErrorString(result); ! // Read in the wav data from file. Check that it loaded correctly. *************** *** 236,240 **** if ((result = alGetError()) != AL_NO_ERROR) ! throw GetALErrorString(result); // Setup the source properties. --- 234,238 ---- if ((result = alGetError()) != AL_NO_ERROR) ! throw GetALErrorString(result); // Setup the source properties. *************** *** 256,259 **** --- 254,261 ---- void SoundManager::AddWAV(string name, bool relative,bool looping) { + FILE *f; + string tmp_name; + char *path; + try { *************** *** 262,269 **** #endif ! SoundList[name] = LoadWavALSample("data/sounds/"+name+".wav", looping); ! if(relative) ! alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); } --- 264,284 ---- #endif ! tmp_name = "data/sounds/"+name+".wav"; ! path = (char*) tmp_name.c_str(); ! ! f = fopen(path, "rb"); ! ! if (f == NULL) ! { ! cerr << "OpenAL:: Cannot open " << tmp_name << " for reading..." << endl; ! } ! else ! { ! SoundList[name] = LoadWavALSample("data/sounds/"+name+".wav", looping); ! ! if(relative) ! alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); ! } } *************** *** 276,364 **** } - // Sound properties (position and velocity) - void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) - { - #ifdef DEBUG - cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; - #endif - - //set the sounds position and velocity - alSource3f(SoundList[name],AL_POSITION,x/100,y/100,z/100); - alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); - } - - // Sound volume - void SoundManager::SetSoundVolume(string name, float x) - { - #ifdef DEBUG - cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; - #endif - - //set the sounds volume - alSourcef (SoundList[name], AL_GAIN,x); - } - - // Play a sound - void SoundManager::PlaySound(string name) - { - #ifdef DEBUG - cout << "OpenAL:: PlaySound: " << name << endl; - #endif - - alSourcePlay(SoundList[name]); - } - - // Stop a sound - void SoundManager::StopSound(string name) - { - #ifdef DEBUG - cout << "OpenAL:: StopSound: " << name << endl; - #endif - - alSourceStop(SoundList[name]); - } - - // Get Status - int SoundManager::SoundStatus(string name) - { - ALint state; - - #ifdef DEBUG - cout << "OpenAL:: SoundStatus: " << name << endl; - #endif - - alGetSourcei(SoundList[name], AL_SOURCE_STATE, &state); - - if (state == AL_PLAYING) - return 1; - else if (state == AL_PAUSED) - return 0; - else if (state == AL_STOPPED) - return -1; - - return -2; - } - - // Kill all buffers and sources - void SoundManager::KillALData() - { - // Release all buffer data. - for (vector<ALuint>::iterator iter = Buffers.begin(); iter != Buffers.end(); ++iter) - alDeleteBuffers(1, (ALuint*)(*iter)); - - // Release all source data. - for (vector<ALuint>::iterator iter = Sources.begin(); iter != Sources.end(); ++iter) - alDeleteBuffers(1, (ALuint*)(*iter)); - - #ifdef DEBUG - cout << "OpenAL:: KillALData" << endl; - #endif - - // Destroy the lists. - Buffers.clear(); - Sources.clear(); - SoundList.clear(); - } - // Creat a new buffer for a sound ALuint SoundManager::LoadOggALBuffer(char path[40]) --- 291,294 ---- *************** *** 474,477 **** --- 404,411 ---- void SoundManager::AddOGG(string name, bool relative,bool looping) { + FILE *f; + string tmp_name; + char *path; + try { *************** *** 480,487 **** #endif ! SoundList[name] = LoadOggALSample("data/sounds/"+name+".ogg", looping); ! if(relative) ! alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); } --- 414,434 ---- #endif ! tmp_name = "data/sounds/"+name+".ogg"; ! path = (char*) tmp_name.c_str(); ! ! f = fopen(path, "rb"); ! ! if (f == NULL) ! { ! cerr << "OpenAL:: Cannot open " << tmp_name << " for reading..." << endl; ! } ! else ! { ! SoundList[name] = LoadOggALSample("data/sounds/"+name+".ogg", looping); ! ! if(relative) ! alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); ! } } *************** *** 505,515 **** f = fopen(fileName, "rb"); - if (f == NULL) - { - cerr << "OpenAL:: Cannot open " << fileName << " for reading..." << endl; - exit(-1); - } - // end if - vorbis_info *pInfo; OggVorbis_File oggFile; --- 452,455 ---- *************** *** 517,524 **** // Try opening the given file if (ov_open(f, &oggFile, NULL, 0) != 0) ! { cerr << "OpenAL:: Error opening " << fileName << " for decoding..." << endl; exit(-1); ! } // end if --- 457,464 ---- // Try opening the given file if (ov_open(f, &oggFile, NULL, 0) != 0) ! { cerr << "OpenAL:: Error opening " << fileName << " for decoding..." << endl; exit(-1); ! } // end if *************** *** 535,556 **** // The frequency of the sampling rate freq = pInfo->rate; ! // Keep reading until all is read do ! { // Read up to a buffer's worth of decoded sound data bytes = ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream); if (bytes < 0) ! { ov_clear(&oggFile); cerr << "OpenAL:: Error decoding " << fileName << "..." << endl; exit(-1); ! } // end if // Append to end of buffer buffer.insert(buffer.end(), array, array + bytes); ! } while (bytes > 0); --- 475,497 ---- // The frequency of the sampling rate freq = pInfo->rate; ! // Keep reading until all is read do ! { // Read up to a buffer's worth of decoded sound data bytes = ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream); if (bytes < 0) ! { ov_clear(&oggFile); cerr << "OpenAL:: Error decoding " << fileName << "..." << endl; exit(-1); ! } // end if // Append to end of buffer buffer.insert(buffer.end(), array, array + bytes); ! ! } while (bytes > 0); *************** *** 559,562 **** --- 500,620 ---- } + // Sound properties (position and velocity) + void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) + { + #ifdef DEBUG + cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; + #endif + + //set the sounds position and velocity + if(CheckSound(name)) + { + alSource3f(SoundList[name],AL_POSITION,x/100,y/100,z/100); + alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); + } + } + + // Sound volume + void SoundManager::SetSoundVolume(string name, float x) + { + #ifdef DEBUG + cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; + #endif + + //set the sounds volume + if(CheckSound(name)) + alSourcef (SoundList[name], AL_GAIN,x); + } + + // Play a sound + void SoundManager::PlaySound(string name) + { + #ifdef DEBUG + cout << "OpenAL:: PlaySound: " << name << endl; + #endif + + if(CheckSound(name)) + alSourcePlay(SoundList[name]); + } + + // Stop a sound + void SoundManager::StopSound(string name) + { + #ifdef DEBUG + cout << "OpenAL:: StopSound: " << name << endl; + #endif + + if(CheckSound(name)) + alSourceStop(SoundList[name]); + } + + // Get Status + int SoundManager::SoundStatus(string name) + { + ALint state; + + #ifdef DEBUG + cout << "OpenAL:: SoundStatus: " << name << endl; + #endif + + if(CheckSound(name)) + { + alGetSourcei(SoundList[name], AL_SOURCE_STATE, &state); + + if (state == AL_PLAYING) + return 1; + else if (state == AL_PAUSED) + return 0; + else if (state == AL_STOPPED) + return -1; + } + + return -2; + } + + // Check if sound exists and if sound is enable + bool SoundManager::CheckSound(string name) + { + enable = &Engine::pVarManager->GetVar("sound")->intValue; + + if(SoundList[name]) + { + if(*enable) + { + return AL_TRUE; + } + else + { + return AL_FALSE; + } + } + else + { + cerr << "OpenAL:: Sound " << name << " not loaded..." << endl; + return AL_FALSE; + } + } + + // Kill all buffers and sources + void SoundManager::KillALData() + { + // Release all buffer data. + for (vector<ALuint>::iterator iter = Buffers.begin(); iter != Buffers.end(); ++iter) + alDeleteBuffers(1, (ALuint*)(*iter)); + + // Release all source data. + for (vector<ALuint>::iterator iter = Sources.begin(); iter != Sources.end(); ++iter) + alDeleteBuffers(1, (ALuint*)(*iter)); + + #ifdef DEBUG + cout << "OpenAL:: KillALData" << endl; + #endif + + // Destroy the lists. + Buffers.clear(); + Sources.clear(); + SoundList.clear(); + } + // Handling Errors string SoundManager::GetALErrorString(ALenum err) *************** *** 587,593 **** return string("AL_OUT_OF_MEMORY"); break; }; - - return 0; } --- 645,653 ---- return string("AL_OUT_OF_MEMORY"); break; + + default: + return string("UNKNOW_AL_ERROR"); + break; }; } *************** *** 598,602 **** { case ALC_NO_ERROR: ! return string("AL_NO_ERROR"); break; --- 658,662 ---- { case ALC_NO_ERROR: ! return string("ALC_NO_ERROR"); break; *************** *** 620,625 **** return string("ALC_OUT_OF_MEMORY"); break; }; - - return 0; } --- 680,689 ---- return string("ALC_OUT_OF_MEMORY"); break; + + default: + return string("UNKNOW_ALC_ERROR"); + break; }; } + + } \ No newline at end of file Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** soundmanager.h 10 Oct 2004 21:16:13 -0000 1.1 --- soundmanager.h 13 Oct 2004 18:38:19 -0000 1.2 *************** *** 1,7 **** --- 1,11 ---- // Sebastien "Whistle Master or Seb" Samyn: sebastien.samyn *chez* epfl.ch + #ifndef _TGSOUNDMANAGER_H + #define _TGSOUNDMANAGER_H + #include <map> #include <vector> #include <string> + #include <iostream> #ifdef TGOSX *************** *** 25,28 **** --- 29,35 ---- using std::vector; + namespace tg + { + //SoundManager class SoundManager *************** *** 30,41 **** public: ~SoundManager(); SoundManager(); ! ! SoundManager(bool little); ! void AddWAV(string name, bool relative,bool looping); void AddOGG(string name, bool relative,bool looping); void PlaySound(string name); void StopSound(string name); --- 37,52 ---- public: + static SoundManager* pSoundManager; + + int* enable; // Check if soundmanager is enable or not + ~SoundManager(); SoundManager(); ! void AddWAV(string name, bool relative,bool looping); void AddOGG(string name, bool relative,bool looping); + bool CheckSound(string name); + void PlaySound(string name); void StopSound(string name); *************** *** 51,57 **** void KillALData(); ! protected: ! int endian; // 0 for Little-Endian, 1 for Big-Endian void init(); --- 62,71 ---- void KillALData(); ! void EnableSoundManager(); ! void DisableSoundManager(); ! ! private: ! int endian; // 0 for Little-Endian, 1 for Big-Endian void init(); *************** *** 78,79 **** --- 92,96 ---- }; + } + + #endif |
|
From: Yohann C. <pl...@us...> - 2004-10-11 12:25:53
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8081 Modified Files: controller.cc Log Message: Index: controller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/controller.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** controller.cc 11 Oct 2004 12:07:06 -0000 1.3 --- controller.cc 11 Oct 2004 12:25:39 -0000 1.4 *************** *** 28,32 **** float factor = 1.0f; //on garde l'accélération sur les y, elle est gérée par le moteur physique ! if (iForward >= 1) --- 28,32 ---- float factor = 1.0f; //on garde l'accélération sur les y, elle est gérée par le moteur physique ! if (iForward >= 1) *************** *** 50,57 **** vAccel.z -= sinf(fYaw*DEGTORAD)*fSpeed*factor; } - - pPawn->GetModel()->SetAcceleration(vAccel); - - } --- 50,55 ---- vAccel.z -= sinf(fYaw*DEGTORAD)*fSpeed*factor; } + pPawn->GetModel()->SetAcceleration(vAccel); + } |
|
From: Yohann C. <pl...@us...> - 2004-10-11 12:07:17
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3130 Modified Files: controller.cc Log Message: Index: controller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/controller.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** controller.cc 26 Sep 2004 14:44:55 -0000 1.2 --- controller.cc 11 Oct 2004 12:07:06 -0000 1.3 *************** *** 35,39 **** vAccel.z -= cosf(fYaw*DEGTORAD)*fSpeed*factor; } ! else if (iForward >= -1) { vAccel.x -= sinf(fYaw*DEGTORAD)*fSpeed*factor; --- 35,39 ---- vAccel.z -= cosf(fYaw*DEGTORAD)*fSpeed*factor; } ! else if (iForward <= -1) { vAccel.x -= sinf(fYaw*DEGTORAD)*fSpeed*factor; |
|
From: julien r. <jul...@us...> - 2004-10-10 21:59:30
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30199 Added Files: physiccallback.h Log Message: --- NEW FILE: physiccallback.h --- #ifndef _TGPHYSICCALLBACK #define _TGPHYSICCALLBACK #include "vector3.h" namespace tg { /** * PhysicCallBack: implemente les fonctions appeles lorsqu'un scenenode "colisionne" (avec le monde ou avec un autre scenenode) */ class SceneNode; class PhysicCallBack { public: virtual void Collide (SceneNode* other,const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; }; } #endif |
|
From: julien r. <jul...@us...> - 2004-10-10 21:26:46
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22882 Added Files: aicontroller.cc aicontroller.h Removed Files: iacontroller.cc iacontroller.h Log Message: renommé aicontroller en iacontroller --- NEW FILE: aicontroller.h --- #ifndef _TGAICONTROLLER_H #define _TGAICONTROLLER_H #include "controller.h" #include <scenemanager.h> class AIController : public Controller { public: AIController (Pawn* p) : Controller(p) {} void Think (float); void Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); }; #endif --- iacontroller.cc DELETED --- --- iacontroller.h DELETED --- --- NEW FILE: aicontroller.cc --- #include "aicontroller.h" #include "game.h" void AIController::Think (float eTime) { iForward += 1; CollisionResult c = Game::pSelf->GetSceneManager()->Trace(pPawn->GetPosition(), pPawn->GetPosition()+Vector3::UNIT_X*100); // std::cout << std::setprecision(0) << "Endpoint : " << c.EndPoint << "\t\tNormal : " << c.Normal << std::endl; } void AIController::Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { //std::cout << "aicontroller" << std::endl; } |
|
From: julien r. <jul...@us...> - 2004-10-10 21:19:54
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21194 Modified Files: controller.h game.cc game.h world.h Log Message: ai Index: world.h =================================================================== RCS file: /cvsroot/epfl/tggame/world.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** world.h 1 Oct 2004 21:31:06 -0000 1.2 --- world.h 10 Oct 2004 21:18:41 -0000 1.3 *************** *** 27,30 **** --- 27,37 ---- * @param char* le nom du bsp a charger */ + + /** + * IsPointIn : retourne true si le point est dans la map ou false s'il est en dehors (ou dans un mur) + * @param pos la position du point + */ + inline bool IsPointIn (const Vector3& pos) { return (pMap->FindCluster(pos)>= 0); } + void ChangeMap (char*); /** Index: game.h =================================================================== RCS file: /cvsroot/epfl/tggame/game.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** game.h 10 Oct 2004 20:54:47 -0000 1.5 --- game.h 10 Oct 2004 21:18:41 -0000 1.6 *************** *** 54,57 **** --- 54,58 ---- inline SceneManager* GetSceneManager () { return pSceneManager; } + inline World* GetWorld () { return pWorld; } /** Index: controller.h =================================================================== RCS file: /cvsroot/epfl/tggame/controller.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** controller.h 10 Oct 2004 20:54:47 -0000 1.3 --- controller.h 10 Oct 2004 21:18:41 -0000 1.4 *************** *** 23,26 **** --- 23,28 ---- virtual void Collide(SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; + + inline Pawn* GetPawn () { return pPawn; } protected: Pawn* pPawn; Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** game.cc 10 Oct 2004 20:54:47 -0000 1.8 --- game.cc 10 Oct 2004 21:18:41 -0000 1.9 *************** *** 116,120 **** pSoundManager->SetListenerPosition(position.x,position.y,position.z); pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z);*/ - float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) --- 116,119 ---- |
|
From: julien r. <jul...@us...> - 2004-10-10 21:16:38
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20643 Added Files: soundmanager.cc soundmanager.h Log Message: --- NEW FILE: soundmanager.cc --- // Sebastien "Whistle Master or Seb" Samyn: sebastien.samyn *at* epfl.ch #include <map> #include <vector> #include <string> #include <iostream> #ifdef TGOSX #include <OpenAL/al.h> #include <OpenAL/alut.h> #include <OpenAL/alc.h> #include <OpenAL/altypes.h> #else #include <AL/al.h> #include <AL/alut.h> #include <AL/alc.h> #include <AL/altypes.h> #endif #include <vorbis/vorbisfile.h> #include "soundmanager.h" #include "engine.h" using std::string; using std::map; using std::vector; using namespace std; // Constructor SoundManager::SoundManager() { #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; #endif init(); } // Constructor SoundManager::SoundManager(bool little) { if(little == true) { endian = 0; #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; cout << "OpenAL:: Little Endian detected..." << endl; #endif } else { endian = 1; #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; cout << "OpenAL:: Big Endian detected..." << endl; #endif } init(); } // Destructor SoundManager::~SoundManager() { #ifdef DEBUG cout << "OpenAL:: Ending SoundManager" << endl; #endif KillALData(); alutExit(); } // Intialisation void SoundManager::init() { #ifdef DEBUG cout << "OpenAL:: Initializing SoundManager" << endl; #endif alutInit(NULL, 0); const ALubyte *alversion, *alrenderer, *alvendor, *alext; alversion = alGetString( AL_VERSION ); alrenderer = alGetString( AL_RENDERER ); alvendor = alGetString( AL_VENDOR ); alext = alGetString( AL_EXTENSIONS ); #ifdef DEBUG cout << "OpenAL:: Loading Lib: Vers = " << alversion << " | Renderer = " << alrenderer << " | Vendor = " << alvendor << endl; #endif } // Listener Position (player or camera) void SoundManager::SetListenerPosition(float x, float y, float z) { #ifdef DEBUG cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif //set the position using 3 seperate floats alListener3f(AL_POSITION, x/100,y/100,z/100); } // Listener Orientation void SoundManager::SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz) { #ifdef DEBUG cout << "OpenAL:: SetListenerOrientation" << endl; #endif //set the orientation using an array of floats float vec[6]; vec[0] = fx; vec[1] = fy; vec[2] = fz; vec[3] = ux; vec[4] = uy; vec[5] = uz; alListenerfv(AL_ORIENTATION, vec); } // Creat a new buffer for a sound ALuint SoundManager::LoadWavALBuffer(char path[40]) { // Variables to store data which defines the buffer. ALenum format; ALsizei size; ALvoid* data; ALsizei freq; // Buffer id and error checking variable. ALuint buffer; ALenum result; #ifdef DEBUG cout << "OpenAL:: LoadWavALBuffer: " << path << endl; #endif // Generate a buffer. Check that it was created successfully. alGenBuffers(1, &buffer); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Read in the wav data from file. Check that it loaded correctly. #ifdef TGOSX alutLoadWAVFile(path, &format, &data, &size, &freq); #endif #ifdef TGWIN32 alutLoadWAVFile(path, &format, &data, &size, &freq, AL_FALSE); #endif #ifdef TGLINUX alutLoadWAVFile((ALbyte *) path, &format, &data, &size,&freq, AL_FALSE); #endif if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Send the wav data into the buffer. Check that it was received properly. alBufferData(buffer, format, data, size, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Get rid of the temporary data. alutUnloadWAV(format, data, size, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Return the buffer id. return buffer; } // Check if a buffer already exist. If no, creat a new one ALuint SoundManager::GetLoadedWavALBuffer(char path[40]) { int count = 0; // 'count' will be an index to the buffer list. ALuint buffer; // Buffer id for the loaded buffer. #ifdef DEBUG cout << "OpenAL:: GetLoadedWavALBuffer: " << path << endl; #endif // Iterate through each file path in the list. for(vector<string>::iterator iter = LoadedFiles.begin(); iter != LoadedFiles.end(); ++iter, count++) { // If this file path matches one we have loaded already, return the buffer id for it. if(*iter == path) return Buffers[count]; } // If we have made it this far then this file is new and we will create a buffer for it. buffer = LoadWavALBuffer(path); // Add this new buffer to the list, and register that this file has been loaded already. Buffers.push_back(buffer); LoadedFiles.push_back(path); return buffer; } // Creat a buffer and a source for a new sound ALuint SoundManager::LoadWavALSample(string name, bool loop) { ALuint source; ALuint buffer; ALenum result; // All new sound are in postion (0,0,0) ALfloat SourcePos[] = {0.0, 0.0, 0.0}; ALfloat SourceVel[]= {0.0, 0.0, 0.0}; char *path = (char*) name.c_str(); #ifdef DEBUG cout << "OpenAL:: LoadWavALSample: " << name << endl; #endif // Get the files buffer id (load it if necessary). buffer = GetLoadedWavALBuffer(path); // Generate a source. alGenSources(1, &source); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Setup the source properties. alSourcei (source, AL_BUFFER, buffer ); alSourcef (source, AL_PITCH, 1.0f ); alSourcef (source, AL_GAIN, 1.0f ); alSourcefv(source, AL_POSITION, SourcePos); alSourcefv(source, AL_VELOCITY, SourceVel); alSourcei (source, AL_LOOPING, loop ); // Save the source id. Sources.push_back(source); // Return the source id. return source; } // Add a Wav sound to the sounds list void SoundManager::AddWAV(string name, bool relative,bool looping) { try { #ifdef DEBUG cout << "OpenAL:: AddWAV: " << name << endl; #endif SoundList[name] = LoadWavALSample("data/sounds/"+name+".wav", looping); if(relative) alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); } catch(string err) { cout << "OpenAL error: " << err.c_str() << endl; } LoadedFiles.clear(); } // Sound properties (position and velocity) void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) { #ifdef DEBUG cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; #endif //set the sounds position and velocity alSource3f(SoundList[name],AL_POSITION,x/100,y/100,z/100); alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); } // Sound volume void SoundManager::SetSoundVolume(string name, float x) { #ifdef DEBUG cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; #endif //set the sounds volume alSourcef (SoundList[name], AL_GAIN,x); } // Play a sound void SoundManager::PlaySound(string name) { #ifdef DEBUG cout << "OpenAL:: PlaySound: " << name << endl; #endif alSourcePlay(SoundList[name]); } // Stop a sound void SoundManager::StopSound(string name) { #ifdef DEBUG cout << "OpenAL:: StopSound: " << name << endl; #endif alSourceStop(SoundList[name]); } // Get Status int SoundManager::SoundStatus(string name) { ALint state; #ifdef DEBUG cout << "OpenAL:: SoundStatus: " << name << endl; #endif alGetSourcei(SoundList[name], AL_SOURCE_STATE, &state); if (state == AL_PLAYING) return 1; else if (state == AL_PAUSED) return 0; else if (state == AL_STOPPED) return -1; return -2; } // Kill all buffers and sources void SoundManager::KillALData() { // Release all buffer data. for (vector<ALuint>::iterator iter = Buffers.begin(); iter != Buffers.end(); ++iter) alDeleteBuffers(1, (ALuint*)(*iter)); // Release all source data. for (vector<ALuint>::iterator iter = Sources.begin(); iter != Sources.end(); ++iter) alDeleteBuffers(1, (ALuint*)(*iter)); #ifdef DEBUG cout << "OpenAL:: KillALData" << endl; #endif // Destroy the lists. Buffers.clear(); Sources.clear(); SoundList.clear(); } // Creat a new buffer for a sound ALuint SoundManager::LoadOggALBuffer(char path[40]) { // Variables to store data which defines the buffer. ALenum format; ALsizei freq; vector<char> bufferData; // Buffer id and error checking variable. ALuint buffer; ALenum result; #ifdef DEBUG cout << "OpenAL:: LoadOggALBuffer: " << path << endl; #endif // Generate a buffer. Check that it was created successfully. alGenBuffers(1, &buffer); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Read in the wav data from file. Check that it loaded correctly. LoadOGG(path, bufferData, format, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Send the wav data into the buffer. Check that it was received properly. alBufferData(buffer, format, &bufferData[0], static_cast<ALsizei>(bufferData.size()), freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Return the buffer id. return buffer; } // Check if a buffer already exist. If no, creat a new one ALuint SoundManager::GetLoadedOggALBuffer(char path[40]) { int count = 0; // 'count' will be an index to the buffer list. ALuint buffer; // Buffer id for the loaded buffer. #ifdef DEBUG cout << "OpenAL:: GetLoadedOggALBuffer: " << path << endl; #endif // Iterate through each file path in the list. for(vector<string>::iterator iter = LoadedFiles.begin(); iter != LoadedFiles.end(); ++iter, count++) { // If this file path matches one we have loaded already, return the buffer id for it. if(*iter == path) return Buffers[count]; } // If we have made it this far then this file is new and we will create a buffer for it. buffer = LoadOggALBuffer(path); // Add this new buffer to the list, and register that this file has been loaded already. Buffers.push_back(buffer); LoadedFiles.push_back(path); return buffer; } // Creat a buffer and a source for a new sound ALuint SoundManager::LoadOggALSample(string name, bool loop) { ALuint source; ALuint buffer; ALenum result; // All new sound are in postion (0,0,0) ALfloat SourcePos[] = {0.0, 0.0, 0.0}; ALfloat SourceVel[]= {0.0, 0.0, 0.0}; char *path = (char*) name.c_str(); #ifdef DEBUG cout << "OpenAL:: LoadOggALSample: " << name << endl; #endif // Get the files buffer id (load it if necessary). buffer = GetLoadedOggALBuffer(path); // Generate a source. alGenSources(1, &source); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Setup the source properties. alSourcei (source, AL_BUFFER, buffer ); alSourcef (source, AL_PITCH, 1.0f ); alSourcef (source, AL_GAIN, 1.0f ); alSourcefv(source, AL_POSITION, SourcePos); alSourcefv(source, AL_VELOCITY, SourceVel); alSourcei (source, AL_LOOPING, loop ); // Save the source id. Sources.push_back(source); // Return the source id. return source; } // Add a Wav sound to the sounds list void SoundManager::AddOGG(string name, bool relative,bool looping) { try { #ifdef DEBUG cout << "OpenAL:: AddOGG: " << name << endl; #endif SoundList[name] = LoadOggALSample("data/sounds/"+name+".ogg", looping); if(relative) alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); } catch(string err) { cout << "OpenAL:: Error: " << err.c_str() << endl; } LoadedFiles.clear(); } // This function loads a .ogg file into a memory buffer and returns the format and frequency. void SoundManager::LoadOGG(char *fileName, vector<char> &buffer, ALenum &format, ALsizei &freq) { int bitStream; long bytes; char array[BUFFER_SIZE]; // Local fixed size array FILE *f; // Open for binary reading f = fopen(fileName, "rb"); if (f == NULL) { cerr << "OpenAL:: Cannot open " << fileName << " for reading..." << endl; exit(-1); } // end if vorbis_info *pInfo; OggVorbis_File oggFile; // Try opening the given file if (ov_open(f, &oggFile, NULL, 0) != 0) { cerr << "OpenAL:: Error opening " << fileName << " for decoding..." << endl; exit(-1); } // end if // Get some information about the OGG file pInfo = ov_info(&oggFile, -1); // Check the number of channels... always use 16-bit samples if (pInfo->channels == 1) format = AL_FORMAT_MONO16; else format = AL_FORMAT_STEREO16; // end if // The frequency of the sampling rate freq = pInfo->rate; // Keep reading until all is read do { // Read up to a buffer's worth of decoded sound data bytes = ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream); if (bytes < 0) { ov_clear(&oggFile); cerr << "OpenAL:: Error decoding " << fileName << "..." << endl; exit(-1); } // end if // Append to end of buffer buffer.insert(buffer.end(), array, array + bytes); } while (bytes > 0); // Clean up! ov_clear(&oggFile); } // Handling Errors string SoundManager::GetALErrorString(ALenum err) { switch(err) { case AL_NO_ERROR: return string("AL_NO_ERROR"); break; case AL_INVALID_NAME: return string("AL_INVALID_NAME"); break; case AL_INVALID_ENUM: return string("AL_INVALID_ENUM"); break; case AL_INVALID_VALUE: return string("AL_INVALID_VALUE"); break; case AL_INVALID_OPERATION: return string("AL_INVALID_OPERATION"); break; case AL_OUT_OF_MEMORY: return string("AL_OUT_OF_MEMORY"); break; }; return 0; } // Handling Errors string SoundManager::GetALCErrorString(ALenum err) { switch(err) { case ALC_NO_ERROR: return string("AL_NO_ERROR"); break; case ALC_INVALID_DEVICE: return string("ALC_INVALID_DEVICE"); break; case ALC_INVALID_CONTEXT: return string("ALC_INVALID_CONTEXT"); break; case ALC_INVALID_ENUM: return string("ALC_INVALID_ENUM"); break; case ALC_INVALID_VALUE: return string("ALC_INVALID_VALUE"); break; case ALC_OUT_OF_MEMORY: return string("ALC_OUT_OF_MEMORY"); break; }; return 0; } --- NEW FILE: soundmanager.h --- // Sebastien "Whistle Master or Seb" Samyn: sebastien.samyn *chez* epfl.ch #include <map> #include <vector> #include <string> #ifdef TGOSX #include <OpenAL/al.h> #include <OpenAL/alut.h> #include <OpenAL/alc.h> #include <OpenAL/altypes.h> #else #include <AL/al.h> #include <AL/alut.h> #include <AL/alc.h> #include <AL/altypes.h> #endif #include <vorbis/vorbisfile.h> #define BUFFER_SIZE 32768 // 32 KB buffers using std::string; using std::map; using std::vector; //SoundManager class SoundManager { public: ~SoundManager(); SoundManager(); SoundManager(bool little); void AddWAV(string name, bool relative,bool looping); void AddOGG(string name, bool relative,bool looping); void PlaySound(string name); void StopSound(string name); int SoundStatus(string name); void SetSoundVolume(string name, float x); void SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz); void SetListenerPosition(float x, float y, float z); void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz); void KillALData(); protected: int endian; // 0 for Little-Endian, 1 for Big-Endian void init(); string GetALErrorString(ALenum err); string GetALCErrorString(ALenum err); ALuint LoadWavALBuffer(char path[40]); ALuint GetLoadedWavALBuffer(char path[40]); ALuint LoadWavALSample(string name, bool loop); ALuint LoadOggALBuffer(char path[40]); ALuint GetLoadedOggALBuffer(char path[40]); ALuint LoadOggALSample(string name, bool loop); void LoadOGG(char *fileName, vector<char> &buffer, ALenum &format, ALsizei &freq); vector<string> LoadedFiles; // Holds loaded file paths temporarily. vector<ALuint> Buffers; // Holds all loaded buffers. vector<ALuint> Sources; // Holds all validated sources. map<string, ALuint> SoundList; // Hold all sounds. }; |
|
From: julien r. <jul...@us...> - 2004-10-10 21:12:38
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19775 Modified Files: physicengine.cc q3bsp.cc q3bsp.h Log Message: Quelques ajouts pour l'IA (méthode FindCluster) Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** physicengine.cc 10 Oct 2004 20:49:09 -0000 1.8 --- physicengine.cc 10 Oct 2004 21:11:55 -0000 1.9 *************** *** 89,93 **** //Vector3 origin = n->GetPosition(); //on ajoute la gravite ! if (!n->bOnGround) n->vAccel.y -= (*fGravity); else if (n->vAccel.y < 0) //si l'objet touche le sol, il faut ramener la gravité à zéro, sinon, l'objet va se retrouver avec une gravité négative très grande (ça l'empeche de sauter notamment) --- 89,93 ---- //Vector3 origin = n->GetPosition(); //on ajoute la gravite ! if (!n->bOnGround && !n->bNoClip) n->vAccel.y -= (*fGravity); else if (n->vAccel.y < 0) //si l'objet touche le sol, il faut ramener la gravité à zéro, sinon, l'objet va se retrouver avec une gravité négative très grande (ça l'empeche de sauter notamment) Index: q3bsp.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** q3bsp.cc 27 Sep 2004 16:31:35 -0000 1.5 --- q3bsp.cc 10 Oct 2004 21:11:55 -0000 1.6 *************** *** 768,772 **** { int index = 0; ! // Les nodes ont des index > 0 // Les leafs ont des index négatifs. Pour obtenir l'index dans le tableau pLeafs, on fait index_tableau = -index_node - 1 ; while (index >= 0) --- 768,772 ---- { int index = 0; ! // Les nodes ont des index >= 0 // Les leafs ont des index négatifs. Pour obtenir l'index dans le tableau pLeafs, on fait index_tableau = -index_node - 1 ; while (index >= 0) *************** *** 1004,1008 **** int iCamLeaf = FindLeaf(pCamera->vPosition); int iCamCluster = pLeafs[iCamLeaf].cluster; - for (int i=0; i<numOfLeafs; i++) { --- 1004,1007 ---- Index: q3bsp.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** q3bsp.h 26 Sep 2004 13:15:25 -0000 1.1.1.1 --- q3bsp.h 10 Oct 2004 21:11:55 -0000 1.2 *************** *** 439,442 **** --- 439,450 ---- */ int FindLeaf (const Vector3& pos); + + /** + * FindCluster + * Retourne le cluster d'une position, utile parce que lorsque l'on est en-dehors de la map, le cluster est égal a -1 !! + * @param pos le point dont on veut le cluster + * @return le numero du cluster + */ + inline int FindCluster (const Vector3& pos) { return pLeafs[FindLeaf(pos)].cluster; } /** |
|
From: julien r. <jul...@us...> - 2004-10-10 20:55:27
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16197 Modified Files: Makefile Makefile.Linux controller.h game.cc game.h model.h pawn.cc pawn.h playercontroller.cc playercontroller.h Log Message: AI Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** game.cc 4 Oct 2004 14:51:01 -0000 1.7 --- game.cc 10 Oct 2004 20:54:47 -0000 1.8 *************** *** 91,94 **** --- 91,95 ---- vControllers.push_back(pLocalController); p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(20,70,20)); + p->GetCamera()->SetPhysicCallBack(pLocalController); *************** *** 97,108 **** vPawns.push_back(p); this->AddPawn(p); ! Controller* c = new IAController(p); vControllers.push_back(c); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(0,70,0)); } void Game::PreFrame () { ! Camera* myCam = pSceneManager->GetCamera(); Vector3 position = myCam->GetPosition(); --- 98,111 ---- vPawns.push_back(p); this->AddPawn(p); ! Controller* c = new AIController(p); vControllers.push_back(c); ! p->SetMoveSpeed(15000); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(0,30,0)); ! p->GetModel()->SetPhysicCallBack(c); } void Game::PreFrame () { ! /* Camera* myCam = pSceneManager->GetCamera(); Vector3 position = myCam->GetPosition(); *************** *** 112,116 **** pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z); float t = pTimer->GetFrameInterval (); --- 115,119 ---- pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z);*/ float t = pTimer->GetFrameInterval (); Index: pawn.h =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pawn.h 28 Sep 2004 09:45:24 -0000 1.3 --- pawn.h 10 Oct 2004 20:54:47 -0000 1.4 *************** *** 29,35 **** --- 29,43 ---- inline void SetPosition (const Vector3& v) { pModel->SetPosition(v); if (pCamera) pCamera->SetPosition(v);} + inline Vector3 GetPosition () + { + if (pModel) return pModel->GetPosition(); + else if (pCamera) return pCamera->GetPosition(); + return Vector3::ZERO; + } + inline Camera* GetCamera () { return pCamera; } inline float GetMoveSpeed () { return fMoveSpeed; } + inline void SetMoveSpeed (float s) { fMoveSpeed = s; } Model* GetModel () { return pModel; } Index: pawn.cc =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pawn.cc 26 Sep 2004 14:44:55 -0000 1.2 --- pawn.cc 10 Oct 2004 20:54:47 -0000 1.3 *************** *** 7,10 **** pModel = new Model ("data/models/pinky/pinky.mdl", MDL_PLAYER); pCamera = c; ! fMoveSpeed = 1.0f; } --- 7,10 ---- pModel = new Model ("data/models/pinky/pinky.mdl", MDL_PLAYER); pCamera = c; ! fMoveSpeed = 0.0f; } Index: model.h =================================================================== RCS file: /cvsroot/epfl/tggame/model.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** model.h 30 Sep 2004 10:31:42 -0000 1.4 --- model.h 10 Oct 2004 20:54:47 -0000 1.5 *************** *** 48,52 **** --- 48,57 ---- void Add(PhysicEngine* p); + /** + * SetPhysicCallBack: change la fonction appele lors de collision + */ + void SetPhysicCallBack (PhysicCallBack* p) { pMD5->SetPhysicCallBack(p); } + inline Vector3 GetPosition () { return pMD5->GetPosition(); } inline void SetPosition (const Vector3& v) { pMD5->SetPosition(v); } inline void SetAcceleration (const Vector3& v) { pMD5->vAccel = v; } Index: playercontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** playercontroller.h 24 Sep 2004 13:26:30 -0000 1.2 --- playercontroller.h 10 Oct 2004 20:54:47 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- void Think (float); void EventHandler (tgEvent& e); + void Collide(SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); }; Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** playercontroller.cc 26 Sep 2004 14:44:55 -0000 1.3 --- playercontroller.cc 10 Oct 2004 20:54:47 -0000 1.4 *************** *** 13,16 **** --- 13,21 ---- } + void PlayerController::Collide (SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) + { + // std::cout << "playercontroller" << std::endl; + } + void PlayerController::EventHandler (tgEvent& e) { Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 1 Oct 2004 20:26:03 -0000 1.6 --- Makefile 10 Oct 2004 20:54:47 -0000 1.7 *************** *** 3,7 **** ## ! all: linux clean: --- 3,7 ---- ## ! all: linuxDebug clean: Index: game.h =================================================================== RCS file: /cvsroot/epfl/tggame/game.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** game.h 2 Oct 2004 22:47:06 -0000 1.4 --- game.h 10 Oct 2004 20:54:47 -0000 1.5 *************** *** 11,18 **** #include "controller.h" #include "playercontroller.h" ! #include "iacontroller.h" #include "world.h" ! #include "SoundManager.h" using namespace tg; --- 11,18 ---- #include "controller.h" #include "playercontroller.h" ! #include "aicontroller.h" #include "world.h" ! #include "soundmanager.h" using namespace tg; *************** *** 53,56 **** --- 53,58 ---- void PostFrame (); + inline SceneManager* GetSceneManager () { return pSceneManager; } + /** * GetLocalController : retourne le controller local (celui qui reçoit les événements locaux (clavier + souris) Index: controller.h =================================================================== RCS file: /cvsroot/epfl/tggame/controller.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** controller.h 26 Sep 2004 14:44:55 -0000 1.2 --- controller.h 10 Oct 2004 20:54:47 -0000 1.3 *************** *** 4,7 **** --- 4,8 ---- #include <event.h> #include <defs.h> + #include <physiccallback.h> #include "pawn.h" *************** *** 12,16 **** * * Classe parente des robots et joueurs humains */ ! class Controller : public Actor { public: --- 13,17 ---- * * Classe parente des robots et joueurs humains */ ! class Controller : public Actor, public PhysicCallBack { public: *************** *** 20,23 **** --- 21,26 ---- virtual void EventHandler (tgEvent& e) {} virtual void MovePawn(); + + virtual void Collide(SceneNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; protected: Pawn* pPawn; Index: Makefile.Linux =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile.Linux,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.Linux 27 Sep 2004 21:41:34 -0000 1.3 --- Makefile.Linux 10 Oct 2004 20:54:47 -0000 1.4 *************** *** 3,7 **** INCLUDEPATH = -I/usr/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out ! LIBS = -lGL -lSDL -lGLU -ltgengine -ljpeg -lm -lSDL_image OBJ_EXT = o OBJSRC = $(wildcard *.cc) --- 3,7 ---- INCLUDEPATH = -I/usr/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out ! LIBS = -lGL -lSDL -lGLU -ltgengine -ljpeg -lm -lSDL_image -lvorbis -lvorbisfile -lopenal OBJ_EXT = o OBJSRC = $(wildcard *.cc) |
|
From: julien r. <jul...@us...> - 2004-10-10 20:50:29
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15116 Modified Files: Makefile camera.cc defs.h engine.cc physicengine.cc physicengine.h scenemanager.cc scenenode.cc scenenode.h vector3.h Removed Files: SoundManager.cc SoundManager.h Log Message: PhysicCallBack Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** physicengine.cc 27 Sep 2004 16:18:40 -0000 1.7 --- physicengine.cc 10 Oct 2004 20:49:09 -0000 1.8 *************** *** 46,55 **** time_left -= time_left*trace.Fraction; ! vVelocity = ClipVelocity (vVelocity, trace.CollisionNormal); } } ! Vector3 PhysicEngine::ClipVelocity (const Vector3& vel, const Vector3 norm) { /* le produit scalaire entre la vitesse et la normale nous donne --- 46,55 ---- time_left -= time_left*trace.Fraction; ! ClipVelocity (vVelocity, trace.CollisionNormal); } } ! void PhysicEngine::ClipVelocity (Vector3& vel, const Vector3 norm) { /* le produit scalaire entre la vitesse et la normale nous donne *************** *** 62,66 **** float backoff = vel*norm*fOverBounce; Vector3 change = norm*backoff; ! return (vel - change); } --- 62,67 ---- float backoff = vel*norm*fOverBounce; Vector3 change = norm*backoff; ! vel -= change; ! //return (vel - change); } *************** *** 70,74 **** --- 71,78 ---- * Code inspiré de celui de Quake 2 (fichier qcommon/pmove.c) */ + //ugly hackpour que le bOnGround ne bug pas sur les monstres + //-> on différenci la taille du joueur et des autres objets pour être sur le sol #define PLAYER_HEIGHT 80 + #define BASE_HEIGHT 5 #define STEPSIZE 10 void PhysicEngine::Move (float eTime) *************** *** 89,92 **** --- 93,101 ---- else if (n->vAccel.y < 0) //si l'objet touche le sol, il faut ramener la gravité à zéro, sinon, l'objet va se retrouver avec une gravité négative très grande (ça l'empeche de sauter notamment) n->vAccel.y = 0; + /*std::cout << n << "\t" ; + std::cout << n->bOnGround; + std::cout << "\t" << n->vAccel << std::endl;*/ + //int red[]={1,0,0}; + //Engine::pEngine->pRenderer->drawDebugArrow(n->vPosition, n->vPosition+n->vAccel*5, red); n->vVelocity = n->vAccel*eTime; //mise a jour des volumes englobants *************** *** 112,116 **** float distx, distz; - StepSlideMove (n, eTime, vVelocity, vPos); vNewPos += vVelocity*eTime; --- 121,124 ---- *************** *** 120,139 **** distz *= distz; float dist = sqrt(distx+distz); ! ! StepSlideMove (n, eTime, vUpVelocity, vUpPos); ! vUpNewPos += vUpVelocity*eTime; ! distx = (vUpNewPos.x - vUpPos.x); ! distx *= distx; ! distz = (vUpNewPos.z - vUpPos.z); ! distz *= distz; ! float updist = sqrt(distx+distz); ! ! if (updist > dist) //on passe l'obstacle ! n->SetPosition(vUpNewPos); ! else //l'obstacle est trop haut ! n->SetPosition(vNewPos); ! //Classification de la position ! if (pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*PLAYER_HEIGHT, TRACE_RAY, 0).Fraction < 1.0f) n->bOnGround = true; else --- 128,172 ---- distz *= distz; float dist = sqrt(distx+distz); ! ! StepSlideMove (n, eTime, vUpVelocity, vUpPos); ! vUpNewPos += vUpVelocity*eTime; ! distx = (vUpNewPos.x - vUpPos.x); ! distx *= distx; ! distz = (vUpNewPos.z - vUpPos.z); ! distz *= distz; ! float updist = sqrt(distx+distz); ! ! ! if (updist > dist) //on passe l'obstacle ! { ! //std::cout << "time : " << eTime << "\t" << vUpNewPos << std::endl; ! n->SetPosition(vUpNewPos); ! if (vUpVelocity != n->vVelocity && n->GetPhysicCallBack() != NULL) ! { ! //std::cout << "callback" << std::endl; ! //ce ne sont pas les memes, donc il y a eu collision -> appelle de la callback ! n->GetPhysicCallBack()->Collide(NULL, Vector3(0,0,0), Vector3(0,0,0)); ! } ! ! ! } ! else //l'obstacle est trop haut ! { ! //std::cout << "time : " << eTime << "\t" << vNewPos << std::endl; ! n->SetPosition(vNewPos); ! if (vVelocity != n->vVelocity && n->GetPhysicCallBack() != NULL) ! { ! //std::cout << "callback" << std::endl; ! //ce ne sont pas les memes, donc il y a eu collision -> appelle de la callback ! n->GetPhysicCallBack()->Collide(NULL, Vector3(0,0,0), Vector3(0,0,0)); ! } ! ! } ! //Classification de la position ! //FIXME:on fait une differenciation entre le joueur et les autres scenenode. il ne faudrait pas! ! if (n->bIsCamera && pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*PLAYER_HEIGHT, TRACE_RAY, 0).Fraction < 1.0f) ! n->bOnGround = true; ! else if (!n->bIsCamera && pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, n->pBBox->vMin, n->pBBox->vMax).Fraction < 1.0f) n->bOnGround = true; else Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** scenemanager.cc 1 Oct 2004 21:30:28 -0000 1.4 --- scenemanager.cc 10 Oct 2004 20:49:09 -0000 1.5 *************** *** 83,91 **** void SceneManager::_ProcessTimedObject (Mesh* s, float t) { ! if (s->fTime < 0) //l'objet ne tient pas compte du temps return; s->fTime -= t; ! if (s->fTime < 0) //l'objet est arrive en fin de vie { RemoveWorldObject(s); --- 83,91 ---- void SceneManager::_ProcessTimedObject (Mesh* s, float t) { ! if (s->fTime == -1) //l'objet ne tient pas compte du temps return; s->fTime -= t; ! if (s->fTime <= 0) //l'objet est arrive en fin de vie { RemoveWorldObject(s); *************** *** 96,104 **** void SceneManager::_ProcessTimedObject (ParticleEmitter* s, float t) { ! if (s->fTime < 0) //l'objet ne tient pas compte du temps return; s->fTime -= t; ! if (s->fTime < 0) //l'objet est arrive en fin de vie { RemoveParticlesEmitter(s); --- 96,104 ---- void SceneManager::_ProcessTimedObject (ParticleEmitter* s, float t) { ! if (s->fTime < -1) //l'objet ne tient pas compte du temps return; s->fTime -= t; ! if (s->fTime <= 0) //l'objet est arrive en fin de vie { RemoveParticlesEmitter(s); *************** *** 109,120 **** void SceneManager::Render () { - /* next variables are unused - Mesh* obj; - */ float frameInterval = pTimer->GetFrameInterval (); if (pPhysicEngine) pPhysicEngine->Move(frameInterval); ! if(pCamera) { --- 109,117 ---- void SceneManager::Render () { float frameInterval = pTimer->GetFrameInterval (); if (pPhysicEngine) pPhysicEngine->Move(frameInterval); ! if(pCamera) { *************** *** 128,132 **** pLevel->SetCamera(pCamera); pLevel->Render(); ! /*Vector3 Target = pCamera->GetForward(); --- 125,129 ---- pLevel->SetCamera(pCamera); pLevel->Render(); ! /*Vector3 Target = pCamera->GetForward(); *************** *** 256,259 **** --- 253,257 ---- Engine::pRenderer->Render (); #endif + } Index: defs.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/defs.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** defs.h 28 Sep 2004 09:44:26 -0000 1.3 --- defs.h 10 Oct 2004 20:49:09 -0000 1.4 *************** *** 11,14 **** --- 11,15 ---- #include <map> #include <sstream> + #include <iomanip> #ifdef TGWIN32 Index: physicengine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** physicengine.h 26 Sep 2004 13:15:03 -0000 1.1.1.1 --- physicengine.h 10 Oct 2004 20:49:09 -0000 1.2 *************** *** 29,33 **** void Move (float eTime); void StepSlideMove (SceneNode*, float, Vector3&,Vector3); ! Vector3 ClipVelocity (const Vector3& vel, const Vector3 norm); protected: --- 29,33 ---- void Move (float eTime); void StepSlideMove (SceneNode*, float, Vector3&,Vector3); ! void ClipVelocity (Vector3& vel, const Vector3 norm); protected: Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 1 Oct 2004 20:24:04 -0000 1.7 --- Makefile 10 Oct 2004 20:49:08 -0000 1.8 *************** *** 3,7 **** ## ! all: linux clean: --- 3,7 ---- ## ! all: linuxDebug clean: --- SoundManager.cc DELETED --- --- SoundManager.h DELETED --- Index: engine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/engine.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** engine.cc 30 Sep 2004 10:46:16 -0000 1.2 --- engine.cc 10 Oct 2004 20:49:09 -0000 1.3 *************** *** 263,268 **** if (pGuiManager != NULL || pConsole->GetState()) //on regarde si on a active la 2d pRenderer->End2D(); - - } --- 263,266 ---- Index: scenenode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scenenode.cc 30 Sep 2004 09:23:16 -0000 1.2 --- scenenode.cc 10 Oct 2004 20:49:09 -0000 1.3 *************** *** 20,23 **** --- 20,25 ---- fTime = -1.0f; bOnGround = false; + bIsCamera = false; + pPhysicCallBack = NULL; } *************** *** 39,42 **** --- 41,46 ---- fTime = -1.0f; bOnGround = false; + bIsCamera = false; + pPhysicCallBack = NULL; } *************** *** 47,50 **** --- 51,59 ---- } + void SceneNode::SetPhysicCallBack(PhysicCallBack* p) + { + pPhysicCallBack = p; + } + void SceneNode::CalculateBoundingVolume () { Index: camera.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/camera.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** camera.cc 26 Sep 2004 13:15:05 -0000 1.1.1.1 --- camera.cc 10 Oct 2004 20:49:09 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- bShift = false; + bIsCamera = true; } Index: scenenode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** scenenode.h 26 Sep 2004 13:15:15 -0000 1.1.1.1 --- scenenode.h 10 Oct 2004 20:49:09 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- #include "matrice3.h" #include "dlinkednode.h" + #include "physiccallback.h" namespace tg *************** *** 17,25 **** public: bool bNoClip; ! bool bOnGround; SceneNode (); SceneNode (Vector3 p); virtual ~SceneNode () {} virtual void PreRender (float ) = 0; --- 18,28 ---- public: bool bNoClip; ! bool bIsCamera; bool bOnGround; SceneNode (); SceneNode (Vector3 p); + void SetPhysicCallBack(PhysicCallBack*); + inline PhysicCallBack* GetPhysicCallBack() { return pPhysicCallBack; } virtual ~SceneNode () {} virtual void PreRender (float ) = 0; *************** *** 49,52 **** --- 52,58 ---- //protected: Vector3 vPosition; + protected: + PhysicCallBack* pPhysicCallBack; + }; Index: vector3.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/vector3.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vector3.h 26 Sep 2004 13:15:17 -0000 1.1.1.1 --- vector3.h 10 Oct 2004 20:49:09 -0000 1.2 *************** *** 42,47 **** inline float operator [] (int n) { switch (n) { case 0: return x; case 1: return y; case 2: return z;}} ! ! inline friend Vector3 operator+(const Vector3 &v1, const Vector3 &v2) { --- 42,56 ---- inline float operator [] (int n) { switch (n) { case 0: return x; case 1: return y; case 2: return z;}} ! ! inline bool operator != (const Vector3& v) { return (v.x==x&&v.y==y&&v.z==z); } ! ! inline bool equals (const Vector3& v) { ! if ( ((v.x-EPSILON<x) && (v.x+EPSILON>x)) && ! ((v.y-EPSILON<y) && (v.y+EPSILON>y)) && ! ((v.z-EPSILON<z) && (v.y+EPSILON>y))) ! return true; ! return false; ! } ! inline friend Vector3 operator+(const Vector3 &v1, const Vector3 &v2) { |
|
From: julien r. <jul...@us...> - 2004-10-04 14:51:21
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7585 Modified Files: game.cc Log Message: Portage Win32 Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** game.cc 2 Oct 2004 22:47:06 -0000 1.6 --- game.cc 4 Oct 2004 14:51:01 -0000 1.7 *************** *** 36,43 **** _CreatePlayers (); ! pSoundManager->AddWAV("bubbles",false,true); ! pSoundManager->AddOGG("Music",true,true); ! Vector3 soundtestpos = pWorld->GetPointLightPos(9); //pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); --- 36,43 ---- _CreatePlayers (); ! //pSoundManager->AddWAV("bubbles",false,true); ! //pSoundManager->AddOGG("Music",true,true); ! /*Vector3 soundtestpos = pWorld->GetPointLightPos(9); //pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); *************** *** 47,51 **** pSoundManager->PlaySound("bubbles"); ! pSoundManager->PlaySound("Music"); } --- 47,51 ---- pSoundManager->PlaySound("bubbles"); ! pSoundManager->PlaySound("Music");*/ } *************** *** 74,78 **** //création du joueur local //on ajoute _pas_ le pawn au scenemanager ! Camera* cam = new Camera (0.025f,15000, Vector3 (0, 100,0)); //TODO: on devrait plutot se base sur la bounding box du model cam->pBBox->vMin = Vector3(-10, -70, -10); --- 74,83 ---- //création du joueur local //on ajoute _pas_ le pawn au scenemanager ! #ifndef TGWIN32 ! #define CAM_SPEED 15000 ! #else ! #define CAM_SPEED 150000 ! #endif ! Camera* cam = new Camera (0.025f,CAM_SPEED, Vector3 (0, 100,0)); //TODO: on devrait plutot se base sur la bounding box du model cam->pBBox->vMin = Vector3(-10, -70, -10); |
|
From: Seb <whi...@us...> - 2004-10-02 22:48:27
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15083 Modified Files: Makefile.OSX game.cc game.h Log Message: SoundManager ajoute Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** game.cc 30 Sep 2004 10:31:42 -0000 1.5 --- game.cc 2 Oct 2004 22:47:06 -0000 1.6 *************** *** 8,11 **** --- 8,17 ---- pTimer = new Timer (); pEngine = new Engine (pTimer); + + if (pEngine->pEndian->bLittle == true) + pSoundManager = new SoundManager(true); + else + pSoundManager = new SoundManager(false); + Engine::pEngine = pEngine; pSceneManager = new SceneManager (pTimer); *************** *** 29,32 **** --- 35,51 ---- pWorld->Add(pSceneManager); _CreatePlayers (); + + pSoundManager->AddWAV("bubbles",false,true); + pSoundManager->AddOGG("Music",true,true); + + Vector3 soundtestpos = pWorld->GetPointLightPos(9); + + //pSoundManager->SetSoundProperties("fire",soundtestpos.x,soundtestpos.y,soundtestpos.z,0.0,0.0,0.0); + pSoundManager->SetSoundProperties("bubbles",0,70,0,0,0,0); + + pSoundManager->SetSoundVolume("Music",0.5); + + pSoundManager->PlaySound("bubbles"); + pSoundManager->PlaySound("Music"); } *************** *** 80,83 **** --- 99,112 ---- void Game::PreFrame () { + Camera* myCam = pSceneManager->GetCamera(); + + Vector3 position = myCam->GetPosition(); + + Vector3 forward = myCam->GetForward(); + Vector3 up = myCam->GetUp(); + + pSoundManager->SetListenerPosition(position.x,position.y,position.z); + pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z); + float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) Index: game.h =================================================================== RCS file: /cvsroot/epfl/tggame/game.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** game.h 26 Sep 2004 14:44:55 -0000 1.3 --- game.h 2 Oct 2004 22:47:06 -0000 1.4 *************** *** 14,17 **** --- 14,19 ---- #include "world.h" + #include "SoundManager.h" + using namespace tg; *************** *** 64,67 **** --- 66,72 ---- Timer* pTimer; SceneManager* pSceneManager; + + SoundManager* pSoundManager; + //le controller qui recevra les événements locaux (clavier + souris) Controller* pLocalController; Index: Makefile.OSX =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile.OSX,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.OSX 27 Sep 2004 22:13:27 -0000 1.3 --- Makefile.OSX 2 Oct 2004 22:47:06 -0000 1.4 *************** *** 3,7 **** INCLUDEPATH = -I/sw/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out ! LIBS = `sdl-config --libs` -ltgengine -ljpeg -lm -lSDL_image OBJ_EXT = o OBJSRC = $(wildcard *.cc) --- 3,7 ---- INCLUDEPATH = -I/sw/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out ! LIBS = `sdl-config --libs` -framework OpenAL -lSDL_image -ltgengine -ljpeg -lm OBJ_EXT = o OBJSRC = $(wildcard *.cc) |
|
From: Seb <whi...@us...> - 2004-10-02 22:47:00
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14821 Modified Files: Makefile.OSX Log Message: Makefile OSX prenant en compte le SoundManager Index: Makefile.OSX =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile.OSX,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.OSX 27 Sep 2004 22:10:57 -0000 1.4 --- Makefile.OSX 2 Oct 2004 22:45:46 -0000 1.5 *************** *** 13,17 **** all : $(OBJS) ! g++ -dynamiclib `sdl-config --libs` -lSDL_image -o out/libtgengine.dylib $(OBJS) clean : --- 13,17 ---- all : $(OBJS) ! g++ -dynamiclib `sdl-config --libs` -lSDL_image -lvorbis -lvorbisfile -framework OpenAL -o out/libtgengine.dylib $(OBJS) clean : |
|
From: Seb <whi...@us...> - 2004-10-02 22:45:56
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14665 Added Files: SoundManager.cc SoundManager.h Log Message: Sound Manager --- NEW FILE: SoundManager.cc --- // Sebastien "Whistle Master or Seb" Samyn: sebastien.samyn *at* epfl.ch #include <map> #include <vector> #include <string> #include <iostream> #ifdef TGOSX #include <OpenAL/al.h> #include <OpenAL/alut.h> #include <OpenAL/alc.h> #include <OpenAL/altypes.h> #else #include <AL/al.h> #include <AL/alut.h> #include <AL/alc.h> #include <AL/altypes.h> #endif #include <vorbis/vorbisfile.h> #include "SoundManager.h" #include "engine.h" using std::string; using std::map; using std::vector; using namespace std; // Constructor SoundManager::SoundManager() { #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; #endif init(); } // Constructor SoundManager::SoundManager(bool little) { if(little == true) { endian = 0; #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; cout << "OpenAL:: Little Endian detected..." << endl; #endif } else { endian = 1; #ifdef DEBUG cout << "OpenAL:: Starting SoundManager" << endl; cout << "OpenAL:: Big Endian detected..." << endl; #endif } init(); } // Destructor SoundManager::~SoundManager() { #ifdef DEBUG cout << "OpenAL:: Ending SoundManager" << endl; #endif KillALData(); alutExit(); } // Intialisation void SoundManager::init() { #ifdef DEBUG cout << "OpenAL:: Initializing SoundManager" << endl; #endif alutInit(NULL, 0); const ALubyte *alversion, *alrenderer, *alvendor, *alext; alversion = alGetString( AL_VERSION ); alrenderer = alGetString( AL_RENDERER ); alvendor = alGetString( AL_VENDOR ); alext = alGetString( AL_EXTENSIONS ); #ifdef DEBUG cout << "OpenAL:: Loading Lib: Vers = " << alversion << " | Renderer = " << alrenderer << " | Vendor = " << alvendor << endl; #endif } // Listener Position (player or camera) void SoundManager::SetListenerPosition(float x, float y, float z) { #ifdef DEBUG cout << "OpenAL:: SetListenerPosition (" << x << "," << y << "," << z << ")" << endl; #endif //set the position using 3 seperate floats alListener3f(AL_POSITION, x/100,y/100,z/100); } // Listener Orientation void SoundManager::SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz) { #ifdef DEBUG cout << "OpenAL:: SetListenerOrientation" << endl; #endif //set the orientation using an array of floats float vec[6]; vec[0] = fx; vec[1] = fy; vec[2] = fz; vec[3] = ux; vec[4] = uy; vec[5] = uz; alListenerfv(AL_ORIENTATION, vec); } // Creat a new buffer for a sound ALuint SoundManager::LoadWavALBuffer(char path[40]) { // Variables to store data which defines the buffer. ALenum format; ALsizei size; ALvoid* data; ALsizei freq; // Buffer id and error checking variable. ALuint buffer; ALenum result; #ifdef DEBUG cout << "OpenAL:: LoadWavALBuffer: " << path << endl; #endif // Generate a buffer. Check that it was created successfully. alGenBuffers(1, &buffer); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Read in the wav data from file. Check that it loaded correctly. #ifdef TGOSX alutLoadWAVFile(path, &format, &data, &size, &freq); #endif #ifdef TGWIN32 alutLoadWAVFile(path, &format, &data, &size, &freq, AL_FALSE); #endif #ifdef TGLINUX alutLoadWAVFile((ALbyte *) path, &format, &data, &size,&freq, AL_FALSE); #endif if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Send the wav data into the buffer. Check that it was received properly. alBufferData(buffer, format, data, size, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Get rid of the temporary data. alutUnloadWAV(format, data, size, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Return the buffer id. return buffer; } // Check if a buffer already exist. If no, creat a new one ALuint SoundManager::GetLoadedWavALBuffer(char path[40]) { int count = 0; // 'count' will be an index to the buffer list. ALuint buffer; // Buffer id for the loaded buffer. #ifdef DEBUG cout << "OpenAL:: GetLoadedWavALBuffer: " << path << endl; #endif // Iterate through each file path in the list. for(vector<string>::iterator iter = LoadedFiles.begin(); iter != LoadedFiles.end(); ++iter, count++) { // If this file path matches one we have loaded already, return the buffer id for it. if(*iter == path) return Buffers[count]; } // If we have made it this far then this file is new and we will create a buffer for it. buffer = LoadWavALBuffer(path); // Add this new buffer to the list, and register that this file has been loaded already. Buffers.push_back(buffer); LoadedFiles.push_back(path); return buffer; } // Creat a buffer and a source for a new sound ALuint SoundManager::LoadWavALSample(string name, bool loop) { ALuint source; ALuint buffer; ALenum result; // All new sound are in postion (0,0,0) ALfloat SourcePos[] = {0.0, 0.0, 0.0}; ALfloat SourceVel[]= {0.0, 0.0, 0.0}; char *path = (char*) name.c_str(); #ifdef DEBUG cout << "OpenAL:: LoadWavALSample: " << name << endl; #endif // Get the files buffer id (load it if necessary). buffer = GetLoadedWavALBuffer(path); // Generate a source. alGenSources(1, &source); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Setup the source properties. alSourcei (source, AL_BUFFER, buffer ); alSourcef (source, AL_PITCH, 1.0f ); alSourcef (source, AL_GAIN, 1.0f ); alSourcefv(source, AL_POSITION, SourcePos); alSourcefv(source, AL_VELOCITY, SourceVel); alSourcei (source, AL_LOOPING, loop ); // Save the source id. Sources.push_back(source); // Return the source id. return source; } // Add a Wav sound to the sounds list void SoundManager::AddWAV(string name, bool relative,bool looping) { try { #ifdef DEBUG cout << "OpenAL:: AddWAV: " << name << endl; #endif SoundList[name] = LoadWavALSample("data/sounds/"+name+".wav", looping); if(relative) alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); } catch(string err) { cout << "OpenAL error: " << err.c_str() << endl; } LoadedFiles.clear(); } // Sound properties (position and velocity) void SoundManager::SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz) { #ifdef DEBUG cout << "OpenAL:: SetSoundProperties: " << name << "(" << x << "," << y << "," << z << ")" << endl; #endif //set the sounds position and velocity alSource3f(SoundList[name],AL_POSITION,x/100,y/100,z/100); alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); } // Sound volume void SoundManager::SetSoundVolume(string name, float x) { #ifdef DEBUG cout << "OpenAL:: SetSoundVolume: " << name << "(" << x << ")" << endl; #endif //set the sounds volume alSourcef (SoundList[name], AL_GAIN,x); } // Play a sound void SoundManager::PlaySound(string name) { #ifdef DEBUG cout << "OpenAL:: PlaySound: " << name << endl; #endif alSourcePlay(SoundList[name]); } // Stop a sound void SoundManager::StopSound(string name) { #ifdef DEBUG cout << "OpenAL:: StopSound: " << name << endl; #endif alSourceStop(SoundList[name]); } // Get Status int SoundManager::SoundStatus(string name) { ALint state; #ifdef DEBUG cout << "OpenAL:: SoundStatus: " << name << endl; #endif alGetSourcei(SoundList[name], AL_SOURCE_STATE, &state); if (state == AL_PLAYING) return 1; else if (state == AL_PAUSED) return 0; else if (state == AL_STOPPED) return -1; return -2; } // Kill all buffers and sources void SoundManager::KillALData() { // Release all buffer data. for (vector<ALuint>::iterator iter = Buffers.begin(); iter != Buffers.end(); ++iter) alDeleteBuffers(1, (ALuint*)(*iter)); // Release all source data. for (vector<ALuint>::iterator iter = Sources.begin(); iter != Sources.end(); ++iter) alDeleteBuffers(1, (ALuint*)(*iter)); #ifdef DEBUG cout << "OpenAL:: KillALData" << endl; #endif // Destroy the lists. Buffers.clear(); Sources.clear(); SoundList.clear(); } // Creat a new buffer for a sound ALuint SoundManager::LoadOggALBuffer(char path[40]) { // Variables to store data which defines the buffer. ALenum format; ALsizei freq; vector<char> bufferData; // Buffer id and error checking variable. ALuint buffer; ALenum result; #ifdef DEBUG cout << "OpenAL:: LoadOggALBuffer: " << path << endl; #endif // Generate a buffer. Check that it was created successfully. alGenBuffers(1, &buffer); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Read in the wav data from file. Check that it loaded correctly. LoadOGG(path, bufferData, format, freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Send the wav data into the buffer. Check that it was received properly. alBufferData(buffer, format, &bufferData[0], static_cast<ALsizei>(bufferData.size()), freq); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Return the buffer id. return buffer; } // Check if a buffer already exist. If no, creat a new one ALuint SoundManager::GetLoadedOggALBuffer(char path[40]) { int count = 0; // 'count' will be an index to the buffer list. ALuint buffer; // Buffer id for the loaded buffer. #ifdef DEBUG cout << "OpenAL:: GetLoadedOggALBuffer: " << path << endl; #endif // Iterate through each file path in the list. for(vector<string>::iterator iter = LoadedFiles.begin(); iter != LoadedFiles.end(); ++iter, count++) { // If this file path matches one we have loaded already, return the buffer id for it. if(*iter == path) return Buffers[count]; } // If we have made it this far then this file is new and we will create a buffer for it. buffer = LoadOggALBuffer(path); // Add this new buffer to the list, and register that this file has been loaded already. Buffers.push_back(buffer); LoadedFiles.push_back(path); return buffer; } // Creat a buffer and a source for a new sound ALuint SoundManager::LoadOggALSample(string name, bool loop) { ALuint source; ALuint buffer; ALenum result; // All new sound are in postion (0,0,0) ALfloat SourcePos[] = {0.0, 0.0, 0.0}; ALfloat SourceVel[]= {0.0, 0.0, 0.0}; char *path = (char*) name.c_str(); #ifdef DEBUG cout << "OpenAL:: LoadOggALSample: " << name << endl; #endif // Get the files buffer id (load it if necessary). buffer = GetLoadedOggALBuffer(path); // Generate a source. alGenSources(1, &source); if ((result = alGetError()) != AL_NO_ERROR) throw GetALErrorString(result); // Setup the source properties. alSourcei (source, AL_BUFFER, buffer ); alSourcef (source, AL_PITCH, 1.0f ); alSourcef (source, AL_GAIN, 1.0f ); alSourcefv(source, AL_POSITION, SourcePos); alSourcefv(source, AL_VELOCITY, SourceVel); alSourcei (source, AL_LOOPING, loop ); // Save the source id. Sources.push_back(source); // Return the source id. return source; } // Add a Wav sound to the sounds list void SoundManager::AddOGG(string name, bool relative,bool looping) { try { #ifdef DEBUG cout << "OpenAL:: AddOGG: " << name << endl; #endif SoundList[name] = LoadOggALSample("data/sounds/"+name+".ogg", looping); if(relative) alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); } catch(string err) { cout << "OpenAL:: Error: " << err.c_str() << endl; } LoadedFiles.clear(); } // This function loads a .ogg file into a memory buffer and returns the format and frequency. void SoundManager::LoadOGG(char *fileName, vector<char> &buffer, ALenum &format, ALsizei &freq) { int bitStream; long bytes; char array[BUFFER_SIZE]; // Local fixed size array FILE *f; // Open for binary reading f = fopen(fileName, "rb"); if (f == NULL) { cerr << "OpenAL:: Cannot open " << fileName << " for reading..." << endl; exit(-1); } // end if vorbis_info *pInfo; OggVorbis_File oggFile; // Try opening the given file if (ov_open(f, &oggFile, NULL, 0) != 0) { cerr << "OpenAL:: Error opening " << fileName << " for decoding..." << endl; exit(-1); } // end if // Get some information about the OGG file pInfo = ov_info(&oggFile, -1); // Check the number of channels... always use 16-bit samples if (pInfo->channels == 1) format = AL_FORMAT_MONO16; else format = AL_FORMAT_STEREO16; // end if // The frequency of the sampling rate freq = pInfo->rate; // Keep reading until all is read do { // Read up to a buffer's worth of decoded sound data bytes = ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream); if (bytes < 0) { ov_clear(&oggFile); cerr << "OpenAL:: Error decoding " << fileName << "..." << endl; exit(-1); } // end if // Append to end of buffer buffer.insert(buffer.end(), array, array + bytes); } while (bytes > 0); // Clean up! ov_clear(&oggFile); } // Handling Errors string SoundManager::GetALErrorString(ALenum err) { switch(err) { case AL_NO_ERROR: return string("AL_NO_ERROR"); break; case AL_INVALID_NAME: return string("AL_INVALID_NAME"); break; case AL_INVALID_ENUM: return string("AL_INVALID_ENUM"); break; case AL_INVALID_VALUE: return string("AL_INVALID_VALUE"); break; case AL_INVALID_OPERATION: return string("AL_INVALID_OPERATION"); break; case AL_OUT_OF_MEMORY: return string("AL_OUT_OF_MEMORY"); break; }; return 0; } // Handling Errors string SoundManager::GetALCErrorString(ALenum err) { switch(err) { case ALC_NO_ERROR: return string("AL_NO_ERROR"); break; case ALC_INVALID_DEVICE: return string("ALC_INVALID_DEVICE"); break; case ALC_INVALID_CONTEXT: return string("ALC_INVALID_CONTEXT"); break; case ALC_INVALID_ENUM: return string("ALC_INVALID_ENUM"); break; case ALC_INVALID_VALUE: return string("ALC_INVALID_VALUE"); break; case ALC_OUT_OF_MEMORY: return string("ALC_OUT_OF_MEMORY"); break; }; return 0; } --- NEW FILE: SoundManager.h --- // Sebastien "Whistle Master or Seb" Samyn: sebastien.samyn *chez* epfl.ch #include <map> #include <vector> #include <string> #ifdef TGOSX #include <OpenAL/al.h> #include <OpenAL/alut.h> #include <OpenAL/alc.h> #include <OpenAL/altypes.h> #else #include <AL/al.h> #include <AL/alut.h> #include <AL/alc.h> #include <AL/altypes.h> #endif #include <vorbis/vorbisfile.h> #define BUFFER_SIZE 32768 // 32 KB buffers using std::string; using std::map; using std::vector; //SoundManager class SoundManager { public: ~SoundManager(); SoundManager(); SoundManager(bool little); void AddWAV(string name, bool relative,bool looping); void AddOGG(string name, bool relative,bool looping); void PlaySound(string name); void StopSound(string name); int SoundStatus(string name); void SetSoundVolume(string name, float x); void SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz); void SetListenerPosition(float x, float y, float z); void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz); void KillALData(); protected: int endian; // 0 for Little-Endian, 1 for Big-Endian void init(); string GetALErrorString(ALenum err); string GetALCErrorString(ALenum err); ALuint LoadWavALBuffer(char path[40]); ALuint GetLoadedWavALBuffer(char path[40]); ALuint LoadWavALSample(string name, bool loop); ALuint LoadOggALBuffer(char path[40]); ALuint GetLoadedOggALBuffer(char path[40]); ALuint LoadOggALSample(string name, bool loop); void LoadOGG(char *fileName, vector<char> &buffer, ALenum &format, ALsizei &freq); vector<string> LoadedFiles; // Holds loaded file paths temporarily. vector<ALuint> Buffers; // Holds all loaded buffers. vector<ALuint> Sources; // Holds all validated sources. map<string, ALuint> SoundList; // Hold all sounds. }; |
|
From: julien r. <jul...@us...> - 2004-10-01 21:32:57
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4586 Modified Files: world.cc world.h Log Message: pointlight dans World Index: world.h =================================================================== RCS file: /cvsroot/epfl/tggame/world.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** world.h 23 Sep 2004 22:57:23 -0000 1.1.1.1 --- world.h 1 Oct 2004 21:31:06 -0000 1.2 *************** *** 38,42 **** * @param SceneManager* un pointeur sur le scene manager en question */ ! void Add (SceneManager* s) { s->SetLevel(pMap); } protected: void _Load(char*); --- 38,53 ---- * @param SceneManager* un pointeur sur le scene manager en question */ ! void Add (SceneManager* s); ! ! /** ! * GetPointLightPos : retourne la position de la n-ième pointlight ! * @param i l'index de la pointlight ! */ ! Vector3& GetPointLightPos (int i); ! ! /** ! * GetNumPointLights : retourne le nombre de point lights ! */ ! int GetNumPointLights (); protected: void _Load(char*); Index: world.cc =================================================================== RCS file: /cvsroot/epfl/tggame/world.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** world.cc 26 Sep 2004 14:44:55 -0000 1.2 --- world.cc 1 Oct 2004 21:31:06 -0000 1.3 *************** *** 25,28 **** --- 25,49 ---- } + Vector3& World::GetPointLightPos (int i) + { + PointLight* p = pMap->GetPointLights(); + return p[i].vPosition; + } + + int World::GetNumPointLights () + { + return pMap->GetNumPointLights(); + } + + void World::Add (SceneManager* s) + { + s->SetLevel (pMap); + //ajout des pointlights + PointLight* p = pMap->GetPointLights(); + int numPL = pMap->GetNumPointLights(); + for (int i=0; i<numPL; i++) + s->AddPointLight(&p[i]); + } + Vector3 World::GetRandomStartPosition () { |
|
From: julien r. <jul...@us...> - 2004-10-01 21:32:11
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4460 Modified Files: scenemanager.cc Log Message: pointlight fixe Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scenemanager.cc 27 Sep 2004 17:45:05 -0000 1.3 --- scenemanager.cc 1 Oct 2004 21:30:28 -0000 1.4 *************** *** 17,20 **** --- 17,22 ---- pFirstEmitter = NULL; pCurrentEmitter = NULL; + pFirstPointLight = NULL; + pCurrentPointLight = NULL; Engine::pVarManager->AddVar("bump", 1); *************** *** 205,210 **** } ! //FIXME: Plantage OSX ! /*PointLight* pl = pFirstPointLight; int count = 0; if (pl!=NULL) --- 207,211 ---- } ! PointLight* pl = pFirstPointLight; int count = 0; if (pl!=NULL) *************** *** 225,229 **** Engine::pRenderer->RenderText(NULL, buffer, 10,100, 0.6); Engine::pRenderer->End2D(); ! #endif*/ /*EmittersList::iterator j = mEmitters.begin (); --- 226,230 ---- Engine::pRenderer->RenderText(NULL, buffer, 10,100, 0.6); Engine::pRenderer->End2D(); ! #endif /*EmittersList::iterator j = mEmitters.begin (); |
|
From: Seb <whi...@us...> - 2004-10-01 20:27:29
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24314 Modified Files: Makefile Log Message: Makefile mac en Makefile osx ;-) Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 27 Sep 2004 20:58:26 -0000 1.5 --- Makefile 1 Oct 2004 20:26:03 -0000 1.6 *************** *** 16,23 **** make -f Makefile.Linux "CFLAGS = -ggdb -DDEBUG -DTGLINUX -pg" ! mac: make -f Makefile.OSX ! macDebug: make -f Makefile.OSX "CFLAGS = -ggdb -DDEBUG -DTGOSX -pg" --- 16,23 ---- make -f Makefile.Linux "CFLAGS = -ggdb -DDEBUG -DTGLINUX -pg" ! osx: make -f Makefile.OSX ! osxDebug: make -f Makefile.OSX "CFLAGS = -ggdb -DDEBUG -DTGOSX -pg" |