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: julien r. <jul...@us...> - 2004-12-06 19:13:17
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29593 Modified Files: aicontroller.cc rocketlauncher.cc Log Message: plusieurs rockets :) Index: rocketlauncher.cc =================================================================== RCS file: /cvsroot/epfl/tggame/rocketlauncher.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** rocketlauncher.cc 5 Dec 2004 14:29:55 -0000 1.6 --- rocketlauncher.cc 6 Dec 2004 19:13:06 -0000 1.7 *************** *** 19,24 **** fCoolDown = fFireRate; ! ! Rocket* pRocket = new Rocket (this, vPosition, vTarget); Game::pSelf->AddPawn(pRocket, true, true); --- 19,25 ---- fCoolDown = fFireRate; ! ! //on ajoute qq chose à la position pour éviter que la rocket n'explose directement contre la BBox du joueur qui l'a lancée ! Rocket* pRocket = new Rocket (this, vPosition+vTarget.Normalize()*70, vTarget); Game::pSelf->AddPawn(pRocket, true, true); *************** *** 46,50 **** Game::pSelf->RemovePawn(p); delete p; - p = NULL; } --- 47,50 ---- Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** aicontroller.cc 3 Dec 2004 20:24:09 -0000 1.21 --- aicontroller.cc 6 Dec 2004 19:13:06 -0000 1.22 *************** *** 1,3 **** ! #define AI_DEBUG 3 #include "aicontroller.h" --- 1,3 ---- ! #define AI_DEBUG 0 #include "aicontroller.h" |
|
From: Luis C. <ce...@us...> - 2004-12-05 18:03:35
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32144 Modified Files: Makefile Added Files: Makefile.MSYS Log Message: Premiere partie de changements pour le portage sur win32 Compile, mais ne link pas encore entierement --- NEW FILE: Makefile.MSYS --- # TG Makefile INCLUDEPATH = -I/usr/local/include -I/usr/local/include/SDL -I./ -I../tgengine-0.1 LINKPATH = -L../tgengine-0.1/out -L/usr/local/lib LIBS = `sdl-config --libs` -ltgengine #-lopengl -lglu -ljpeg -lm -lSDL_image -lvorbis -lvorbisfile -lopenal OBJ_EXT = o OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) CC = g++ .cc.${OBJ_EXT}: $(CC) -c $(CFLAGS) -Wall $(INCLUDEPATH) $< -o $@ all: $(OBJS) ${CC} -o tg $(INCLUDEPATH) $(LINKPATH) $(LIBS) $(OBJS) clean: rm -f tg rm -f *.o rm -f *~ Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Makefile 17 Nov 2004 23:12:55 -0000 1.13 --- Makefile 5 Dec 2004 18:03:27 -0000 1.14 *************** *** 28,29 **** --- 28,38 ---- make -f Makefile.OSXVideo + msys: + make -f Makefile.MSYS "CFLAGS = -O3 -DTGWIN32" + + msysDebug: + make -f Makefile.MSYS "CFLAGS = -ggdb -DDEBUG -DTGWIN32" + + msysVideo: + make -f Makefile.MSYSVideo + |
|
From: Luis C. <ce...@us...> - 2004-12-05 18:01:30
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31638 Modified Files: Makefile defs.h tgglext.cc Added Files: Makefile.MSYS Log Message: Premiere partie de changements pour le portage sur win32 Index: defs.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/defs.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** defs.h 30 Nov 2004 18:21:55 -0000 1.8 --- defs.h 5 Dec 2004 18:01:17 -0000 1.9 *************** *** 15,25 **** #include "tg_stl/vector.h" - #ifdef TGWIN32 - #include <SDL/SDL.h> - #include <SDL/SDL_image.h> - #else #include <SDL.h> #include <SDL_image.h> - #endif namespace tg --- 15,20 ---- --- NEW FILE: Makefile.MSYS --- ## TG Engine Makefile ## OBJ_EXT = o OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) CFLAGS = -DTGLINUX -O3 -DDEBUG CC = g++ DLL_LDLIBS = -lopengl32 -lglu32 `sdl-config --libs` -lSDL_Image -L/usr/local/lib -lvorbisfile -lAlut -lopenal32 .cc.${OBJ_EXT}: $(CC) -c $(CFLAGS) -Wall -I /usr/local/include -I/usr/local/include/SDL -I./ $< -o $@ all : $(OBJS) # $(CC) -shared -o out/libtgengine.so $(OBJS) ${DLL_LDLIBS} ${CC} -shared -W1,--out-implib=out/libtgengine.so -o out/libtgengine.dll ${OBJS} -W1,--export-all-symbols ${DLL_LDLIBS} clean : rm -f out/* rm -f *.o rm -f *~ Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Makefile 17 Nov 2004 23:12:37 -0000 1.17 --- Makefile 5 Dec 2004 18:01:15 -0000 1.18 *************** *** 28,29 **** --- 28,38 ---- make -f Makefile.OSX "CFLAGS = -DTGOSX -DDEBUG -DTGVIDEO -I/sw/include/ffmpeg/" + msys: + make -f Makefile.MSYS "CFLAGS = -O3 -DTGWIN32" + + msysDebug: + make -f Makefile.MSYS "CFLAGS = -ggdb -DDEBUG -DTGWIN32" + + msysVideo: + make -f Makefile.MSYS "CFLAGS = -DDEBUG -DTGWIN32 -DTGVIDEO" + Index: tgglext.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/tgglext.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tgglext.cc 5 Dec 2004 14:29:55 -0000 1.6 --- tgglext.cc 5 Dec 2004 18:01:17 -0000 1.7 *************** *** 39,43 **** #ifdef TGWIN32 ! #define GETARBPOINTER(var,type,name) var = (type)wglGetProcAddress(name); #endif #ifdef TGLINUX --- 39,46 ---- #ifdef TGWIN32 ! #define GETARBPOINTER(var,type,name) \ ! var = (type)SDL_GL_GetProcAddress(name); \ ! if (!var) \ ! std::cerr << "Erreur lors du chargement de la fonction : " << name << std::endl; #endif #ifdef TGLINUX |
|
From: julien r. <jul...@us...> - 2004-12-05 14:30:12
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21643 Modified Files: boundingbox.cc boundingbox.h camera.h glrenderernv15.cc glrenderernv15.h md5instance.h md5mesh10.cc mesh.h particleemitter.h physicengine.cc physicengine.h physicnode.cc physicnode.h scenenode.cc scenenode.h soundnode.h tgglext.cc tgglext.h Log Message: cf wiki&phorum Index: soundnode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundnode.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soundnode.h 29 Nov 2004 17:29:50 -0000 1.2 --- soundnode.h 5 Dec 2004 14:29:55 -0000 1.3 *************** *** 23,27 **** void PreRender (float x); - private: Vector3 vSpeed; --- 23,26 ---- Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** physicengine.cc 30 Nov 2004 18:21:56 -0000 1.33 --- physicengine.cc 5 Dec 2004 14:29:55 -0000 1.34 *************** *** 16,20 **** } ! #define MAX_CLIP_PLANES 6 void PhysicEngine::StepSlideMove(PhysicNode* n, float eTime, Vector3& vVelocity, Vector3 origin) --- 16,20 ---- } ! #define MAX_CLIP_PLANES 7 void PhysicEngine::StepSlideMove(PhysicNode* n, float eTime, Vector3& vVelocity, Vector3 origin) *************** *** 22,26 **** CollisionResult trace; int bumpcount = 0; ! Plane pPlanes[5]; int iNumPlanes = 0; Vector3 primal_velocity = vVelocity; --- 22,26 ---- CollisionResult trace; int bumpcount = 0; ! Vector3 pPlanes[MAX_CLIP_PLANES]; int iNumPlanes = 0; Vector3 primal_velocity = vVelocity; *************** *** 35,45 **** { trace = Trace(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax, n); - if (trace.AllSolid) { vVelocity.y = 0; - //FIXME: ça ne semble plus poser problème et ça évite les objets traversant les murs //en fait, on devrait plutot tenter de renvoyer les objets en arriere jusqu'a ce que AllSolid devienne faux (en stockant la position précédente des objets et en y revenant par exemple - //vVelocity.Null(); return; } --- 35,42 ---- *************** *** 63,76 **** } ! pPlanes[iNumPlanes] = Plane(trace.Normal, trace.ColPlane.fD); iNumPlanes++; for (i=0; i<iNumPlanes; i++) { ! ClipVelocity (vVelocity, pPlanes[i].vNormal); for (j=0; j<iNumPlanes; j++) if (j != i) { ! if (vVelocity*pPlanes[j].vNormal < 0) break; } --- 60,74 ---- } ! //pPlanes[iNumPlanes] = Plane(trace.Normal, trace.ColPlane.fD); ! pPlanes[iNumPlanes] = trace.Normal; iNumPlanes++; for (i=0; i<iNumPlanes; i++) { ! ClipVelocity (vVelocity, pPlanes[i]); for (j=0; j<iNumPlanes; j++) if (j != i) { ! if (vVelocity*pPlanes[j] < 0) break; } *************** *** 89,93 **** break; } ! Vector3 dir = pPlanes[0].vNormal%pPlanes[1].vNormal; float d = dir*vVelocity; vVelocity = dir/d; --- 87,91 ---- break; } ! Vector3 dir = pPlanes[0]%pPlanes[1]; float d = dir*vVelocity; vVelocity = dir/d; *************** *** 171,182 **** //Classification de la position //BspCollisionResult col = pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, n->GetBBox()->vMin, n->GetBBox()->vMax); ! CollisionResult col = Trace(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, n->GetBBox()->vMin, n->GetBBox()->vMax, n); ! //si on met le allsolid, ca foire les mouvements sur les y ! if (col.Fraction < 1.0f || col.AllSolid) ! //n->SetOnGround(true); ! n->SetPhysicType(PHYS_WALKING); ! else ! //n->SetOnGround(false); ! n->SetPhysicType(PHYS_FALLING); } --- 169,181 ---- //Classification de la position //BspCollisionResult col = pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, n->GetBBox()->vMin, n->GetBBox()->vMax); ! if (n->GetPhysicType() == PHYS_WALKING || n->GetPhysicType() == PHYS_FALLING) ! { ! CollisionResult col = Trace(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, n->GetBBox()->vMin, n->GetBBox()->vMax, n); ! //si on met le allsolid, ca foire les mouvements sur les y ! if (col.Fraction < 1.0f || col.AllSolid) ! n->SetPhysicType(PHYS_WALKING); ! else ! n->SetPhysicType(PHYS_FALLING); ! } } *************** *** 212,216 **** Vector3 vVelocity = n->GetVelocity(); if (n->GetPhysicType() == PHYS_FALLING) ! vVelocity.y = -(*pGravity)*n->GetGravityFactor(); else if (vVelocity.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) vVelocity.y = 0; --- 211,215 ---- Vector3 vVelocity = n->GetVelocity(); if (n->GetPhysicType() == PHYS_FALLING) ! vVelocity.y = -(*pGravity); else if (vVelocity.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) vVelocity.y = 0; *************** *** 220,237 **** //mise a jour des volumes englobants n->CalculateBoundingVolume(); ! //on test les collisions avec le monde ! if (pLevel) { ! ! _TryToStep(n, eTime); ! ! Quaternion q = n->GetRotationVelocity()*eTime; ! q.Normalize(); ! n->SetRotation(n->GetRotation()*q); ! ! n->UpdatePosition(); ! } ! //appel de la callback pour les collisions avec la map. Ca permet aux objets style rockets de savoir s'ils doivent exploser CollisionResult trace = Trace(n->GetPosition(), n->GetPosition()+n->GetVelocity()*eTime, n->GetBBox()->vMin, n->GetBBox()->vMax, n); if ((trace.Fraction < 1.0f || trace.AllSolid) && n->GetPhysicCallBack() != NULL) --- 219,241 ---- //mise a jour des volumes englobants n->CalculateBoundingVolume(); ! switch (n->GetPhysicType ()) { ! case PHYS_WALKING: ! case PHYS_FALLING: ! case PHYS_PROJECTILE: ! //on test les collisions avec le monde ! if (pLevel) ! { ! _TryToStep(n, eTime); ! Quaternion q = n->GetRotationVelocity()*eTime; ! q.Normalize(); ! n->SetRotation(n->GetRotation()*q); ! n->UpdatePosition(); ! } ! break; ! default: ! break; } ! //appel de la callback pour les collisions avec la map. Ca permet aux objets style rockets de savoir s'ils doivent exploser CollisionResult trace = Trace(n->GetPosition(), n->GetPosition()+n->GetVelocity()*eTime, n->GetBBox()->vMin, n->GetBBox()->vMax, n); if ((trace.Fraction < 1.0f || trace.AllSolid) && n->GetPhysicCallBack() != NULL) *************** *** 254,269 **** result.Fraction = mapResult.Fraction; result.AllSolid = mapResult.AllSolid; ! result.ColPlane = mapResult.ColPlane; //on trace sur les objets ! /* Vector3 colPoint(0,0,0); ! Vector3 colNormal(0,0,0); float d1, d2; ! Vector3 tmp; for (unsigned int i=0; i<pNodes.size(); i++) { if (edict == pNodes[i]) //on ne considere pas le node qui a appele le trace continue; ! if (pNodes[i]->TraceRay(Begin, End, colPoint, colNormal)) { result.pNode = pNodes[i]; d1 = (colPoint - Begin).Magnitude(); --- 258,275 ---- result.Fraction = mapResult.Fraction; result.AllSolid = mapResult.AllSolid; ! //result.ColPlane = mapResult.ColPlane; //on trace sur les objets ! //Vector3 colPoint(0,0,0); ! //Vector3 colNormal(0,0,0); float d1, d2; ! //Vector3 tmp; for (unsigned int i=0; i<pNodes.size(); i++) { if (edict == pNodes[i]) //on ne considere pas le node qui a appele le trace continue; + pNodes[i]->Trace(result, Begin, End, vMin, vMax); ! ! /*if (pNodes[i]->TraceRay(Begin, End, colPoint, colNormal)) { result.pNode = pNodes[i]; d1 = (colPoint - Begin).Magnitude(); *************** *** 273,282 **** result.Normal = colNormal; result.pNode = pNodes[i]; ! //result.Fraction = (End-Begin).Magnitude()/(colPoint-Begin).Magnitude(); ! //result.AllSolid = false; } ! } } ! */ return result; } --- 279,293 ---- result.Normal = colNormal; result.pNode = pNodes[i]; ! //Vector3 vd1 = End-Begin; ! //Vector3 vd2 = colPoint-Begin; ! //vd1 = vd1.Normalize (); ! //vd2 = vd2.Normalize (); ! //result.Fraction = vd2.Magnitude()/vd1.Magnitude(); ! result.Fraction = (colPoint-Begin).Magnitude()/(End-Begin).Magnitude(); ! result.AllSolid = false; } ! }*/ } ! return result; } Index: tgglext.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/tgglext.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tgglext.cc 17 Nov 2004 23:12:39 -0000 1.5 --- tgglext.cc 5 Dec 2004 14:29:55 -0000 1.6 *************** *** 1,3 **** --- 1,5 ---- #include "tgglext.h" + #include <iostream> + namespace tg { *************** *** 32,35 **** --- 34,40 ---- PFNGLPROGRAMPARAMETER4FNVPROC _glProgramParameter4fNV; + PFNGLPOINTPARAMETERFARBPROC _glPointParameterfARB; + PFNGLPOINTPARAMETERFVARBPROC _glPointParameterfvARB; + #ifdef TGWIN32 *************** *** 37,44 **** #endif #ifdef TGLINUX ! #define GETARBPOINTER(var,type,name) var = (type)SDL_GL_GetProcAddress(name); #endif #ifdef TGOSX ! #define GETARBPOINTER(var,type,name) var = (type)SDL_GL_GetProcAddress(name); #endif --- 42,55 ---- #endif #ifdef TGLINUX ! #define GETARBPOINTER(var,type,name) \ ! var = (type)SDL_GL_GetProcAddress(name); \ ! if (!var) \ ! std::cerr << "Erreur lors du chargement de la fonction : " << name << std::endl; #endif #ifdef TGOSX ! #define GETARBPOINTER(var,type,name) \ ! var = (type)SDL_GL_GetProcAddress(name); \ ! if (!var) \ ! std::cerr << "Erreur lors du chargement de la fonction : " << name << std::endl; #endif *************** *** 71,74 **** --- 82,87 ---- GETARBPOINTER(_glProgramParameter4fNV, PFNGLPROGRAMPARAMETER4FNVPROC, "glProgramParameter4fNV"); + GETARBPOINTER(_glPointParameterfARB, PFNGLPOINTPARAMETERFARBPROC, "glPointParameterfARB"); + GETARBPOINTER(_glPointParameterfvARB, PFNGLPOINTPARAMETERFVARBPROC, "glPointParameterfvARB"); } } Index: physicnode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicnode.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** physicnode.cc 30 Nov 2004 18:21:56 -0000 1.12 --- physicnode.cc 5 Dec 2004 14:29:55 -0000 1.13 *************** *** 12,16 **** vPosition.Null(); vAccel.Null(); - fGravityFactor = 1.0f; iPhysicType = physType; --- 12,15 ---- *************** *** 40,51 **** } ! bool PhysicNode::TraceRay(Vector3 begin, Vector3 end, Vector3& colPoint, Vector3& colNormal) { ! /*if (pBBox->TraceRay(begin, end, colPoint, colNormal)) ! return vNodes[0]->Trace(begin, end, colPoint, colNormal); ! else ! return false;*/ ! return pBBox->TraceRay(begin, end, colPoint, colNormal); } } --- 39,49 ---- } ! ! void PhysicNode::Trace(CollisionResult& result, const Vector3& begin,const Vector3& end, const Vector3& vMin, const Vector3& vMax) { ! return pBBox->Trace(result, begin, end, vMin, vMax, this); } + + } Index: physicnode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicnode.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** physicnode.h 30 Nov 2004 18:21:56 -0000 1.10 --- physicnode.h 5 Dec 2004 14:29:55 -0000 1.11 *************** *** 33,43 **** inline BoundingBox* GetBBox () { return pBBox; } ! bool TraceRay(Vector3 begin, Vector3 end, Vector3& colPoint, Vector3& colNormal); SceneNode* GetSceneNode (int i = 0) { return vNodes[i]; } - inline float GetGravityFactor () { return fGravityFactor; } - inline void SetGravityFactor (float f) { fGravityFactor = f; } - /** * Retourne un pointeur sur la classe servant de callback en cas de collision --- 33,42 ---- inline BoundingBox* GetBBox () { return pBBox; } ! //bool TraceRay(Vector3 begin, Vector3 end, Vector3& colPoint, Vector3& colNormal); ! void Trace(CollisionResult& result, const Vector3& begin,const Vector3& end, const Vector3& vMin, const Vector3& vMax); ! SceneNode* GetSceneNode (int i = 0) { return vNodes[i]; } /** * Retourne un pointeur sur la classe servant de callback en cas de collision *************** *** 51,56 **** inline void SetPhysicCallBack (PhysicCallBack* p) { pPhysicCallBack = p; } - inline bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal) { return vNodes[0]->Trace(Begin, End, colPoint, colNormal); } - /* Position */ inline void SetPosition (Vector3 v) { vPosition = v; } --- 50,53 ---- *************** *** 123,128 **** bool bBlockTrace; int iPhysicType; - /* Comment cet objet est-il influencé par la gravité */ - float fGravityFactor; Vector3 vAccel; --- 120,123 ---- Index: particleemitter.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/particleemitter.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** particleemitter.h 19 Nov 2004 12:04:04 -0000 1.4 --- particleemitter.h 5 Dec 2004 14:29:55 -0000 1.5 *************** *** 54,58 **** void SetShape (EmitterShape* s) { pShape = s; } - Texture* GetTexture () { return pTex; } protected: --- 54,57 ---- Index: tgglext.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/tgglext.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tgglext.h 17 Nov 2004 23:12:39 -0000 1.5 --- tgglext.h 5 Dec 2004 14:29:55 -0000 1.6 *************** *** 43,46 **** --- 43,49 ---- typedef void (APIENTRY * PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + typedef void (APIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); + typedef void (APIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat* params); + extern PFNGLACTIVETEXTUREPROC _glActiveTextureARB; extern PFNGLMULTITEXCOORD3FARBPROC _glMultiTexCoord3fARB; *************** *** 72,75 **** --- 75,81 ---- extern PFNGLPROGRAMPARAMETER4FNVPROC _glProgramParameter4fNV; + extern PFNGLPOINTPARAMETERFARBPROC _glPointParameterfARB; + extern PFNGLPOINTPARAMETERFVARBPROC _glPointParameterfvARB; + #define GL_VERTEX_PROGRAM_NV 0x8620 #define GL_PROGRAM_ERROR_POSITION_NV 0x864B *************** *** 77,80 **** --- 83,96 ---- #define GL_MODELVIEW_PROJECTION_NV 0x8629 + + #define GL_POINT_SIZE_MIN_ARB 0x8126 + #define GL_POINT_SIZE_MAX_ARB 0x8127 + #define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 + #define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 + + #define GL_POINT_SPRITE_ARB 0x8861 + #define GL_COORD_REPLACE_ARB 0x8862 + + void InitARBFunctions (); Index: mesh.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/mesh.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mesh.h 19 Nov 2004 18:54:42 -0000 1.5 --- mesh.h 5 Dec 2004 14:29:55 -0000 1.6 *************** *** 71,74 **** --- 71,75 ---- virtual void DrawVisibleEdges () = 0; + /** * Permet d'attacher des scenode à des joints ou a des mesh Index: physicengine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** physicengine.h 30 Nov 2004 18:21:56 -0000 1.11 --- physicengine.h 5 Dec 2004 14:29:55 -0000 1.12 *************** *** 20,24 **** //le node qui a ete touche. NULL si c'est la carte qui est touche ou si rien n'est touche PhysicNode* pNode; ! Plane ColPlane; }; --- 20,24 ---- //le node qui a ete touche. NULL si c'est la carte qui est touche ou si rien n'est touche PhysicNode* pNode; ! // Plane ColPlane; }; Index: camera.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/camera.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** camera.h 19 Nov 2004 12:04:04 -0000 1.6 --- camera.h 5 Dec 2004 14:29:55 -0000 1.7 *************** *** 49,53 **** inline Frustum* GetFrustum() { return &frustum; } ! protected: --- 49,53 ---- inline Frustum* GetFrustum() { return &frustum; } ! bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal) {return false;} protected: Index: glrenderernv15.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderernv15.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** glrenderernv15.h 17 Nov 2004 23:12:38 -0000 1.3 --- glrenderernv15.h 5 Dec 2004 14:29:55 -0000 1.4 *************** *** 12,15 **** --- 12,16 ---- void EndBump (); void Initialize (); + //void RenderParticles (ParticleEmitter* p); protected: void RenderBumpMappedMesh (Mesh*, const Vector3&); Index: md5instance.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5instance.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** md5instance.h 19 Nov 2004 18:54:42 -0000 1.11 --- md5instance.h 5 Dec 2004 14:29:55 -0000 1.12 *************** *** 44,50 **** - /*bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal); - bool TriangleTrace(Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal);*/ - void Attach (const std::string& jointName, SceneNode* s); void Detach (const std::string& jointName, SceneNode* s); --- 44,47 ---- Index: scenenode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** scenenode.cc 17 Nov 2004 23:12:39 -0000 1.9 --- scenenode.cc 5 Dec 2004 14:29:55 -0000 1.10 *************** *** 48,58 **** { //pBBox->Move(vPosition); - }*/ - - bool SceneNode::Trace (Vector3 Begin,Vector3 End, Vector3& colPoint, Vector3& colNormal) - { - return pBBox->TraceSphereRay(Begin, End, colPoint); } } //END tg --- 48,54 ---- { //pBBox->Move(vPosition); } + */ } //END tg Index: boundingbox.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/boundingbox.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** boundingbox.h 17 Nov 2004 23:12:37 -0000 1.6 --- boundingbox.h 5 Dec 2004 14:29:55 -0000 1.7 *************** *** 9,12 **** --- 9,15 ---- { + struct CollisionResult; + class PhysicNode; + struct BoundingBox { *************** *** 45,49 **** * Trace un rayon à travers la BBox */ ! bool TraceRay (Vector3 begin, Vector3 end, Vector3& colPoint, Vector3& colNormal); --- 48,55 ---- * Trace un rayon à travers la BBox */ ! //bool TraceRay (Vector3 begin, Vector3 end, Vector3& colPoint, Vector3& colNormal); ! void Trace (CollisionResult& result, const Vector3& begin,const Vector3& end, const Vector3& vMin, const Vector3& vMax, PhysicNode* who); ! ! Index: boundingbox.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/boundingbox.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** boundingbox.cc 17 Nov 2004 23:12:37 -0000 1.9 --- boundingbox.cc 5 Dec 2004 14:29:55 -0000 1.10 *************** *** 1,3 **** --- 1,5 ---- #include "boundingbox.h" + #include "physicengine.h" + #include "physicnode.h" namespace tg *************** *** 136,140 **** --- 138,292 ---- return true; } + void BoundingBox::Trace(CollisionResult& result, const Vector3& begin,const Vector3& end, const Vector3& vMin, const Vector3& vMax, PhysicNode* who) + { + float startFraction = -1.0f; + float endFraction = 1.0f; + float startDistance, endDistance; + bool bStartsOut = false; + bool bEndsOut = false; + /*float fraction = 1.0f; + + bool bAllSolid = false;*/ + + int colPlane=-1; + for (int j=0;j<6;j++) { + if (vMin == Vector3::ZERO && vMax == Vector3::ZERO) { //on trace avec un rayon en fait + startDistance = pPlanes[j].GetDistance(begin); + endDistance = pPlanes[j].GetDistance(end); + } + else { + Vector3 offset; + offset.x = pPlanes[j].vNormal.x < 0 ? vMax.x : vMin.x; + offset.y = pPlanes[j].vNormal.y < 0 ? vMax.y : vMin.y; + offset.z = pPlanes[j].vNormal.z < 0 ? vMax.z : vMin.z; + startDistance = pPlanes[j].GetDistance(begin+offset); + endDistance = pPlanes[j].GetDistance(end+offset); + } + + if (startDistance > 0 ) bStartsOut = true; + if (endDistance > 0 ) bEndsOut = true; + + if (startDistance > 0 && endDistance>=startDistance) //les deux sont devant le plan, donc dehors + return; + else if (startDistance <= 0 && endDistance <= 0) //les deux sont dedans, seront coupé par un autre plan + continue; + + if (startDistance>endDistance) { + float fraction = (startDistance - EPSILON)/(startDistance - endDistance); + if ( fraction > startFraction) { + startFraction = fraction; + colPlane = j; + } + } + else { + float fraction = (startDistance + EPSILON)/(startDistance - endDistance); + if ( fraction < endFraction) { + endFraction = fraction; + //colPlane = j; + } + } + + } + + + // After checking all sides if startOut remain false, then the Start Point is complete in the brush + if (bStartsOut == false) + { + //result.StartOut = false; + // if also the EndPoint is in this brush, then the ray is complete in this brush + if (bEndsOut == false) + result.AllSolid = true; + } + + // if there was collision against the brush (S < E) + if (startFraction < endFraction) + { + if (startFraction > -1 && startFraction < result.Fraction) + { + // UpDate OutPut values + if (startFraction < 0) startFraction = 0; + result.Fraction = startFraction; + if (colPlane != -1) + result.Normal = pPlanes[colPlane].vNormal; + result.EndPoint = begin + (end-begin)*result.Fraction; + } + } + } + #if 0 + bool BoundingBox::TraceRay (Vector3 begin, Vector3 end, Vector3& colPoint, Vector3& colNormal) + { + float startFraction = -1.0f; + float endFraction = 1.0f; + float startDistance, endDistance; + bool bStartsOut = false; + bool bEndsOut = false; + float fraction = 1.0f; + + bool bAllSolid = false; + + int colPlane=-1; + for (int j=0;j<6;j++) { + startDistance = pPlanes[j].GetDistance(begin); + endDistance = pPlanes[j].GetDistance(end); + + if (startDistance > 0 ) bStartsOut = true; + if (endDistance > 0 ) bEndsOut = true; + + if (startDistance > 0 && endDistance>=startDistance) //les deux sont devant le plan, donc dehors + return false; + else if (startDistance <= 0 && endDistance <= 0) //les deux sont dedans, seront coupé par un autre plan + continue; + + if (startDistance>endDistance) { + fraction = (startDistance - EPSILON)/(startDistance - endDistance); + if ( fraction > startFraction) { + startFraction = fraction; + colPlane = j; + } + } + else { + fraction = (startDistance + EPSILON)/(startDistance - endDistance); + if ( fraction < endFraction) { + endFraction = fraction; + //colPlane = j; + } + } + + } + + + // After checking all sides if startOut remain false, then the Start Point is complete in the brush + if (bStartsOut == false) + { + //result.StartOut = false; + + // if also the EndPoint is in this brush, then the ray is complete in this brush + if (bEndsOut == false) + //result.AllSolid = true; + bAllSolid = true; + return (fraction < 1.0f); + } + + // if there was collision against the brush (S < E) + if (startFraction < endFraction) + { + if (startFraction > -1 /*&& startFraction < result.Fraction*/) + { + // UpDate OutPut values + + if (startFraction < 0) startFraction = 0; + fraction = startFraction; + if (colPlane != -1) + colNormal = pPlanes[colPlane].vNormal; + else + colNormal.Null(); + colPoint = (end-begin)*fraction; + } + } + + } + #endif + #if 0 bool Clip (float fDenom, float fNumer, float& rfT0, float& rfT1) *************** *** 186,190 **** { //return TraceSphereRay(begin, end, colPoint); ! /*int iB, iE; Vector3 cP; for (int i=0; i<6; i++) --- 338,342 ---- { //return TraceSphereRay(begin, end, colPoint); ! int iB, iE; Vector3 cP; for (int i=0; i<6; i++) *************** *** 200,205 **** colPoint = cP; } ! return true;*/ ! Vector3 kOrigin = begin - vWorldOrigin; Vector3 kDirection = end - begin; --- 352,357 ---- colPoint = cP; } ! return true; ! /*Vector3 kOrigin = begin - vWorldOrigin; Vector3 kDirection = end - begin; *************** *** 265,271 **** colPoint = akPoint[0]; colPoint += vWorldOrigin; //std::cout << colPoint << std::endl; ! return bIntersects; } ! } //END tg --- 417,428 ---- colPoint = akPoint[0]; colPoint += vWorldOrigin; + //FIXME: ugly hack pour trouver la normale de collision + for (int i=0; i<6; i++) + if (pPlanes[i].ClassifyPoint(colPoint) == POINT_ON_PLANE) + colNormal = pPlanes[i].vNormal; + //std::cout << colPoint << std::endl; ! return bIntersects;*/ } ! #endif } //END tg Index: md5mesh10.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5mesh10.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** md5mesh10.cc 22 Nov 2004 21:19:07 -0000 1.10 --- md5mesh10.cc 5 Dec 2004 14:29:55 -0000 1.11 *************** *** 1,4 **** --- 1,5 ---- #include "md5mesh10.h" #include "quaternion.h" + #include "engine.h" namespace tg *************** *** 120,128 **** pMeshes[i].pMaterial = new Material (); ! Texture* tmpTex = new Texture (); ! tmpTex->LoadBMP((char*)pMeshes[i].sNormal.data(), TG_TEXTURE_2D); pMeshes[i].pMaterial->SetNormalTexture(tmpTex); ! tmpTex = new Texture(); ! tmpTex->LoadBMP((char*)pMeshes[i].sColor.data(), TG_TEXTURE_2D); pMeshes[i].pMaterial->SetFirstTexture(tmpTex); --- 121,131 ---- pMeshes[i].pMaterial = new Material (); ! //Texture* tmpTex = new Texture (); ! //tmpTex->LoadBMP((char*)pMeshes[i].sNormal.data(), TG_TEXTURE_2D); ! Texture* tmpTex = Engine::pEngine->pTextureManager->LoadTexture((char*)pMeshes[i].sNormal.data(), TG_TEXTURE_2D); pMeshes[i].pMaterial->SetNormalTexture(tmpTex); ! //tmpTex = new Texture(); ! //tmpTex->LoadBMP((char*)pMeshes[i].sColor.data(), TG_TEXTURE_2D); ! tmpTex = Engine::pEngine->pTextureManager->LoadTexture((char*)pMeshes[i].sColor.data(), TG_TEXTURE_2D); pMeshes[i].pMaterial->SetFirstTexture(tmpTex); Index: scenenode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** scenenode.h 19 Nov 2004 12:04:04 -0000 1.10 --- scenenode.h 5 Dec 2004 14:29:55 -0000 1.11 *************** *** 61,68 **** // - virtual bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal); - - //BoundingBox* pBBox; - int iLeaf; //utilise par les noeuds a duree limite (SceneManager::AddTimed). Inferieur a 0 si noeud non-limite dans le temps --- 61,64 ---- Index: glrenderernv15.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderernv15.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** glrenderernv15.cc 17 Nov 2004 23:12:38 -0000 1.9 --- glrenderernv15.cc 5 Dec 2004 14:29:55 -0000 1.10 *************** *** 34,38 **** --- 34,81 ---- } + #if 0 + void GLRendererNV15::RenderParticles (ParticleEmitter* p) + { + //TODO: Le rendu des particules en fil de fer texture donne qq chose de vraiment pas mal ! + + static float** pQuads; + static float size; + size = p->GetSize (); + pQuads = p->GetQuads (); + + float quadratic[] = { 0.0f, 0.0f, 0.01f }; + (*_glPointParameterfvARB)( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic ); + float maxSize = 0.0f; + glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maxSize ); + glPointSize( 200.0f ); + (*_glPointParameterfARB)( GL_POINT_SIZE_MAX_ARB, maxSize ); + (*_glPointParameterfARB)( GL_POINT_SIZE_MIN_ARB, 1.0f ); + + glDepthMask(GL_FALSE); + glDisable(GL_CULL_FACE); + glEnable(GL_BLEND); + glBlendFunc( GL_SRC_ALPHA, GL_ONE ); + + //BindMaterial (p->GetMaterial()); + (*_glActiveTextureARB)(GL_TEXTURE0); + glEnable (GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, p->GetTexture()->iId); + glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE ); + glEnable( GL_POINT_SPRITE_ARB ); + glBegin (GL_POINTS); + for (int i=0; i<p->GetParticlesCount();i++) + { + glColor4f (pQuads[i][3], pQuads[i][4], pQuads[i][5], pQuads[i][6]); + glVertex3f(pQuads[i][0], pQuads[i][1], pQuads[i][2]); + } + glEnd (); + glDisable( GL_POINT_SPRITE_ARB ); + glDepthMask (GL_TRUE); + glEnable(GL_CULL_FACE); + glDisable(GL_BLEND); + + } + #endif /** * Important ! Il faut que la depth func soit en GL_LEQUAL et pas en GL_LESS, car sinon, lors de la deuxieme pass, le modele "coloré" ne sera pas dessiné, les valeurs étants égales mais pas supérieur !!!!!! |
|
From: julien r. <jul...@us...> - 2004-12-05 14:30:08
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21677 Modified Files: game.cc playercontroller.cc rocket.cc rocketlauncher.cc rocketlauncher.h Log Message: cf wiki&phorum Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** game.cc 2 Dec 2004 00:18:54 -0000 1.42 --- game.cc 5 Dec 2004 14:29:55 -0000 1.43 *************** *** 86,91 **** void Game::_CreatePlayers () { ! pEngine->pMeshManager->Load("guardian", "data/models/guardian/guardian.md5mesh"); ! pEngine->pMeshManager->LoadAnim("guardian", "data/models/guardian/death.md5anim"); pEngine->pMeshManager->Load("machinegun", "data/models/machinegun/viewmachinegun.md5mesh"); pEngine->pMeshManager->LoadAnim("machinegun", "data/models/machinegun/idle.md5anim"); --- 86,91 ---- void Game::_CreatePlayers () { ! pEngine->pMeshManager->Load("guardian", "data/models/buggy/buggy.md5mesh"); ! pEngine->pMeshManager->LoadAnim("guardian", "data/models/buggy/buggy.md5anim"); pEngine->pMeshManager->Load("machinegun", "data/models/machinegun/viewmachinegun.md5mesh"); pEngine->pMeshManager->LoadAnim("machinegun", "data/models/machinegun/idle.md5anim"); *************** *** 137,141 **** p->SetVelocity(Vector3(0,0,0)); //p->SetRotation(Quaternion(-90, Vector3::UNIT_X)); - p->SetPosition(pWorld->GetStartPosition(0)); p->SetPosition (Vector3(-80,80,100)); p->SetBB(Vector3(-15, 0, -15), Vector3(15, 80, 15)); --- 137,140 ---- *************** *** 143,146 **** --- 142,151 ---- //} + p = new Pawn("guardian"); + p->SetAnimation("death"); + this->AddPawn(p); + p->SetPosition(pWorld->GetStartPosition(0)); + p->SetBB(Vector3(-50, 0, -50), Vector3(50, 200, 50)); + //p->SetRotationVelocity(Quaternion(10,Vector3(0,1,1))); //p->SetRotation(Quaternion(90,Vector3(0,1,0))); Index: rocketlauncher.cc =================================================================== RCS file: /cvsroot/epfl/tggame/rocketlauncher.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** rocketlauncher.cc 30 Nov 2004 18:22:01 -0000 1.5 --- rocketlauncher.cc 5 Dec 2004 14:29:55 -0000 1.6 *************** *** 6,10 **** fFireRate = 0.1f; fCoolDown = fFireRate; - pLast = NULL; } --- 6,9 ---- *************** *** 20,31 **** fCoolDown = fFireRate; - Vector3 target = vPosition - vTarget*10000; ! Rocket* pRocket = new Rocket (this, vPosition, target); ! //FIXME: Ca plante si on l'ajoute au physicengine Game::pSelf->AddPawn(pRocket, true, true); - pLast = pRocket; - SoundManager::pSoundManager->PlaySound("fire"); --- 19,26 ---- fCoolDown = fFireRate; ! Rocket* pRocket = new Rocket (this, vPosition, vTarget); Game::pSelf->AddPawn(pRocket, true, true); SoundManager::pSoundManager->PlaySound("fire"); *************** *** 34,42 **** void RocketLauncher::AltFire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p) { - if (pLast == NULL) - return; - Game::pSelf->RemovePawn(pLast); - delete pLast; - pLast = NULL; } --- 29,32 ---- Index: rocketlauncher.h =================================================================== RCS file: /cvsroot/epfl/tggame/rocketlauncher.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rocketlauncher.h 30 Nov 2004 18:22:01 -0000 1.3 --- rocketlauncher.h 5 Dec 2004 14:29:55 -0000 1.4 *************** *** 17,21 **** protected: - Rocket* pLast; }; --- 17,20 ---- Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** playercontroller.cc 2 Dec 2004 00:18:54 -0000 1.24 --- playercontroller.cc 5 Dec 2004 14:29:55 -0000 1.25 *************** *** 28,48 **** pWeapon->Think(eTime); //Test des tirs ! Vector3 vTarget; ! Vector3 vPosition; if (bFire) { ! vTarget = pPawn->GetRotation().GetZAxis(); ! vPosition = pPawn->GetPosition()+vViewOffset-vTarget*50; pWeapon->Fire (vPosition, vTarget, pPawn); } if (bAltFire) { - vTarget = pPawn->GetRotation().GetZAxis(); - vPosition = pPawn->GetPosition()+vViewOffset-vTarget*50; pWeapon->AltFire (vPosition, vTarget, pPawn); } - vPosition = pPawn->GetPosition()+vViewOffset; - vTarget = vPosition - pPawn->GetRotation().GetZAxis()*1000000; CollisionResult cR = Game::pSelf->Trace(vPosition, vTarget, pPawn); --- 28,44 ---- pWeapon->Think(eTime); //Test des tirs ! Vector3 vPosition = pPawn->GetPosition()+vViewOffset; ! ! Vector3 vTarget = vPosition - pPawn->GetRotation().GetZAxis()*1000000; if (bFire) { ! pWeapon->Fire (vPosition, vTarget, pPawn); } if (bAltFire) { pWeapon->AltFire (vPosition, vTarget, pPawn); } CollisionResult cR = Game::pSelf->Trace(vPosition, vTarget, pPawn); Index: rocket.cc =================================================================== RCS file: /cvsroot/epfl/tggame/rocket.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** rocket.cc 2 Dec 2004 00:18:54 -0000 1.8 --- rocket.cc 5 Dec 2004 14:29:55 -0000 1.9 *************** *** 9,14 **** Rocket::Rocket (Weapon* handler, const Vector3& vPosition, const Vector3& vTarget) : Projectile (handler, "rocket") { - pPhysic->SetGravityFactor(0.0f); pPhysic->SetPosition(vPosition); Vector3 vVeloc = (vTarget-vPosition).Normalize(); vVeloc *= fSpeed; --- 9,15 ---- Rocket::Rocket (Weapon* handler, const Vector3& vPosition, const Vector3& vTarget) : Projectile (handler, "rocket") { pPhysic->SetPosition(vPosition); + pPhysic->SetPhysicType(PHYS_PROJECTILE); + Vector3 vVeloc = (vTarget-vPosition).Normalize(); vVeloc *= fSpeed; |
|
From: Seb <whi...@us...> - 2004-12-04 14:01:29
|
Update of /cvsroot/epfl/tgengine-0.1/tg_stl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22036 Modified Files: vector.h Log Message: Remplacement de tous les _T par des T pour OS X :-\ Index: vector.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/tg_stl/vector.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vector.h 30 Nov 2004 18:21:56 -0000 1.1 --- vector.h 4 Dec 2004 14:01:19 -0000 1.2 *************** *** 13,17 **** #define RESERVE_RATIO 10 ! template <class _T> class Vector { --- 13,17 ---- #define RESERVE_RATIO 10 ! template <class T> class Vector { *************** *** 19,31 **** inline Vector(int s=0); ! inline void push_back(_T); inline void resize (int s); inline void clear (); inline int size (); ! inline _T operator [] (int n) { return *(data+n); } ! inline _T at(int i); protected: ! _T* data; //represent le dernier element "interresant" stocke. donc le dernier element ajoute //par un push_back. Les elements ajoutes automatiquement par le resize ne sont justement --- 19,31 ---- inline Vector(int s=0); ! inline void push_back(T); inline void resize (int s); inline void clear (); inline int size (); ! inline T operator [] (int n) { return *(data+n); } ! inline T at(int i); protected: ! T* data; //represent le dernier element "interresant" stocke. donc le dernier element ajoute //par un push_back. Les elements ajoutes automatiquement par le resize ne sont justement *************** *** 35,40 **** }; ! template <class _T> ! Vector<_T>::Vector(int s) { data = NULL; --- 35,40 ---- }; ! template <class T> ! Vector<T>::Vector(int s) { data = NULL; *************** *** 43,52 **** } ! template <class _T> ! void Vector<_T>::resize (int s) { if(s>_size) { ! data = (_T*)realloc(data, sizeof(_T)*(_size+s)); } else if (s<_size) --- 43,52 ---- } ! template <class T> ! void Vector<T>::resize (int s) { if(s>_size) { ! data = (T*)realloc(data, sizeof(T)*(_size+s)); } else if (s<_size) *************** *** 64,69 **** } ! template <class _T> ! void Vector<_T>::push_back (_T obj) { //doit-on allouer de la memoire ? --- 64,69 ---- } ! template <class T> ! void Vector<T>::push_back (T obj) { //doit-on allouer de la memoire ? *************** *** 77,88 **** } ! template <class _T> ! int Vector<_T>::size() { return _size; } ! template <class _T> ! _T Vector<_T>::at(int i) { if(i>=_size) --- 77,88 ---- } ! template <class T> ! int Vector<T>::size() { return _size; } ! template <class T> ! T Vector<T>::at(int i) { if(i>=_size) *************** *** 94,99 **** } ! template <class _T> ! void Vector<_T>::clear() { resize (0); --- 94,99 ---- } ! template <class T> ! void Vector<T>::clear() { resize (0); |
|
From: Yohann C. <pl...@us...> - 2004-12-03 20:24:18
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16432 Modified Files: aicontroller.cc Log Message: un peu mieux.... Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** aicontroller.cc 3 Dec 2004 19:49:55 -0000 1.20 --- aicontroller.cc 3 Dec 2004 20:24:09 -0000 1.21 *************** *** 1,3 **** ! #define AI_DEBUG 0 #include "aicontroller.h" --- 1,3 ---- ! #define AI_DEBUG 3 #include "aicontroller.h" *************** *** 105,117 **** pSphere2->vPosition = c.EndPoint; ! // cherche (mais ne marche pas) a savoir si le lancer de rayon a touché un objet (map ou joueur) if(c.Fraction < 1) { // dans ce cas, on ralentit... ! if (fMoveSpeed>10) { ! pPawn->SetMoveSpeed(fMoveSpeed-0.5); } ! // puis on tourne... (a revoir... a priori SetVelocity n'est pas ce que je cherche...) pPawn->SetRotation(Quaternion(rot+=5, Vector3::UNIT_Y)); - // pPawn->SetVelocity(vVelocity + 4*c.Normal); #if AI_DEBUG >= 4 cout << "Changement de direction... "<< c.Fraction << std::endl; --- 105,116 ---- pSphere2->vPosition = c.EndPoint; ! // si le lancer de rayon a touché un objet (map ou joueur) if(c.Fraction < 1) { // dans ce cas, on ralentit... ! if (fMoveSpeed>20) { ! pPawn->SetMoveSpeed(fMoveSpeed-10); } ! // puis on tourne... (a revoir... en fonction de l'angle de c.Normal et le vecteur vitesse) pPawn->SetRotation(Quaternion(rot+=5, Vector3::UNIT_Y)); #if AI_DEBUG >= 4 cout << "Changement de direction... "<< c.Fraction << std::endl; *************** *** 120,128 **** // sinon, on va augmenter la vitesse (pas de vitesse limite dans le moteur pour le moment // a priori, donc je limite moi-meme.... ! if(fMoveSpeed < 449.5) { #if AI_DEBUG >= 4 cout << "augmentation de la vitesse" << std::endl; #endif ! pPawn->SetMoveSpeed(fMoveSpeed+0.5); } } --- 119,127 ---- // sinon, on va augmenter la vitesse (pas de vitesse limite dans le moteur pour le moment // a priori, donc je limite moi-meme.... ! if(fMoveSpeed < 448) { #if AI_DEBUG >= 4 cout << "augmentation de la vitesse" << std::endl; #endif ! pPawn->SetMoveSpeed(fMoveSpeed+2); } } |
|
From: Yohann C. <pl...@us...> - 2004-12-03 19:50:05
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8127 Modified Files: aicontroller.cc aicontroller.h Log Message: Voilà, le bot évite les murs... pas top encore, mais disons qu'il tourne avant de se le prendre en pleine poire (sauf pour les petis objets: poubelles, escaliers.....) Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** aicontroller.cc 2 Dec 2004 22:02:37 -0000 1.19 --- aicontroller.cc 3 Dec 2004 19:49:55 -0000 1.20 *************** *** 23,27 **** { pSphere = new DebugSphere (); ! Game::pSelf->GetSceneManager()->AddDebugSphere(pSphere); } --- 23,30 ---- { pSphere = new DebugSphere (); ! // Game::pSelf->GetSceneManager()->AddDebugSphere(pSphere); ! ! pSphere2 = new DebugSphere (); ! Game::pSelf->GetSceneManager()->AddDebugSphere(pSphere2); } *************** *** 31,35 **** { Vector3 vTarget = pPawn->GetRotation().GetXAxis(); ! Vector3 vPosition = pPawn->GetPosition()+vViewOffset; vTarget = vPosition + vTarget*1000; --- 34,38 ---- { Vector3 vTarget = pPawn->GetRotation().GetXAxis(); ! Vector3 vPosition = pPawn->GetPosition()+vViewOffset/2; vTarget = vPosition + vTarget*1000; *************** *** 63,67 **** //iLife -= 5; pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); ! #if AI_DEBUG >=4 cout << "OUCH" << std::endl; #endif --- 66,70 ---- //iLife -= 5; pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); ! #if AI_DEBUG >=3 cout << "OUCH" << std::endl; #endif *************** *** 94,111 **** Vector3 AIController::LookForward() { ! Vector3 vVelocity = pPawn->GetVelocity(); float fMoveSpeed = pPawn->GetMoveSpeed(); // trace dans la direction du deplacement ! CollisionResult c = Game::pSelf->GetSceneManager()->Trace(pPawn->GetPosition(), vVelocity*2); // cherche (mais ne marche pas) a savoir si le lancer de rayon a touché un objet (map ou joueur) ! if(c.EndPoint != 2*vVelocity+pPawn->GetPosition()) { // dans ce cas, on ralentit... ! pPawn->SetMoveSpeed(fMoveSpeed-0.5); // puis on tourne... (a revoir... a priori SetVelocity n'est pas ce que je cherche...) ! pPawn->SetVelocity(vVelocity + 4*c.Normal); #if AI_DEBUG >= 4 ! cout << "Changement de direction..." << std::endl; #endif } else { --- 97,119 ---- Vector3 AIController::LookForward() { ! Vector3 vTarget = pPawn->GetRotation().GetXAxis();; ! Vector3 vPosition = pPawn->GetPosition()+Vector3(0, 0, 4); float fMoveSpeed = pPawn->GetMoveSpeed(); // trace dans la direction du deplacement ! CollisionResult c = Game::pSelf->Trace(vPosition , vPosition + vTarget*500, pPawn); ! pSphere2->vPosition = c.EndPoint; // cherche (mais ne marche pas) a savoir si le lancer de rayon a touché un objet (map ou joueur) ! if(c.Fraction < 1) { // dans ce cas, on ralentit... ! if (fMoveSpeed>10) { ! pPawn->SetMoveSpeed(fMoveSpeed-0.5); ! } // puis on tourne... (a revoir... a priori SetVelocity n'est pas ce que je cherche...) ! pPawn->SetRotation(Quaternion(rot+=5, Vector3::UNIT_Y)); ! // pPawn->SetVelocity(vVelocity + 4*c.Normal); #if AI_DEBUG >= 4 ! cout << "Changement de direction... "<< c.Fraction << std::endl; #endif } else { *************** *** 119,123 **** } } ! #if AI_DEBUG >= 5 cout << c.EndPoint << " / " << (2*vVelocity+pPawn->GetPosition())<< std::endl; --- 127,131 ---- } } ! #if AI_DEBUG >= 5 cout << c.EndPoint << " / " << (2*vVelocity+pPawn->GetPosition())<< std::endl; *************** *** 135,146 **** ================================================================= - ## 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; - - */ --- 143,149 ---- Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aicontroller.h 2 Dec 2004 22:02:37 -0000 1.13 --- aicontroller.h 3 Dec 2004 19:49:55 -0000 1.14 *************** *** 15,18 **** --- 15,19 ---- DebugSphere* pSphere; + DebugSphere* pSphere2; // pour l'IA public: AIController (Pawn* p); |
|
From: Yohann C. <pl...@us...> - 2004-12-02 22:02:46
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16812 Modified Files: aicontroller.cc aicontroller.h Log Message: pour le debug... le perso fait rien de plus pour le moment. (enfin, il serait sensé, mais non....) Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** aicontroller.cc 2 Dec 2004 00:18:54 -0000 1.18 --- aicontroller.cc 2 Dec 2004 22:02:37 -0000 1.19 *************** *** 8,11 **** --- 8,13 ---- #include <math.h> + #define cout std::cout<<"[AI] " + bool initialised = false; int rot=0; *************** *** 40,46 **** } ! static float rotY = 0.0f; static float test = 0.5f; ! /* float test = Util::Random(); if (test < 0.5f) test *= -1; --- 42,48 ---- } ! /* static float rotY = 0.0f; static float test = 0.5f; ! float test = Util::Random(); if (test < 0.5f) test *= -1; *************** *** 50,65 **** // pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); ! //bDir[FORWARD] = 1; ! } - void AIController::HitWall(const Vector3& vPoint, const Vector3& vNormal, PhysicNode* who) { //if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats // return; ! //iLife -= 5; pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); /*std::cout << "OUCH" << std::endl; --- 52,69 ---- // pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); ! AIController::LookForward(); ! // pPawn->SetVelocity(Vector3(0,1,0)); } void AIController::HitWall(const Vector3& vPoint, const Vector3& vNormal, PhysicNode* who) { //if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats // return; ! //iLife -= 5; pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); + #if AI_DEBUG >=4 + cout << "OUCH" << std::endl; + #endif /*std::cout << "OUCH" << std::endl; *************** *** 77,84 **** } void AIController::Initialize() { #if AI_DEBUG >= 1 ! std::cout << "[AI] C'est parti pour l'IA" << std::endl; #endif initialised=true; --- 81,89 ---- } + // n'est jamais appelee. c'est a peu pres normal pour le moment.... void AIController::Initialize() { #if AI_DEBUG >= 1 ! cout << "C'est parti pour l'IA" << std::endl; #endif initialised=true; *************** *** 87,90 **** --- 92,131 ---- } + Vector3 AIController::LookForward() + { + Vector3 vVelocity = pPawn->GetVelocity(); + float fMoveSpeed = pPawn->GetMoveSpeed(); + + // trace dans la direction du deplacement + CollisionResult c = Game::pSelf->GetSceneManager()->Trace(pPawn->GetPosition(), vVelocity*2); + + // cherche (mais ne marche pas) a savoir si le lancer de rayon a touché un objet (map ou joueur) + if(c.EndPoint != 2*vVelocity+pPawn->GetPosition()) { + // dans ce cas, on ralentit... + pPawn->SetMoveSpeed(fMoveSpeed-0.5); + // puis on tourne... (a revoir... a priori SetVelocity n'est pas ce que je cherche...) + pPawn->SetVelocity(vVelocity + 4*c.Normal); + #if AI_DEBUG >= 4 + cout << "Changement de direction..." << std::endl; + #endif + } else { + // sinon, on va augmenter la vitesse (pas de vitesse limite dans le moteur pour le moment + // a priori, donc je limite moi-meme.... + if(fMoveSpeed < 449.5) { + #if AI_DEBUG >= 4 + cout << "augmentation de la vitesse" << std::endl; + #endif + pPawn->SetMoveSpeed(fMoveSpeed+0.5); + } + } + + #if AI_DEBUG >= 5 + cout << c.EndPoint << " / " << (2*vVelocity+pPawn->GetPosition())<< std::endl; + #endif + + // ca, ca sert a rien pour le moment, mais c'est sensé servir plus tard + // (biensur, je retournerai autre chose..) + return Vector3::UNIT_Y; + } /* ================================================================= Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** aicontroller.h 2 Dec 2004 00:18:54 -0000 1.12 --- aicontroller.h 2 Dec 2004 22:02:37 -0000 1.13 *************** *** 22,25 **** --- 22,28 ---- void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); void Initialize (); + protected: + Vector3 LookForward(); + }; |
|
From: julien r. <jul...@us...> - 2004-12-02 00:19:19
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13575 Modified Files: aicontroller.cc aicontroller.h game.cc playercontroller.cc playercontroller.h rocket.cc Log Message: .. Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** game.cc 1 Dec 2004 18:56:48 -0000 1.41 --- game.cc 2 Dec 2004 00:18:54 -0000 1.42 *************** *** 29,33 **** std::string mapname = "data/maps/"; if (argc < 2) ! mapname += "epfl_co.bsp"; else mapname += argv[1]; --- 29,33 ---- std::string mapname = "data/maps/"; if (argc < 2) ! mapname += "test.bsp"; else mapname += argv[1]; Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** aicontroller.cc 1 Dec 2004 20:29:54 -0000 1.17 --- aicontroller.cc 2 Dec 2004 00:18:54 -0000 1.18 *************** *** 54,68 **** } ! void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); ! std::cout << "OUCH" << std::endl; ! ! /* ! if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats ! return; - iLife -= 5; - std::cout << "OUCH" << std::endl; if (!bAlive) --- 54,67 ---- } ! ! void AIController::HitWall(const Vector3& vPoint, const Vector3& vNormal, PhysicNode* who) { + //if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats + // return; + + //iLife -= 5; pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); ! /*std::cout << "OUCH" << std::endl; if (!bAlive) *************** *** 75,80 **** pPawn->SetBB (Vector3(-15,0,-10), Vector3(60, 30, 15)); bAlive = false; ! } ! */ } --- 74,78 ---- pPawn->SetBB (Vector3(-15,0,-10), Vector3(60, 30, 15)); bAlive = false; ! }*/ } Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** aicontroller.h 1 Dec 2004 20:29:55 -0000 1.11 --- aicontroller.h 2 Dec 2004 00:18:54 -0000 1.12 *************** *** 20,24 **** void Think (float); ! void Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); void Initialize (); }; --- 20,24 ---- void Think (float); ! void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); void Initialize (); }; Index: rocket.cc =================================================================== RCS file: /cvsroot/epfl/tggame/rocket.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** rocket.cc 30 Nov 2004 18:22:01 -0000 1.7 --- rocket.cc 2 Dec 2004 00:18:54 -0000 1.8 *************** *** 16,20 **** pPhysic->SetVelocity(vVeloc); ! pEmit = new ParticleEmitter (100, Vector3(0,0,0), Game::pSelf->GetEngine()->pTextureManager->LoadTexture("data/particle.jpg", TG_TEXTURE_2D), 20.0f); pEmit->SetParticlesSpeed (-vVeloc/100); pEmit->SetLife(30.0f); --- 16,20 ---- pPhysic->SetVelocity(vVeloc); ! pEmit = new ParticleEmitter (100, vPosition, Game::pSelf->GetEngine()->pTextureManager->LoadTexture("data/particle.jpg", TG_TEXTURE_2D), 20.0f); pEmit->SetParticlesSpeed (-vVeloc/100); pEmit->SetLife(30.0f); Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** playercontroller.cc 30 Nov 2004 18:22:00 -0000 1.23 --- playercontroller.cc 2 Dec 2004 00:18:54 -0000 1.24 *************** *** 88,95 **** --- 88,99 ---- + } + void PlayerController::HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) + { } + void PlayerController::EventHandler (tgEvent& e) { Index: playercontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** playercontroller.h 30 Nov 2004 18:22:00 -0000 1.13 --- playercontroller.h 2 Dec 2004 00:18:54 -0000 1.14 *************** *** 33,37 **** void EventHandler (tgEvent& e); ! void Exec (const std::string& s, int arg) { --- 33,38 ---- void EventHandler (tgEvent& e); ! void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); ! void Exec (const std::string& s, int arg) { |
|
From: Yohann C. <pl...@us...> - 2004-12-01 20:30:06
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21977 Modified Files: aicontroller.cc aicontroller.h Log Message: désolé..... le billard c'est pour une autre fois... Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** aicontroller.cc 1 Dec 2004 18:56:48 -0000 1.16 --- aicontroller.cc 1 Dec 2004 20:29:54 -0000 1.17 *************** *** 18,23 **** int AIController::CROUCH = 5; - int iDirection; - AIController::AIController(Pawn* p) : Controller(p) { --- 18,21 ---- *************** *** 48,52 **** --- 46,52 ---- test *= -1; */ + // rotY+=test; bDir[FORWARD]=1; + // pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); //bDir[FORWARD] = 1; *************** *** 57,60 **** --- 57,61 ---- { pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); + std::cout << "OUCH" << std::endl; /* Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** aicontroller.h 30 Nov 2004 18:22:00 -0000 1.10 --- aicontroller.h 1 Dec 2004 20:29:55 -0000 1.11 *************** *** 18,24 **** AIController (Pawn* p); virtual ~AIController() {} ! void Think (float); ! // void Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); void Initialize (); }; --- 18,24 ---- AIController (Pawn* p); virtual ~AIController() {} ! void Think (float); ! void Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); void Initialize (); }; |
|
From: Yohann C. <pl...@us...> - 2004-12-01 18:56:59
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29861 Modified Files: Makefile.Linux aicontroller.cc game.cc Log Message: Et notre guardian devient une boule de billard.... Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** game.cc 30 Nov 2004 18:22:00 -0000 1.40 --- game.cc 1 Dec 2004 18:56:48 -0000 1.41 *************** *** 9,19 **** pTimer = new Timer (); pEngine = new Engine (pTimer); ! //On cree un nouveau soundmanager pSoundManager = new SoundManager(); ! Engine::pEngine = pEngine; ! ! pSceneManager = new SceneManager (pTimer); pPhysicEngine = new PhysicEngine (); --- 9,19 ---- pTimer = new Timer (); pEngine = new Engine (pTimer); ! //On cree un nouveau soundmanager pSoundManager = new SoundManager(); ! Engine::pEngine = pEngine; ! ! pSceneManager = new SceneManager (pTimer); pPhysicEngine = new PhysicEngine (); *************** *** 29,40 **** std::string mapname = "data/maps/"; if (argc < 2) ! mapname += "test.bsp"; else mapname += argv[1]; ! pWorld = new World((char*)mapname.data()); pWorld->Add(pSceneManager); _CreatePlayers (); ! SoundManager::pSoundManager = pSoundManager; } --- 29,40 ---- std::string mapname = "data/maps/"; if (argc < 2) ! mapname += "epfl_co.bsp"; else mapname += argv[1]; ! pWorld = new World((char*)mapname.data()); pWorld->Add(pSceneManager); _CreatePlayers (); ! SoundManager::pSoundManager = pSoundManager; } *************** *** 79,83 **** return NULL; } ! else return i->second; --- 79,83 ---- return NULL; } ! else return i->second; *************** *** 95,101 **** pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/stand.md5anim"); pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/death.md5anim"); ! pEngine->pMeshManager->Load("rocket", "data/models/rocket/rocket.md5mesh"); ! //création du joueur local --- 95,101 ---- pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/stand.md5anim"); pEngine->pMeshManager->LoadAnim("pinky", "data/models/player/death.md5anim"); ! pEngine->pMeshManager->Load("rocket", "data/models/rocket/rocket.md5mesh"); ! //création du joueur local *************** *** 125,129 **** p->SetVisible(false); //p->GetCamera()->SetPhysicCallBack(pLocalController); ! //création d'un ennemi //for (int i=0; i<pWorld->GetNumStartPositions(); i++) --- 125,129 ---- p->SetVisible(false); //p->GetCamera()->SetPhysicCallBack(pLocalController); ! //création d'un ennemi //for (int i=0; i<pWorld->GetNumStartPositions(); i++) *************** *** 138,141 **** --- 138,142 ---- //p->SetRotation(Quaternion(-90, Vector3::UNIT_X)); p->SetPosition(pWorld->GetStartPosition(0)); + p->SetPosition (Vector3(-80,80,100)); p->SetBB(Vector3(-15, 0, -15), Vector3(15, 80, 15)); c->SetViewOffset(Vector3(0,70,0)); *************** *** 156,160 **** { pSoundManager->UpdateListener(pSceneManager->GetCamera()); ! float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) --- 157,161 ---- { pSoundManager->UpdateListener(pSceneManager->GetCamera()); ! float t = pTimer->GetFrameInterval (); for (unsigned int i=0; i<vControllers.size(); i++) Index: Makefile.Linux =================================================================== RCS file: /cvsroot/epfl/tggame/Makefile.Linux,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.Linux 17 Nov 2004 23:12:55 -0000 1.7 --- Makefile.Linux 1 Dec 2004 18:56:48 -0000 1.8 *************** *** 13,18 **** all: $(OBJS) ! g++ -o tg $(INCLUDEPATH) $(LINKPATH) $(LIBS) $(OBJS) ! clean: rm -f tg --- 13,18 ---- all: $(OBJS) ! g++ -o tg $(INCLUDEPATH) $(LINKPATH) $(LIBS) $(OBJS) ! clean: rm -f tg Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** aicontroller.cc 30 Nov 2004 18:22:00 -0000 1.15 --- aicontroller.cc 1 Dec 2004 18:56:48 -0000 1.16 *************** *** 18,21 **** --- 18,23 ---- int AIController::CROUCH = 5; + int iDirection; + AIController::AIController(Pawn* p) : Controller(p) { *************** *** 41,85 **** static float rotY = 0.0f; ! float test = Util::Random(); if (test < 0.5f) test *= -1; - - rotY += test; - - pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); - bDir[FORWARD] = 1; - - /* - 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); ! #if AI_DEBUG >= 5 ! std::cout << "[AI] EndPoint Z: " << vCentre.z ! << " Position : " << vPos ! << " Distance : " << abs(fVarZ) << std::endl; ! #endif*/ - //pPawn->SetRotation(Quaternion(rot++, Vector3::UNIT_Y)); - //rot=rot%360; - //bDir[STRAFELEFT]=1; } ! #if 0 void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats return; ! iLife -= 5; std::cout << "OUCH" << std::endl; if (!bAlive) { --- 43,68 ---- static float rotY = 0.0f; ! static float test = 0.5f; ! /* float test = Util::Random(); if (test < 0.5f) test *= -1; */ ! bDir[FORWARD]=1; ! //bDir[FORWARD] = 1; } ! void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { + pPawn->SetRotation(Quaternion(Util::Random()*360, Vector3::UNIT_Y)); + + /* if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats return; ! iLife -= 5; std::cout << "OUCH" << std::endl; + if (!bAlive) { *************** *** 92,97 **** bAlive = false; } } ! #endif void AIController::Initialize() { --- 75,81 ---- bAlive = false; } + */ } ! void AIController::Initialize() { *************** *** 100,103 **** --- 84,88 ---- #endif initialised=true; + pPawn->SetRotation(Quaternion(180, Vector3::UNIT_Y)); srand( (unsigned)time( NULL ) ); } |
|
From: julien r. <jul...@us...> - 2004-12-01 14:44:49
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1915 Added Files: physicdefs.h Log Message: .. --- NEW FILE: physicdefs.h --- (This appears to be a binary file; contents omitted.) |
|
From: julien r. <jul...@us...> - 2004-11-30 18:22:12
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23594 Modified Files: aicontroller.cc aicontroller.h controller.cc controller.h game.cc game.h pawn.h playercontroller.cc playercontroller.h projectile.cc projectile.h rocket.cc rocket.h rocketlauncher.cc rocketlauncher.h weapon.cc weapon.h Log Message: cf Changelog@wiki Index: projectile.cc =================================================================== RCS file: /cvsroot/epfl/tggame/projectile.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** projectile.cc 19 Nov 2004 12:05:14 -0000 1.3 --- projectile.cc 30 Nov 2004 18:22:00 -0000 1.4 *************** *** 1,7 **** #include "projectile.h" #include "controller.h" ! Projectile::Projectile() : Pawn ("rocket") { } --- 1,9 ---- #include "projectile.h" #include "controller.h" + #include "weapon.h" ! Projectile::Projectile(Weapon* handler, const std::string& name) : Pawn (name) { + pPhysic->SetPhysicCallBack(handler); } *************** *** 10,11 **** --- 12,14 ---- } + Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** game.cc 25 Nov 2004 18:22:37 -0000 1.39 --- game.cc 30 Nov 2004 18:22:00 -0000 1.40 *************** *** 52,60 **** void Game::AddPawn (Pawn* p, bool physic = true, bool scene = true) { ! vPawns.push_back(p); if (scene) p->Add(pSceneManager); ! if (physic && scene) p->Add(pPhysicEngine); } --- 52,63 ---- void Game::AddPawn (Pawn* p, bool physic = true, bool scene = true) { ! //vPawns.push_back(p); if (scene) p->Add(pSceneManager); ! if (physic) ! { p->Add(pPhysicEngine); + vPhysicNodeToPawn[p->GetPhysic()] = p; + } } *************** *** 63,69 **** --- 66,87 ---- p->Remove(pSceneManager); p->Remove(pPhysicEngine); + vPhysicNodeToPawn.erase(p->GetPhysic()); //TODO: il faut enlever le pawn de vPawns; } + Pawn* Game::GetPawnFromPhysicNode (PhysicNode* node) + { + std::map<PhysicNode*, Pawn*>::iterator i; + i = vPhysicNodeToPawn.find(node); + if (i==vPhysicNodeToPawn.end()) + { + std::cout << "GetPawnFromPhysicNode::element non trouve" << std::endl; + return NULL; + } + else + return i->second; + + } + void Game::_CreatePlayers () { *************** *** 106,110 **** p->SetMoveSpeed (CAM_SPEED); p->SetVisible(false); - p->SetClip(true); //p->GetCamera()->SetPhysicCallBack(pLocalController); --- 124,127 ---- Index: rocketlauncher.cc =================================================================== RCS file: /cvsroot/epfl/tggame/rocketlauncher.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rocketlauncher.cc 20 Nov 2004 09:05:11 -0000 1.4 --- rocketlauncher.cc 30 Nov 2004 18:22:01 -0000 1.5 *************** *** 6,9 **** --- 6,10 ---- fFireRate = 0.1f; fCoolDown = fFireRate; + pLast = NULL; } *************** *** 19,34 **** fCoolDown = fFireRate; - Vector3 target = vPosition - vTarget*10000; ! Rocket* pRocket = new Rocket (vPosition, target); Game::pSelf->AddPawn(pRocket, true, true); ! /*CollisionResult cR = Game::pSelf->Trace(vPosition, target, p); ! if (cR.pNode == NULL) //on a touche la map ! Game::pSelf->GetSceneManager()->GetDecalManager()->AddDecal(cR.EndPoint, cR.Normal, 1.0f, 1.0f, Engine::pTextureManager->LoadTexture("data/textures/decals/mgun.bmp", TG_TEXTURE_2D), 10.0f); ! if (cR.pNode != NULL && cR.pNode->GetPhysicCallBack() != NULL) //on a touche un objet ! cR.pNode->GetPhysicCallBack()->Collide(NULL, cR.EndPoint, cR.Normal);*/ ! SoundManager::pSoundManager->PlaySound("fire"); } --- 20,60 ---- fCoolDown = fFireRate; Vector3 target = vPosition - vTarget*10000; ! Rocket* pRocket = new Rocket (this, vPosition, target); ! //FIXME: Ca plante si on l'ajoute au physicengine Game::pSelf->AddPawn(pRocket, true, true); ! pLast = pRocket; ! SoundManager::pSoundManager->PlaySound("fire"); + + } + + void RocketLauncher::AltFire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p) + { + if (pLast == NULL) + return; + Game::pSelf->RemovePawn(pLast); + delete pLast; + pLast = NULL; } + + void RocketLauncher::HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) + { + + //FIXME: Ugly hack pour que le decal soit fixé contre le mur. Le vPoint est en fait la position du node au moment de la collision. Hors, le node a une bounding box, ce qui fait que le vPoint est éloigné du mur. + Vector3 cP = vPoint - vCollisionNormal*15; + Game::pSelf->GetSceneManager()->GetDecalManager()->AddDecal(cP, vCollisionNormal, 50.0f, 50.0f, Engine::pTextureManager->LoadTexture("data/textures/decals/rocket.jpg", TG_TEXTURE_2D), 10.0f); + + //if (other != NULL && other->GetPhysicCallBack() != NULL) //on a touche un objet + // other->GetPhysicCallBack()->Collide(NULL, vPoint, vCollisionNormal); + + SoundManager::pSoundManager->PlaySound("bomb"); + + Pawn* p = Game::pSelf->GetPawnFromPhysicNode(who); + Game::pSelf->RemovePawn(p); + delete p; + p = NULL; + } + Index: rocket.h =================================================================== RCS file: /cvsroot/epfl/tggame/rocket.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rocket.h 19 Nov 2004 18:54:45 -0000 1.4 --- rocket.h 30 Nov 2004 18:22:01 -0000 1.5 *************** *** 8,14 **** { public: ! Rocket (const Vector3& vPosition, const Vector3& vTarget); ~Rocket (); ! void Collide (PhysicNode* other,const Vector3& vPoint, const Vector3& vCollisionNormal); protected: static const float fSpeed; --- 8,17 ---- { public: ! Rocket (Weapon* handler, const Vector3& vPosition, const Vector3& vTarget); ~Rocket (); ! ! virtual void Remove(SceneManager* s) {s->RemoveWorldObject(pModel); s->RemoveParticlesEmitter(pEmit); } ! ! protected: static const float fSpeed; Index: game.h =================================================================== RCS file: /cvsroot/epfl/tggame/game.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** game.h 17 Nov 2004 23:12:56 -0000 1.13 --- game.h 30 Nov 2004 18:22:00 -0000 1.14 *************** *** 64,67 **** --- 64,68 ---- inline Timer* GetTimer() { return pTimer; } + Pawn* GetPawnFromPhysicNode (PhysicNode* node); /** * GetLocalController : retourne le controller local (celui qui reçoit les événements locaux (clavier + souris) *************** *** 86,89 **** --- 87,92 ---- std::vector<Controller*> vControllers; std::vector<Pawn*> vPawns; + + std::map<PhysicNode*, Pawn*> vPhysicNodeToPawn; //une map qui permet de retrouver un pawn d'après son physicnode. Utile pour les PhysicCallBack }; Index: controller.h =================================================================== RCS file: /cvsroot/epfl/tggame/controller.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** controller.h 22 Nov 2004 21:18:44 -0000 1.12 --- controller.h 30 Nov 2004 18:22:00 -0000 1.13 *************** *** 22,27 **** virtual void EventHandler (tgEvent& e) {} virtual void MovePawn(); ! ! virtual void Collide(PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; inline Pawn* GetPawn () { return pPawn; } --- 22,31 ---- virtual void EventHandler (tgEvent& e) {} virtual void MovePawn(); ! ! virtual void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); ! virtual void Landed (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); ! virtual void Touch (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who, PhysicNode* other); ! virtual void UnTouch (PhysicNode* who, PhysicNode* other); ! inline Pawn* GetPawn () { return pPawn; } Index: projectile.h =================================================================== RCS file: /cvsroot/epfl/tggame/projectile.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** projectile.h 19 Nov 2004 12:05:14 -0000 1.3 --- projectile.h 30 Nov 2004 18:22:00 -0000 1.4 *************** *** 10,19 **** using namespace tg; ! class Projectile : public Pawn, public PhysicCallBack { public: ! Projectile (); ! virtual ~Projectile (); ! virtual void Collide (PhysicNode* other,const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; protected: }; --- 10,21 ---- using namespace tg; ! class Weapon; ! ! class Projectile : public Pawn { public: ! Projectile (Weapon* handler, const std::string& name); ! virtual ~Projectile(); ! protected: }; Index: controller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/controller.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** controller.cc 22 Nov 2004 21:18:44 -0000 1.13 --- controller.cc 30 Nov 2004 18:22:00 -0000 1.14 *************** *** 36,44 **** y = rot.GetYAxis(); //le joueur ne peut pas choisir de se déplacer sur les y en avancant/reculant s'il 'clip'(vertical) ! /*if (pPawn->GetClip()) { x.y = 0; z.y = 0; ! }*/ y.x = 0; --- 36,44 ---- y = rot.GetYAxis(); //le joueur ne peut pas choisir de se déplacer sur les y en avancant/reculant s'il 'clip'(vertical) ! if (pPawn->GetPhysicType() != PHYS_NONE) { x.y = 0; z.y = 0; ! } y.x = 0; *************** *** 61,62 **** --- 61,82 ---- } + void Controller::HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) + { + + } + + void Controller::Landed (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) + { + + } + + void Controller::Touch (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who, PhysicNode* other) + { + + } + + void Controller::UnTouch (PhysicNode* other, PhysicNode* who) + { + } + + Index: rocket.cc =================================================================== RCS file: /cvsroot/epfl/tggame/rocket.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** rocket.cc 20 Nov 2004 09:05:11 -0000 1.6 --- rocket.cc 30 Nov 2004 18:22:01 -0000 1.7 *************** *** 7,11 **** const float Rocket::fSpeed = 900.0f; ! Rocket::Rocket (const Vector3& vPosition, const Vector3& vTarget) : Projectile () { pPhysic->SetGravityFactor(0.0f); --- 7,11 ---- const float Rocket::fSpeed = 900.0f; ! Rocket::Rocket (Weapon* handler, const Vector3& vPosition, const Vector3& vTarget) : Projectile (handler, "rocket") { pPhysic->SetGravityFactor(0.0f); *************** *** 15,20 **** //std::cout << "[TGGAME] " << vVeloc << std::endl; pPhysic->SetVelocity(vVeloc); - pPhysic->SetPhysicCallBack(this); - pEmit = new ParticleEmitter (100, Vector3(0,0,0), Game::pSelf->GetEngine()->pTextureManager->LoadTexture("data/particle.jpg", TG_TEXTURE_2D), 20.0f); --- 15,18 ---- *************** *** 35,58 **** Rocket::~Rocket () { delete pEmit; } ! void Rocket::Collide (PhysicNode* other,const Vector3& vPoint, const Vector3& vCollisionNormal) ! { ! Game::pSelf->RemovePawn(this); ! Game::pSelf->GetSceneManager()->RemoveParticlesEmitter(pEmit); ! ! if (other == NULL) //on a touche la map ! { ! //FIXME: Ugly hack pour que le decal soit fixé contre le mur. Le vPoint est en fait la position du node au moment de la collision. Hors, le node a une bounding box, ce qui fait que le vPoint est éloigné du mur. ! Vector3 cP = vPoint - vCollisionNormal*15; ! Game::pSelf->GetSceneManager()->GetDecalManager()->AddDecal(cP, vCollisionNormal, 50.0f, 50.0f, Engine::pTextureManager->LoadTexture("data/textures/decals/rocket.jpg", TG_TEXTURE_2D), 10.0f); ! } ! ! if (other != NULL && other->GetPhysicCallBack() != NULL) //on a touche un objet ! other->GetPhysicCallBack()->Collide(NULL, vPoint, vCollisionNormal); ! ! SoundManager::pSoundManager->PlaySound("bomb"); ! ! delete this; ! } --- 33,39 ---- Rocket::~Rocket () { + delete pEmit; } ! Index: rocketlauncher.h =================================================================== RCS file: /cvsroot/epfl/tggame/rocketlauncher.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rocketlauncher.h 17 Nov 2004 23:12:56 -0000 1.2 --- rocketlauncher.h 30 Nov 2004 18:22:01 -0000 1.3 *************** *** 12,17 **** void Fire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p); ! protected: }; --- 12,21 ---- void Fire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p); ! void AltFire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p); ! ! void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); + protected: + Rocket* pLast; }; Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** aicontroller.cc 22 Nov 2004 21:18:44 -0000 1.14 --- aicontroller.cc 30 Nov 2004 18:22:00 -0000 1.15 *************** *** 36,41 **** //std::cout << cR.EndPoint << std::endl; ! if (cR.pNode != NULL && cR.pNode->GetPhysicCallBack() != NULL) ! cR.pNode->GetPhysicCallBack()->Collide(NULL, cR.EndPoint, cR.Normal); } --- 36,41 ---- //std::cout << cR.EndPoint << std::endl; ! //if (cR.pNode != NULL && cR.pNode->GetPhysicCallBack() != NULL) ! // cR.pNode->GetPhysicCallBack()->Collide(NULL, cR.EndPoint, cR.Normal); } *************** *** 48,52 **** pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); ! //bDir[FORWARD] = 1; /* --- 48,52 ---- pPawn->SetRotation(Quaternion(rotY, Vector3::UNIT_Y)); ! bDir[FORWARD] = 1; /* *************** *** 74,80 **** //bDir[STRAFELEFT]=1; } ! void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { iLife -= 5; std::cout << "OUCH" << std::endl; --- 74,83 ---- //bDir[STRAFELEFT]=1; } ! #if 0 void AIController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) { + if (other == NULL) //si on a une collision avec la map, on ne prend pas de degats + return; + iLife -= 5; std::cout << "OUCH" << std::endl; *************** *** 90,94 **** } } ! void AIController::Initialize() { --- 93,97 ---- } } ! #endif void AIController::Initialize() { Index: pawn.h =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pawn.h 19 Nov 2004 12:05:14 -0000 1.14 --- pawn.h 30 Nov 2004 18:22:00 -0000 1.15 *************** *** 55,62 **** void Remove(PhysicEngine* p) {p->RemoveNode(pPhysic); } ! void Remove(SceneManager* s) {s->RemoveWorldObject(pModel); } ! inline void SetClip(bool b) { pPhysic->SetClip(b); } ! inline bool GetClip () { return pPhysic->Clip(); } inline void SetVisible (bool b) { pModel->SetRender(b); } --- 55,62 ---- void Remove(PhysicEngine* p) {p->RemoveNode(pPhysic); } ! virtual void Remove(SceneManager* s) {s->RemoveWorldObject(pModel); } ! inline void SetPhysicType (int t) { pPhysic->SetPhysicType(t); } ! inline int GetPhysicType () { return pPhysic->GetPhysicType(); } inline void SetVisible (bool b) { pModel->SetRender(b); } Index: playercontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** playercontroller.h 22 Nov 2004 21:18:44 -0000 1.12 --- playercontroller.h 30 Nov 2004 18:22:00 -0000 1.13 *************** *** 12,16 **** { enum { ! CLIP=1 }; --- 12,17 ---- { enum { ! FN_PHYS_NONE=1, ! FN_PHYS_WALKING }; *************** *** 25,28 **** --- 26,30 ---- Weapon* pWeapon; bool bFire; + bool bAltFire; DebugSphere* pSphere; public: *************** *** 30,38 **** void Think (float); void EventHandler (tgEvent& e); ! void Collide(PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); void Exec (const std::string& s, int arg) { switch(arg) { ! case CLIP: pPawn->SetClip(pPawn->GetClip()?false:true); break; default: break; } --- 32,42 ---- void Think (float); void EventHandler (tgEvent& e); ! ! void Exec (const std::string& s, int arg) { switch(arg) { ! case FN_PHYS_NONE: pPawn->SetPhysicType(PHYS_NONE); pPawn->SetVelocity(Vector3::ZERO);break; ! case FN_PHYS_WALKING: pPawn->SetPhysicType(PHYS_WALKING); break; default: break; } Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** playercontroller.cc 22 Nov 2004 21:18:44 -0000 1.22 --- playercontroller.cc 30 Nov 2004 18:22:00 -0000 1.23 *************** *** 14,18 **** PlayerController::PlayerController(Pawn* p) : Controller (p) { ! Game::pSelf->GetConsole()->Register("clip", this, CLIP); pSphere = new DebugSphere (); Game::pSelf->GetSceneManager()->AddDebugSphere(pSphere); --- 14,19 ---- PlayerController::PlayerController(Pawn* p) : Controller (p) { ! Game::pSelf->GetConsole()->Register("phys-none", this, FN_PHYS_NONE); ! Game::pSelf->GetConsole()->Register("phys-walking", this, FN_PHYS_WALKING); pSphere = new DebugSphere (); Game::pSelf->GetSceneManager()->AddDebugSphere(pSphere); *************** *** 20,23 **** --- 21,25 ---- pWeapon = pRocketLauncher; bFire = false; + bAltFire = false; } *************** *** 34,37 **** --- 36,46 ---- pWeapon->Fire (vPosition, vTarget, pPawn); } + if (bAltFire) + { + vTarget = pPawn->GetRotation().GetZAxis(); + vPosition = pPawn->GetPosition()+vViewOffset-vTarget*50; + pWeapon->AltFire (vPosition, vTarget, pPawn); + + } vPosition = pPawn->GetPosition()+vViewOffset; vTarget = vPosition - pPawn->GetRotation().GetZAxis()*1000000; *************** *** 82,89 **** } - void PlayerController::Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal) - { - //std::cerr << "playercontroller" << std::endl; - } void PlayerController::EventHandler (tgEvent& e) --- 91,94 ---- *************** *** 92,102 **** if (e.type == evMouseButtonDown) { ! bFire = true; ! pWeapon->Animation("fire4"); } else if (e.type == evMouseButtonUp) { ! bFire = false; ! pWeapon->Animation("idle"); } --- 97,121 ---- if (e.type == evMouseButtonDown) { ! if (e.button.button == tgButtonLeft) ! { ! bFire = true; ! pWeapon->Animation("fire4"); ! } else if (e.button.button == tgButtonRight) ! { ! bAltFire = true; ! pWeapon->Animation("fire4"); ! } } else if (e.type == evMouseButtonUp) { ! if (e.button.button == tgButtonLeft) ! { ! bFire = false; ! pWeapon->Animation("idle"); ! } else if (e.button.button == tgButtonRight) ! { ! bAltFire = false; ! pWeapon->Animation("idle"); ! } } Index: aicontroller.h =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** aicontroller.h 22 Nov 2004 21:18:44 -0000 1.9 --- aicontroller.h 30 Nov 2004 18:22:00 -0000 1.10 *************** *** 20,24 **** void Think (float); ! void Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); void Initialize (); }; --- 20,24 ---- void Think (float); ! // void Collide (PhysicNode* other, const Vector3& vPoint, const Vector3& vCollisionNormal); void Initialize (); }; Index: weapon.cc =================================================================== RCS file: /cvsroot/epfl/tggame/weapon.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** weapon.cc 17 Nov 2004 23:12:56 -0000 1.5 --- weapon.cc 30 Nov 2004 18:22:01 -0000 1.6 *************** *** 33,34 **** --- 33,56 ---- } + + void Weapon::HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) + { + + } + + void Weapon::Landed (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) + { + + } + + void Weapon::Touch (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who, PhysicNode* other) + { + + } + + void Weapon::UnTouch (PhysicNode* who, PhysicNode* other) + { + + } + + Index: weapon.h =================================================================== RCS file: /cvsroot/epfl/tggame/weapon.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** weapon.h 17 Nov 2004 23:12:56 -0000 1.4 --- weapon.h 30 Nov 2004 18:22:01 -0000 1.5 *************** *** 6,13 **** #include <vector3.h> #include <md5instance.h> using namespace tg; ! class Weapon { public: --- 6,14 ---- #include <vector3.h> #include <md5instance.h> + #include <physiccallback.h> using namespace tg; ! class Weapon : public PhysicCallBack { public: *************** *** 16,22 **** --- 17,29 ---- virtual void Fire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p) = 0; + virtual void AltFire (const Vector3& vPosition, const Vector3& vTarget, Pawn* p) = 0; void Think (float eTime); void Animation(std::string name); + + virtual void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); + virtual void Landed (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who); + virtual void Touch (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who, PhysicNode* other); + virtual void UnTouch (PhysicNode* who, PhysicNode* other); protected: |
|
From: julien r. <jul...@us...> - 2004-11-30 18:22:09
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23531 Modified Files: Makefile.Linux defs.h dlinkednode.h glrenderer.cc md5mesh10.h physiccallback.h physicengine.cc physicengine.h physicnode.cc physicnode.h scenemanager.cc scenemanager.h Log Message: cf Changelog@wiki Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** physicengine.cc 23 Nov 2004 12:36:26 -0000 1.32 --- physicengine.cc 30 Nov 2004 18:21:56 -0000 1.33 *************** *** 20,27 **** void PhysicEngine::StepSlideMove(PhysicNode* n, float eTime, Vector3& vVelocity, Vector3 origin) { - //BspCollisionResult trace; CollisionResult trace; int bumpcount = 0; - //Vector3 origin = n->pBBox->vWorldOrigin; Plane pPlanes[5]; int iNumPlanes = 0; --- 20,25 ---- *************** *** 36,43 **** //a chaque fois qu'on rencontre un plan, on relance un trace avec comme origine le Endpoint sur le plan précédent et on ajuste la vitesse de notre objet. MAXBUMPS permet simplement d'éviter des boucles infinies { - //trace = pLevel->CheckRayMove(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax); trace = Trace(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax, n); - //on trace avec une sphere, les mouvements semblent plus 'lisses' - //trace = pLevel->CheckRayMove(origin+n->GetBBox()->vBSCenter, origin+n->GetBBox()->vBSCenter+vVelocity*time_left, TRACE_SPHERE, n->GetBBox()->fBSRadius); if (trace.AllSolid) --- 34,38 ---- *************** *** 179,185 **** //si on met le allsolid, ca foire les mouvements sur les y if (col.Fraction < 1.0f || col.AllSolid) ! n->SetOnGround(true); else ! n->SetOnGround(false); } --- 174,182 ---- //si on met le allsolid, ca foire les mouvements sur les y if (col.Fraction < 1.0f || col.AllSolid) ! //n->SetOnGround(true); ! n->SetPhysicType(PHYS_WALKING); else ! //n->SetOnGround(false); ! n->SetPhysicType(PHYS_FALLING); } *************** *** 189,194 **** * 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 void PhysicEngine::Move (float eTime) --- 186,189 ---- *************** *** 199,211 **** n = pNodes[i]; //si l'objet ne doit pas etre géré par la physique, on continue ! if (!n->Clip()) { - //ugly hack pour éviter de tomber quand on tappe -clip le jeu étant deja lancé (on se choppe l'accel négative de la frame précédente en fait... - Vector3 veloc = n->GetVelocity(); - veloc.y = 0; - n->SetVelocity(veloc); - n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); - //n->SetRotation(n->GetRotation()+n->GetRotationVelocity()*eTime); Quaternion q = n->GetRotationVelocity()*eTime; q.Normalize(); --- 194,200 ---- n = pNodes[i]; //si l'objet ne doit pas etre géré par la physique, on continue ! if (n->GetPhysicType() == PHYS_NONE) { n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); Quaternion q = n->GetRotationVelocity()*eTime; q.Normalize(); *************** *** 218,253 **** //on a un objet qui doit subir les forces et les collisions ! /* ! if (n->GetGravityFactor() > EPSILON) //on évite de s'amuser si l'objet se fout de la gravité { Vector3 vVelocity = n->GetVelocity(); ! if (!n->OnGround()) vVelocity.y = -(*pGravity)*n->GetGravityFactor(); else if (vVelocity.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) vVelocity.y = 0; - //std::cout << "OnGround : " << n->OnGround(); - //std::cout << "Accel : \t" << n->GetAccel() << std::endl; - //int red[]={1,0,0}; - //Engine::pEngine->pRenderer->drawDebugArrow(n->vPosition, n->vPosition+n->vAccel*5, red); - //std::cout << n->GetVelocity() << std::endl; n->SetVelocity(vVelocity); ! }*/ //mise a jour des volumes englobants n->CalculateBoundingVolume(); //on test les collisions avec le monde - if (pLevel) { ! //appel de la callback pour les collisions avec la map. Ca permet aux objets style rockets de savoir s'ils doivent exploser ! CollisionResult trace = Trace(n->GetPosition(), n->GetPosition()+n->GetVelocity()*eTime, n->GetBBox()->vMin, n->GetBBox()->vMax, n); ! if ((trace.Fraction < 1.0f || trace.AllSolid) && n->GetPhysicCallBack() != NULL) ! n->GetPhysicCallBack()->Collide(trace.pNode, trace.EndPoint, trace.Normal); ! ! if (n==NULL) //il est possible que l'appel a la callback entraine la suppression de l'objet (la rocket explose), on doit donc verifier que le pointeur soit toujours valide avant de continuer ! continue; _TryToStep(n, eTime); - Quaternion q = n->GetRotationVelocity()*eTime; q.Normalize(); --- 207,229 ---- //on a un objet qui doit subir les forces et les collisions ! ! if (n->GetPhysicType() != PHYS_PROJECTILE) //on évite de s'amuser si l'objet se fout de la gravité { Vector3 vVelocity = n->GetVelocity(); ! if (n->GetPhysicType() == PHYS_FALLING) vVelocity.y = -(*pGravity)*n->GetGravityFactor(); else if (vVelocity.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) vVelocity.y = 0; n->SetVelocity(vVelocity); ! } //mise a jour des volumes englobants n->CalculateBoundingVolume(); //on test les collisions avec le monde if (pLevel) { ! _TryToStep(n, eTime); Quaternion q = n->GetRotationVelocity()*eTime; q.Normalize(); *************** *** 257,260 **** --- 233,241 ---- } + //appel de la callback pour les collisions avec la map. Ca permet aux objets style rockets de savoir s'ils doivent exploser + CollisionResult trace = Trace(n->GetPosition(), n->GetPosition()+n->GetVelocity()*eTime, n->GetBBox()->vMin, n->GetBBox()->vMax, n); + if ((trace.Fraction < 1.0f || trace.AllSolid) && n->GetPhysicCallBack() != NULL) + n->GetPhysicCallBack()->HitWall(trace.EndPoint, trace.Normal, n); + } } Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** scenemanager.cc 19 Nov 2004 12:04:04 -0000 1.20 --- scenemanager.cc 30 Nov 2004 18:21:56 -0000 1.21 *************** *** 61,120 **** pCamera->Update (frameInterval); pCamera->Look (); - - glPushMatrix(); - - Quaternion q = pCamera->GetRotation(); - Vector3 fwd, rgt, up; - fwd = q.GetXAxis(); - rgt = q.GetZAxis(); - up = q.GetYAxis(); - - fwd *= 10; - rgt *= 10; - up *= 10; - //glTranslatef(-13,-10,-20); - glDisable (GL_TEXTURE_2D); - glBegin (GL_LINES); - glColor3f (1,0,0); - glVertex3f (0,0,0); - glVertex3fv (&fwd.x); - - glColor3f(0,0,1); - glVertex3f (0,0,0); - glVertex3fv (&rgt.x); - - glColor3f(0,1,0); - glVertex3f (0,0,0); - glVertex3fv (&up.x); - glEnd (); - glPopMatrix (); - //Engine::pRenderer->RenderBBox(pCamera->pBBox); } - //FIXME: il faudrait passer par le renderer if(pLevel) ! { ! pLevel->SetCamera(pCamera); ! pLevel->Render(); ! ! ! /*Vector3 vTarget = pCamera->GetRotation().GetZAxis(); ! Vector3 vPosition = pCamera->GetPosition(); ! vTarget = vPosition - vTarget*10000; ! ! CollisionResult myResult = pPhysicEngine->Trace(vPosition, vTarget); ! glPointSize(5.0f); ! ! Engine::pRenderer->Begin2D(); ! Engine::pRenderer->End2D(); ! ! glColor3f(1,0,0); ! glPushMatrix(); ! glTranslatef(myResult.EndPoint.x, myResult.EndPoint.y, myResult.EndPoint.z); ! GLUquadric* pquad = gluNewQuadric(); ! gluSphere( pquad, 10,10,10); ! glPopMatrix();*/ ! } - Mesh* m = pFirstObject; if (m != NULL) --- 61,68 ---- pCamera->Update (frameInterval); pCamera->Look (); } if(pLevel) ! pLevel->Render(); Mesh* m = pFirstObject; if (m != NULL) *************** *** 279,394 **** void SceneManager::AddWorldObject (Mesh* obj) { ! if (pFirstObject) //le premier noeud existe ! { ! pCurrentObject->SetNext(obj); ! obj->SetPrev(pCurrentObject); ! obj->SetNext(NULL); ! pCurrentObject = obj; ! } ! else ! { ! obj->SetPrev(NULL); ! obj->SetNext(NULL); ! pFirstObject = obj; ! pCurrentObject = obj; ! } } void SceneManager::AddParticlesEmitter (ParticleEmitter* p) { ! if (pFirstEmitter) //le premier noeud existe ! { ! pCurrentEmitter->SetNext(p); ! p->SetPrev(pCurrentEmitter); ! p->SetNext(NULL); ! pCurrentEmitter = p; ! } ! else ! { ! p->SetPrev(NULL); ! p->SetNext(NULL); ! pFirstEmitter = p; ! pCurrentEmitter = p; ! } } void SceneManager::AddPointLight (PointLight* pL) { ! if (pFirstPointLight) //le premier noeud existe ! { ! pCurrentPointLight->SetNext(pL); ! pL->SetPrev(pCurrentPointLight); ! pL->SetNext(NULL); ! pCurrentPointLight = pL; ! } ! else ! { ! pL->SetPrev(NULL); ! pL->SetNext(NULL); ! pFirstPointLight = pL; ! pCurrentPointLight = pL; ! } } void SceneManager::RemoveParticlesEmitter(ParticleEmitter* p) { ! if (p->GetNext() == NULL) //l'objet est le dernier de la liste ! { ! if (p->GetPrev() != NULL) //mais il a un predecesseur ! { ! pCurrentEmitter = p->GetPrev(); ! pCurrentEmitter->SetNext(NULL); ! } ! //sinon, il est seul dans la liste ! else ! { ! pFirstEmitter = NULL; ! pCurrentEmitter = NULL; ! } ! } ! else //il n'est pas le dernier ! { ! if (p->GetPrev() != NULL) //il a un predecesseur ! { ! p->GetPrev()->SetNext(p->GetNext()); ! p->GetNext()->SetPrev(p->GetPrev()); ! } ! else //il est le premier de la liste ! { ! pFirstEmitter = p->GetNext(); ! pFirstEmitter->SetPrev(NULL); ! } ! } } void SceneManager::RemovePointLight (PointLight* p) { ! if (p->GetNext() == NULL) //l'objet est le dernier de la liste ! { ! if (p->GetPrev() != NULL) //mais il a un predecesseur ! { ! pCurrentPointLight = p->GetPrev(); ! pCurrentPointLight->SetNext(NULL); ! } ! //sinon, il est seul dans la liste, donc on change juste pCurrentObject ! else ! { ! pFirstPointLight = NULL; ! pCurrentPointLight = NULL; ! } ! } ! else //il n'est pas le dernier ! { ! if (p->GetPrev() != NULL) //il a un predecesseur ! { ! p->GetPrev()->SetNext(p->GetNext()); ! p->GetNext()->SetPrev(p->GetPrev()); ! } ! else //il est le premier de la liste ! { ! pFirstPointLight = p->GetNext(); ! pFirstPointLight->SetPrev(NULL); ! } ! } } --- 227,256 ---- void SceneManager::AddWorldObject (Mesh* obj) { ! _TG_ADD_DLINKEDNODE(obj, pCurrentObject, pFirstObject) } void SceneManager::AddParticlesEmitter (ParticleEmitter* p) { ! _TG_ADD_DLINKEDNODE(p, pCurrentEmitter, pFirstEmitter) } void SceneManager::AddPointLight (PointLight* pL) { ! _TG_ADD_DLINKEDNODE(pL, pCurrentPointLight, pFirstPointLight); } void SceneManager::RemoveParticlesEmitter(ParticleEmitter* p) { ! _TG_REMOVE_DLINKEDNODE(p,pCurrentEmitter,pFirstEmitter) } void SceneManager::RemovePointLight (PointLight* p) { ! _TG_REMOVE_DLINKEDNODE(p,pCurrentPointLight,pFirstPointLight) ! } ! ! void SceneManager::RemoveWorldObject(Mesh* obj) ! { ! _TG_REMOVE_DLINKEDNODE(obj,pCurrentObject,pFirstObject); } *************** *** 400,435 **** } - - void SceneManager::RemoveWorldObject(Mesh* obj) - { - if (obj->GetNext() == NULL) //l'objet est le dernier de la liste - { - if (obj->GetPrev() != NULL) //mais il a un predecesseur - { - pCurrentObject = obj->GetPrev(); - pCurrentObject->SetNext(NULL); - } - //sinon, il est seul dans la liste, donc on change juste pCurrentObject - else - { - pFirstObject = NULL; - pCurrentObject = NULL; - } - } - else //il n'est pas le dernier - { - if (obj->GetPrev() != NULL) //il a un predecesseur - { - obj->GetPrev()->SetNext(obj->GetNext()); - obj->GetNext()->SetPrev(obj->GetPrev()); - } - else //il est le premier de la liste - { - pFirstObject = obj->GetNext(); - pFirstObject->SetPrev(NULL); - } - } - } - void SceneManager::AddTimedWorldObject (Mesh* obj, float time) { --- 262,265 ---- Index: defs.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/defs.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** defs.h 17 Nov 2004 23:12:37 -0000 1.7 --- defs.h 30 Nov 2004 18:21:55 -0000 1.8 *************** *** 13,16 **** --- 13,18 ---- #include <iomanip> + #include "tg_stl/vector.h" + #ifdef TGWIN32 #include <SDL/SDL.h> Index: physicnode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicnode.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** physicnode.cc 19 Nov 2004 12:04:04 -0000 1.11 --- physicnode.cc 30 Nov 2004 18:21:56 -0000 1.12 *************** *** 3,11 **** namespace tg { ! PhysicNode::PhysicNode(SceneNode* n) { pBBox=n->GetBBox(); - bClip=true; - bOnGround = false; vNodes.clear(); vNodes.push_back(n); --- 3,9 ---- namespace tg { ! PhysicNode::PhysicNode(SceneNode* n, int physType) { pBBox=n->GetBBox(); vNodes.clear(); vNodes.push_back(n); *************** *** 15,18 **** --- 13,17 ---- vAccel.Null(); fGravityFactor = 1.0f; + iPhysicType = physType; //vEuler.Null(); Index: physicengine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** physicengine.h 22 Nov 2004 21:19:07 -0000 1.10 --- physicengine.h 30 Nov 2004 18:21:56 -0000 1.11 *************** *** 7,10 **** --- 7,11 ---- #include "dlinkednode.h" #include "physicnode.h" + #include "physicdefs.h" namespace tg Index: scenemanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** scenemanager.h 17 Nov 2004 23:12:39 -0000 1.9 --- scenemanager.h 30 Nov 2004 18:21:56 -0000 1.10 *************** *** 62,66 **** DecalManager* GetDecalManager () { return pDecalManager; } - //void SetLevel(D3Map* d) { pD3Level = d; } inline CollisionResult Trace (Vector3 Begin, Vector3 End) { return pPhysicEngine->Trace(Begin, End); } --- 62,65 ---- *************** *** 75,79 **** std::vector<DebugSphere*> pDebugSpheres; ! Mesh* pFirstObject; Mesh* pCurrentObject; --- 74,78 ---- std::vector<DebugSphere*> pDebugSpheres; ! Mesh* pFirstObject; Mesh* pCurrentObject; Index: md5mesh10.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5mesh10.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** md5mesh10.h 22 Nov 2004 21:19:07 -0000 1.9 --- md5mesh10.h 30 Nov 2004 18:21:55 -0000 1.10 *************** *** 19,22 **** --- 19,23 ---- class MD5Mesh10 : public Base { + protected: struct _MD5Joint; struct _MD5Mesh; Index: dlinkednode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/dlinkednode.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dlinkednode.h 17 Nov 2004 23:12:37 -0000 1.3 --- dlinkednode.h 30 Nov 2004 18:21:55 -0000 1.4 *************** *** 14,38 **** #define _TG_INIT_DLINKEDNODE(arg1, arg2) next = arg1; prev = arg2; ! /* ! namespace tg ! { ! namespace scene ! { ! class DLinkedNode ! { ! public: ! DLinkedNode () { next = NULL; prev=NULL; } ! inline DLinkedNode* GetNext () const { return next; } ! inline DLinkedNode* GetPrev () const { return prev; } ! inline void SetNext(DLinkedNode* d) { next = d; } ! inline void SetPrev(DLinkedNode* d) { prev = d; } ! protected: ! DLinkedNode* next; ! DLinkedNode* prev; ! }; ! } ! }*/ #endif --- 14,62 ---- #define _TG_INIT_DLINKEDNODE(arg1, arg2) next = arg1; prev = arg2; ! #define _TG_REMOVE_DLINKEDNODE(p, current, first) \ ! if (p->GetNext() == NULL)\ ! { \ ! if (p->GetPrev() != NULL) \ ! { \ ! current = p->GetPrev(); \ ! current->SetNext(NULL); \ ! } \ ! else \ ! { \ ! first = NULL; \ ! current = NULL; \ ! } \ ! } \ ! else \ ! { \ ! if (p->GetPrev() != NULL) \ ! { \ ! p->GetPrev()->SetNext(p->GetNext()); \ ! p->GetNext()->SetPrev(p->GetPrev()); \ ! } \ ! else \ ! { \ ! first = p->GetNext(); \ ! first->SetPrev(NULL); \ ! } \ ! } ! #define _TG_ADD_DLINKEDNODE(p, current, first) \ ! if (first) \ ! { \ ! current->SetNext(p); \ ! p->SetPrev(current); \ ! p->SetNext(NULL); \ ! current = p; \ ! } \ ! else \ ! { \ ! p->SetPrev(NULL); \ ! p->SetNext(NULL); \ ! first = p; \ ! current = p; \ ! } ! #endif Index: glrenderer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.cc,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** glrenderer.cc 22 Nov 2004 21:19:07 -0000 1.24 --- glrenderer.cc 30 Nov 2004 18:21:55 -0000 1.25 *************** *** 1240,1243 **** --- 1240,1244 ---- glEnable (GL_TEXTURE_2D); glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnableClientState(GL_VERTEX_ARRAY); glEnable(GL_CULL_FACE); *************** *** 1261,1265 **** glVertexPointer(3, GL_FLOAT, sizeof(Vertice) , &pVerts[0].vPosition); glTexCoordPointer(2, GL_FLOAT, sizeof(Vertice), &pVerts[0].s); - glEnableClientState(GL_VERTEX_ARRAY); glDrawElements(GL_TRIANGLES, mesh->GetTrianglesCount(j)*3, GL_UNSIGNED_INT, pIndexes); --- 1262,1265 ---- *************** *** 1285,1288 **** --- 1285,1289 ---- //desactivation de la texture de couleur glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_VERTEX_ARRAY); glDisable (GL_TEXTURE_2D); Index: Makefile.Linux =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile.Linux,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.Linux 17 Nov 2004 23:12:37 -0000 1.7 --- Makefile.Linux 30 Nov 2004 18:21:49 -0000 1.8 *************** *** 5,9 **** OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) ! CFLAGS = -DTGLINUX -O3 -DDEBUG CC = g++ --- 5,9 ---- OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) ! CFLAGS = -DTGLINUX -O3 -DDEBUG CC = g++ Index: physicnode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicnode.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** physicnode.h 19 Nov 2004 12:04:04 -0000 1.9 --- physicnode.h 30 Nov 2004 18:21:56 -0000 1.10 *************** *** 7,10 **** --- 7,11 ---- #include "scenenode.h" #include "quaternion.h" + #include "physicdefs.h" *************** *** 12,15 **** --- 13,18 ---- { + + /** * représentation physique d'un ou plusieurs scenenode *************** *** 20,26 **** { public: ! PhysicNode (SceneNode* n); ~PhysicNode (); inline void AttachNode (SceneNode* s) { vNodes.push_back(s); } --- 23,32 ---- { public: ! PhysicNode (SceneNode* n, int physType=PHYS_WALKING); ~PhysicNode (); + inline void SetPhysicType(int physType) { iPhysicType = physType; } + inline int GetPhysicType() { return iPhysicType; } + inline void AttachNode (SceneNode* s) { vNodes.push_back(s); } *************** *** 45,62 **** inline void SetPhysicCallBack (PhysicCallBack* p) { pPhysicCallBack = p; } - /** - * Doit-on considérer ce node comme un objet physique ? - * @return bool true=physique, false=non-physique - */ - inline bool Clip () { return bClip; } - inline void SetClip (bool b) { bClip = b; } - - /** - * Informations sur la position de l'objet par rapport au sol - * @return bool true=sur le sol, false=en l'air - */ - inline bool OnGround () { return bOnGround; } - inline void SetOnGround (bool b) { bOnGround = b; } - inline bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal) { return vNodes[0]->Trace(Begin, End, colPoint, colNormal); } --- 51,54 ---- *************** *** 129,135 **** protected: - bool bClip; - bool bOnGround; bool bBlockTrace; /* Comment cet objet est-il influencé par la gravité */ float fGravityFactor; --- 121,126 ---- protected: bool bBlockTrace; + int iPhysicType; /* Comment cet objet est-il influencé par la gravité */ float fGravityFactor; Index: physiccallback.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physiccallback.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** physiccallback.h 17 Nov 2004 23:12:38 -0000 1.4 --- physiccallback.h 30 Nov 2004 18:21:55 -0000 1.5 *************** *** 15,19 **** { public: ! virtual void Collide (PhysicNode* other,const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; }; --- 15,37 ---- { public: ! //virtual void Collide (PhysicNode* other,const Vector3& vPoint, const Vector3& vCollisionNormal) = 0; ! /** ! * Méthode appelée lorsque le noeud touche un mur (du monde donc) ! */ ! virtual void HitWall (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) = 0; ! /** ! * Méthode appelée lorsque le noeud a atterit sur le monde (lors d'un saut par exemple) ! */ ! virtual void Landed (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who) = 0; ! /** ! * Méthode appelée lorsque le noeud touche un autre noeud ! */ ! virtual void Touch (const Vector3& vPoint, const Vector3& vCollisionNormal, PhysicNode* who, PhysicNode* other) = 0; ! /** ! * Méthode appelée lorsque le noeud arrête de toucher un autre noeud ! */ ! virtual void UnTouch (PhysicNode* who, PhysicNode* other) = 0; ! ! }; |
|
From: julien r. <jul...@us...> - 2004-11-30 18:22:06
|
Update of /cvsroot/epfl/tgengine-0.1/tg_stl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23531/tg_stl Added Files: vector.h Log Message: cf Changelog@wiki --- NEW FILE: vector.h --- #ifndef TGVECTOR_H #define TGVECTOR_H #include <iostream> namespace tg { /** * Le nombre d'objet qui est reserve en __plus__ à chaque push_back qui demande un resize * Ca permet d'éviter de devoir appeler resize à chaque push_back, mais ça peut bouffer de la mémoire en plus */ #define RESERVE_RATIO 10 template <class _T> class Vector { public: inline Vector(int s=0); inline void push_back(_T); inline void resize (int s); inline void clear (); inline int size (); inline _T operator [] (int n) { return *(data+n); } inline _T at(int i); protected: _T* data; //represent le dernier element "interresant" stocke. donc le dernier element ajoute //par un push_back. Les elements ajoutes automatiquement par le resize ne sont justement //pas "interessant" int _storage_end; int _size; }; template <class _T> Vector<_T>::Vector(int s) { data = NULL; resize(s); _storage_end = 0; } template <class _T> void Vector<_T>::resize (int s) { if(s>_size) { data = (_T*)realloc(data, sizeof(_T)*(_size+s)); } else if (s<_size) { //on supprimer des elements. for (int i=0;i<_size-s;i++) { //on verifie que storage_end ne depasse pas la taille du vecteur if(_storage_end > s+i) _storage_end = s+i; } } _size = s; } template <class _T> void Vector<_T>::push_back (_T obj) { //doit-on allouer de la memoire ? if(_storage_end >= _size) { resize(_size+RESERVE_RATIO); } *(data + _storage_end) = obj; _storage_end++; } template <class _T> int Vector<_T>::size() { return _size; } template <class _T> _T Vector<_T>::at(int i) { if(i>=_size) { std::cerr << "[TSTL]Vector::at(), Erreur, index excede la taille du vecteur" << std::endl; } return *(data+i); } template <class _T> void Vector<_T>::clear() { resize (0); std::cout << _storage_end << std::endl; } } #endif |
|
From: julien r. <jul...@us...> - 2004-11-30 15:21:24
|
Update of /cvsroot/epfl/tgengine-0.1/tg_stl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6245/tg_stl Log Message: Directory /cvsroot/epfl/tgengine-0.1/tg_stl added to the repository |
|
From: Seb <whi...@us...> - 2004-11-29 17:30:13
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8210 Modified Files: soundmanager.cc soundnode.cc soundnode.h Log Message: ifdef en plus Index: soundnode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundnode.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** soundnode.h 20 Nov 2004 08:38:25 -0000 1.1 --- soundnode.h 29 Nov 2004 17:29:50 -0000 1.2 *************** *** 22,26 **** string GetSoundNodeName() { return sNodeName; } ! void PreRender (float x) {}; private: --- 22,26 ---- string GetSoundNodeName() { return sNodeName; } ! void PreRender (float x); private: Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** soundmanager.cc 28 Nov 2004 09:18:36 -0000 1.23 --- soundmanager.cc 29 Nov 2004 17:29:49 -0000 1.24 *************** *** 686,692 **** break; ! /* case AL_INVALID_ENUM: return string("AL_INVALID_ENUM"); ! break; */ case AL_INVALID_VALUE: --- 686,694 ---- break; ! #ifdef TGOSX ! case AL_INVALID_ENUM: return string("AL_INVALID_ENUM"); ! break; ! #endif case AL_INVALID_VALUE: *************** *** 694,700 **** break; ! /* case AL_INVALID_OPERATION: return string("AL_INVALID_OPERATION"); ! break;*/ case AL_OUT_OF_MEMORY: --- 696,704 ---- break; ! #ifdef TGOSX ! case AL_INVALID_OPERATION: return string("AL_INVALID_OPERATION"); ! break; ! #endif case AL_OUT_OF_MEMORY: *************** *** 703,708 **** default: ! return string("UNKNOW_AL_ERROR"); ! break; }; } --- 707,712 ---- default: ! return string("UNKNOW_AL_ERROR"); ! break; }; } *************** *** 738,743 **** default: ! return string("UNKNOW_ALC_ERROR"); ! break; }; } --- 742,747 ---- default: ! return string("UNKNOW_ALC_ERROR"); ! break; }; } Index: soundnode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundnode.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soundnode.cc 23 Nov 2004 08:03:28 -0000 1.2 --- soundnode.cc 29 Nov 2004 17:29:50 -0000 1.3 *************** *** 16,26 **** pBBox->Move (v); ! vSpeed.x = 0.0; ! vSpeed.y = 0.0; ! vSpeed.z = 0.0; SoundManager::pSoundManager->SetSoundProperties(sNodeName,v,vSpeed); } } //END tg --- 16,30 ---- pBBox->Move (v); ! vSpeed.x = 1.0; ! vSpeed.y = 1.0; ! vSpeed.z = 1.0; SoundManager::pSoundManager->SetSoundProperties(sNodeName,v,vSpeed); } + void SoundNode::PreRender(float x) + { + } + } //END tg |
|
From: Gilles M. <kr...@us...> - 2004-11-28 09:19:49
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9148 Modified Files: soundmanager.cc Log Message: Modification du error handler pour que le code compile avec la libopenal sous Debian Linux. A priori certain symbole d'erreur ne sont pas défini dans notre version ! Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** soundmanager.cc 25 Nov 2004 18:21:43 -0000 1.22 --- soundmanager.cc 28 Nov 2004 09:18:36 -0000 1.23 *************** *** 686,700 **** 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: --- 686,700 ---- 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: |
|
From: Seb <whi...@us...> - 2004-11-25 18:22:47
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26720 Modified Files: game.cc Log Message: Modification de la mise a jour du listener (moins de variable) Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** game.cc 22 Nov 2004 21:18:44 -0000 1.38 --- game.cc 25 Nov 2004 18:22:37 -0000 1.39 *************** *** 138,143 **** void Game::PreFrame () { ! Camera* myCam = pSceneManager->GetCamera(); ! pSoundManager->UpdateListener(myCam); float t = pTimer->GetFrameInterval (); --- 138,142 ---- void Game::PreFrame () { ! pSoundManager->UpdateListener(pSceneManager->GetCamera()); float t = pTimer->GetFrameInterval (); |
|
From: Seb <whi...@us...> - 2004-11-25 18:21:54
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26366 Modified Files: soundmanager.cc Log Message: Desactivation complete du soundmanager avec -nosound dans la console En attendant de corriger le bug sous Linux. Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** soundmanager.cc 23 Nov 2004 08:03:28 -0000 1.21 --- soundmanager.cc 25 Nov 2004 18:21:43 -0000 1.22 *************** *** 137,141 **** alListenerfv(AL_ORIENTATION, ListenerOr); - } --- 137,140 ---- *************** *** 147,152 **** #endif ! pSoundManager->SetListenerPosition(ListenerCam->GetPosition()); ! pSoundManager->SetListenerOrientation(ListenerCam->GetForward(),ListenerCam->GetUp()); } --- 146,154 ---- #endif ! if(enable) ! { ! pSoundManager->SetListenerPosition(ListenerCam->GetPosition()); ! pSoundManager->SetListenerOrientation(ListenerCam->GetForward(),ListenerCam->GetUp()); ! } } *************** *** 590,596 **** bool SoundManager::CheckSound(string name) { ! if(SoundList[name] && SoundNodeList[name]) { ! if(enable) { return AL_TRUE; --- 592,598 ---- bool SoundManager::CheckSound(string name) { ! if(enable) { ! if(SoundList[name] && SoundNodeList[name]) { return AL_TRUE; *************** *** 598,601 **** --- 600,606 ---- else { + #ifdef SOUND_DEBUG + cerr << "[OpenAL] Sound " << name << " not loaded..." << endl; + #endif return AL_FALSE; } *************** *** 603,609 **** else { - #ifdef SOUND_DEBUG - cerr << "[OpenAL] Sound " << name << " not loaded..." << endl; - #endif return AL_FALSE; } --- 608,611 ---- |
|
From: julien r. <jul...@us...> - 2004-11-23 12:36:47
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30714 Modified Files: physicengine.cc Log Message: mouvements Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** physicengine.cc 23 Nov 2004 10:31:04 -0000 1.31 --- physicengine.cc 23 Nov 2004 12:36:26 -0000 1.32 *************** *** 8,12 **** { //pNodes.clear(); ! fOverBounce = 1.00f; Engine::pVarManager->AddVar("gravity", 800); --- 8,12 ---- { //pNodes.clear(); ! fOverBounce = 1.01f; Engine::pVarManager->AddVar("gravity", 800); *************** *** 52,56 **** { origin = trace.EndPoint; ! //iNumPlanes = 0; } if (trace.Fraction == 1) --- 52,56 ---- { origin = trace.EndPoint; ! iNumPlanes = 0; } if (trace.Fraction == 1) *************** *** 275,279 **** result.ColPlane = mapResult.ColPlane; //on trace sur les objets ! Vector3 colPoint(0,0,0); Vector3 colNormal(0,0,0); float d1, d2; --- 275,279 ---- result.ColPlane = mapResult.ColPlane; //on trace sur les objets ! /* Vector3 colPoint(0,0,0); Vector3 colNormal(0,0,0); float d1, d2; *************** *** 297,301 **** } } ! return result; } --- 297,301 ---- } } ! */ return result; } |
|
From: julien r. <jul...@us...> - 2004-11-23 10:31:14
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29872 Modified Files: physicengine.cc q3bsp.cc Log Message: bug dans les déplacements Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** physicengine.cc 22 Nov 2004 21:19:07 -0000 1.30 --- physicengine.cc 23 Nov 2004 10:31:04 -0000 1.31 *************** *** 165,176 **** vUpNewPos = trace.EndPoint; ! if (updist > dist) //on passe l'obstacle { n->SetPosition(vUpNewPos); } else //l'obstacle est trop haut ! { n->SetPosition(vNewPos); ! } //Classification de la position --- 165,176 ---- vUpNewPos = trace.EndPoint; ! /*if (updist > dist) //on passe l'obstacle { n->SetPosition(vUpNewPos); } else //l'obstacle est trop haut ! {*/ n->SetPosition(vNewPos); ! //} //Classification de la position Index: q3bsp.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.cc,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** q3bsp.cc 22 Nov 2004 21:19:07 -0000 1.16 --- q3bsp.cc 23 Nov 2004 10:31:04 -0000 1.17 *************** *** 1168,1172 **** //BEGIN NORMALs ! glBegin (GL_LINES); Vector3 norm = pFace->plane.vNormal; Vector3 v1 = pFace->plane.v[0]+pFace->plane.v[1]+pFace->plane.v[2]; --- 1168,1172 ---- //BEGIN NORMALs ! /*glBegin (GL_LINES); Vector3 norm = pFace->plane.vNormal; Vector3 v1 = pFace->plane.v[0]+pFace->plane.v[1]+pFace->plane.v[2]; *************** *** 1175,1179 **** glVertex3fv(&v1.x); glVertex3fv(&v2.x); ! glEnd (); //END NORMALS --- 1175,1179 ---- glVertex3fv(&v1.x); glVertex3fv(&v2.x); ! glEnd ();*/ //END NORMALS |
|
From: Seb <whi...@us...> - 2004-11-23 08:03:53
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29094 Modified Files: soundmanager.cc soundmanager.h soundnode.cc Log Message: Utilisation de Vector3 au lieu de float Modifications pour correction du bug des rockets. Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** soundmanager.cc 22 Nov 2004 18:06:41 -0000 1.20 --- soundmanager.cc 23 Nov 2004 08:03:28 -0000 1.21 *************** *** 103,118 **** // Listener Position (player or camera) ! void SoundManager::SetListenerPosition(float x, float y, float z) { #ifdef SOUND_DEBUG ! //cout << "[OpenAL] SetListenerPosition (" << x/FACT << "," << y/FACT << "," << z/FACT << ")" << endl; #endif ! //set the position using 3 seperate floats ! alListener3f(AL_POSITION, x/FACT,y/FACT,z/FACT); } // Listener Orientation ! void SoundManager::SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz) { #ifdef SOUND_DEBUG --- 103,124 ---- // Listener Position (player or camera) ! void SoundManager::SetListenerPosition(Vector3 Position) { #ifdef SOUND_DEBUG ! //cout << "[OpenAL] SetListenerPosition (" << Position.x/FACT << "," << Position.y/FACT << "," << Position.z/FACT << ")" << endl; #endif ! //set the orientation using an array of floats ! ALfloat ListenerPos[3]; ! ! ListenerPos[0] = Position.x/FACT; ! ListenerPos[1] = Position.y/FACT; ! ListenerPos[2] = Position.z/FACT; ! ! alListenerfv(AL_POSITION, ListenerPos); } // Listener Orientation ! void SoundManager::SetListenerOrientation(Vector3 Forward, Vector3 Up) { #ifdef SOUND_DEBUG *************** *** 121,132 **** //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); } --- 127,140 ---- //set the orientation using an array of floats ! ALfloat ListenerOr[6]; ! ! ListenerOr[0] = Forward.x; ! ListenerOr[1] = Forward.y; ! ListenerOr[2] = Forward.z; ! ListenerOr[3] = Up.x; ! ListenerOr[4] = Up.y; ! ListenerOr[5] = Up.z; ! ! alListenerfv(AL_ORIENTATION, ListenerOr); } *************** *** 139,149 **** #endif ! Vector3 ListenerPosition = ListenerCam->GetPosition(); ! ! Vector3 ListenerForward = ListenerCam->GetForward(); ! Vector3 ListenerUp = ListenerCam->GetUp(); ! ! pSoundManager->SetListenerPosition(ListenerPosition.x,ListenerPosition.y,ListenerPosition.z); ! pSoundManager->SetListenerOrientation(ListenerForward.x,ListenerForward.y,ListenerForward.z,ListenerUp.x,ListenerUp.y,ListenerUp.z); } --- 147,152 ---- #endif ! pSoundManager->SetListenerPosition(ListenerCam->GetPosition()); ! pSoundManager->SetListenerOrientation(ListenerCam->GetForward(),ListenerCam->GetUp()); } *************** *** 493,497 **** // 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 --- 496,500 ---- // Sound properties (position and velocity) ! void SoundManager::SetSoundProperties(string name, Vector3 Position, Vector3 Velocity) { //set the sounds position and velocity *************** *** 499,507 **** { #ifdef SOUND_DEBUG ! cout << "[OpenAL] SetSoundProperties: " << name << "(" << x/FACT << "," << y/FACT << "," << z/FACT << ")" << endl; #endif ! alSource3f(SoundList[name],AL_POSITION,x/FACT,y/FACT,z/FACT); ! alSource3f(SoundList[name],AL_VELOCITY,vx,vy,vz); } } --- 502,523 ---- { #ifdef SOUND_DEBUG ! cout << "[OpenAL] SetSoundProperties: " << name << "(" << Position.x/FACT << "," << Position.y/FACT << "," << Position.z/FACT << ")" << endl; #endif + + //set the orientation using an array of floats + ALfloat ListenerPos[3]; + + ListenerPos[0] = Position.x/FACT; + ListenerPos[1] = Position.y/FACT; + ListenerPos[2] = Position.z/FACT; + + ALfloat ListenerVel[3]; + + ListenerVel[3] = Velocity.x; + ListenerVel[4] = Velocity.y; + ListenerVel[5] = Velocity.z; ! alSourcefv(SoundList[name],AL_POSITION,ListenerPos); ! alSourcefv(SoundList[name],AL_VELOCITY,ListenerVel); } } Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** soundmanager.h 22 Nov 2004 18:06:41 -0000 1.11 --- soundmanager.h 23 Nov 2004 08:03:28 -0000 1.12 *************** *** 58,65 **** 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 UpdateListener(Camera* ListenerCam); --- 58,65 ---- void SetSoundVolume(string name, float x); ! void SetSoundProperties(string name, Vector3 Position, Vector3 Velocity); ! void SetListenerPosition(Vector3 Position); ! void SetListenerOrientation(Vector3 Forward, Vector3 Up); void UpdateListener(Camera* ListenerCam); Index: soundnode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundnode.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** soundnode.cc 20 Nov 2004 08:38:25 -0000 1.1 --- soundnode.cc 23 Nov 2004 08:03:28 -0000 1.2 *************** *** 16,20 **** pBBox->Move (v); ! SoundManager::pSoundManager->SetSoundProperties(sNodeName,v.x,v.y,v.z,0.0,0.0,0.0); } --- 16,24 ---- pBBox->Move (v); ! vSpeed.x = 0.0; ! vSpeed.y = 0.0; ! vSpeed.z = 0.0; ! ! SoundManager::pSoundManager->SetSoundProperties(sNodeName,v,vSpeed); } |
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25577 Modified Files: Changelog glrenderer.cc md5instance.cc md5mesh10.cc md5mesh10.h physicengine.cc physicengine.h plane.cc q3bsp.cc q3bsp.h Log Message: bgfixes ! Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** physicengine.cc 19 Nov 2004 18:54:42 -0000 1.29 --- physicengine.cc 22 Nov 2004 21:19:07 -0000 1.30 *************** *** 16,20 **** } ! #define MAXBUMPS 10 void PhysicEngine::StepSlideMove(PhysicNode* n, float eTime, Vector3& vVelocity, Vector3 origin) --- 16,20 ---- } ! #define MAX_CLIP_PLANES 6 void PhysicEngine::StepSlideMove(PhysicNode* n, float eTime, Vector3& vVelocity, Vector3 origin) *************** *** 24,29 **** int bumpcount = 0; //Vector3 origin = n->pBBox->vWorldOrigin; ! std::vector<Vector3> pPlanes; int iNumPlanes = 0; float time_left = eTime; --- 24,30 ---- int bumpcount = 0; //Vector3 origin = n->pBBox->vWorldOrigin; ! Plane pPlanes[5]; int iNumPlanes = 0; + Vector3 primal_velocity = vVelocity; float time_left = eTime; *************** *** 31,41 **** int i, j; ! ! while ((trace.Fraction < (1.0f - EPSILON)) && (bumpcount < MAXBUMPS)) //a chaque fois qu'on rencontre un plan, on relance un trace avec comme origine le Endpoint sur le plan précédent et on ajuste la vitesse de notre objet. MAXBUMPS permet simplement d'éviter des boucles infinies { //trace = pLevel->CheckRayMove(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax); trace = Trace(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax, n); ! //on trace avec une sphere, les mouvements sembles plus 'lisses' //trace = pLevel->CheckRayMove(origin+n->GetBBox()->vBSCenter, origin+n->GetBBox()->vBSCenter+vVelocity*time_left, TRACE_SPHERE, n->GetBBox()->fBSRadius); --- 32,42 ---- int i, j; ! ! for (bumpcount=0; bumpcount<8;bumpcount++) //a chaque fois qu'on rencontre un plan, on relance un trace avec comme origine le Endpoint sur le plan précédent et on ajuste la vitesse de notre objet. MAXBUMPS permet simplement d'éviter des boucles infinies { //trace = pLevel->CheckRayMove(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax); trace = Trace(origin, origin+vVelocity*time_left, n->GetBBox()->vMin, n->GetBBox()->vMax, n); ! //on trace avec une sphere, les mouvements semblent plus 'lisses' //trace = pLevel->CheckRayMove(origin+n->GetBBox()->vBSCenter, origin+n->GetBBox()->vBSCenter+vVelocity*time_left, TRACE_SPHERE, n->GetBBox()->fBSRadius); *************** *** 48,54 **** return; } ! if (trace.Fraction > 0 ) { origin = trace.EndPoint; } if (trace.Fraction == 1) --- 49,56 ---- return; } ! if (trace.Fraction > EPSILON ) { origin = trace.EndPoint; + //iNumPlanes = 0; } if (trace.Fraction == 1) *************** *** 58,72 **** time_left -= time_left*trace.Fraction; ! pPlanes.push_back(trace.Normal); iNumPlanes++; for (i=0; i<iNumPlanes; i++) { ! ClipVelocity (vVelocity, trace.Normal); for (j=0; j<iNumPlanes; j++) if (j != i) { ! if (vVelocity*pPlanes[j] < 0) break; } --- 60,81 ---- time_left -= time_left*trace.Fraction; + + if (iNumPlanes >= MAX_CLIP_PLANES) + { + std::cerr << "[TGE] iNumPlanes >= MAX_CLIP_PLANES" << std::endl; + vVelocity.Set(0,0,0); + break; + } ! pPlanes[iNumPlanes] = Plane(trace.Normal, trace.ColPlane.fD); iNumPlanes++; for (i=0; i<iNumPlanes; i++) { ! ClipVelocity (vVelocity, pPlanes[i].vNormal); for (j=0; j<iNumPlanes; j++) if (j != i) { ! if (vVelocity*pPlanes[j].vNormal < 0) break; } *************** *** 82,95 **** if (iNumPlanes != 2) { ! vVelocity = origin; break; } ! Vector3 dir = pPlanes[0]%pPlanes[1]; float d = dir*vVelocity; vVelocity = dir/d; } ! ! ! bumpcount++; } } --- 91,106 ---- if (iNumPlanes != 2) { ! vVelocity.Set(0,0,0); break; } ! Vector3 dir = pPlanes[0].vNormal%pPlanes[1].vNormal; float d = dir*vVelocity; vVelocity = dir/d; } ! ! if ((primal_velocity*vVelocity) <= 0) ! { ! vVelocity = Vector3::ZERO; ! } } } *************** *** 107,110 **** --- 118,128 ---- Vector3 change = norm*backoff; vel -= change; + #define STOP_EPSILON 0.1 + if (vel.x > -STOP_EPSILON && vel.x < STOP_EPSILON) + vel.x = 0; + if (vel.y > -STOP_EPSILON && vel.y < STOP_EPSILON) + vel.y = 0; + if (vel.z > -STOP_EPSILON && vel.z < STOP_EPSILON) + vel.z = 0; } *************** *** 200,203 **** --- 218,222 ---- //on a un objet qui doit subir les forces et les collisions + /* if (n->GetGravityFactor() > EPSILON) //on évite de s'amuser si l'objet se fout de la gravité { *************** *** 214,218 **** //std::cout << n->GetVelocity() << std::endl; n->SetVelocity(vVelocity); ! } //mise a jour des volumes englobants n->CalculateBoundingVolume(); --- 233,237 ---- //std::cout << n->GetVelocity() << std::endl; n->SetVelocity(vVelocity); ! }*/ //mise a jour des volumes englobants n->CalculateBoundingVolume(); *************** *** 254,257 **** --- 273,277 ---- result.Fraction = mapResult.Fraction; result.AllSolid = mapResult.AllSolid; + result.ColPlane = mapResult.ColPlane; //on trace sur les objets Vector3 colPoint(0,0,0); Index: q3bsp.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** q3bsp.cc 17 Nov 2004 23:12:39 -0000 1.15 --- q3bsp.cc 22 Nov 2004 21:19:07 -0000 1.16 *************** *** 8,11 **** --- 8,81 ---- { + /*bool Q3Bsp::IsPolygonInside (BspPolygonFace* pof,BoundingBox* pBBox ) + { + for (int k=0; k<6; k++) + { + bool out=true; + for (int l=0; l<pof->numOfVerts; l++) + { + if(pBBox->pPlanes[k].ClassifyPoint(pVerts[pof->startVertIndex+l].vPosition) != POINT_BEHIND_PLANE) + { + out = false; + break; + } + } + if (out) + return false; + } + return true; + } + + Vector3 Q3Bsp::CalculateCollision(BoundingBox* pBBox, Vector3 pos) + { + bool* pVisibleFaces = new bool[numOfFaces]; + memset (pVisibleFaces, 0, sizeof(bool)*numOfFaces); + + //std::cout << "pos : " << pos << "\tvWorldBSCenter :" << pBBox->vWorldBSCenter << "\tvBSCenter :" << pBBox->vBSCenter << std::endl; + Vector3 vNewPosition = pos; + + int iLeaf = FindLeaf(vNewPosition); + int iCluster = pLeafs[iLeaf].cluster; + + + for (int i=0; i<numOfLeafs; i++) + { + if (!IsClusterVisible(iCluster, pLeafs[i].cluster)) + continue; + //TODO:on devrait tester si la BoundingBox du leaf est dans notre bounding box + for (int j=0; j<pLeafs[i].numOfLeafFaces; j++) + pVisibleFaces[pLeafFaces[pLeafs[i].leafface+j]] = true; + } + + for (int i=0; i<numOfFaces; i++) + { + float distance, distanceOver; + BspPolygonFace* pof; + bool c; + if (!pVisibleFaces[i]) + continue; + switch (pDirectory[i].type) + { + case PolygonFace: + c=true; + pof = &pPolygonFaces[pDirectory[i].typeIndex]; + + if (IsPolygonInside(pof, pBBox)) + { + distance = pof->plane.GetDistance(vNewPosition); + std::cout << "Polygon distance : " << distance << std::endl; + distanceOver = pBBox->fBSRadius-distance; + if (distanceOver > 0) + vNewPosition+=distanceOver*pof->plane.vNormal; + } + break; + + default: + break; + + } + } + return vNewPosition; + }*/ void Q3Bsp::TesselateBiquadraticPatch (BspVertex* controlPoints, BspVertex* vertices, int tess) *************** *** 378,381 **** --- 448,455 ---- Vector3 vMin (-TG_INFINITY, -TG_INFINITY, -TG_INFINITY); Vector3 vMax (TG_INFINITY, TG_INFINITY, TG_INFINITY); + Vector3 points[3]; + points[0] = pVertices[pof->startVertIndex].vPosition; + points[1] = pVertices[pof->startVertIndex+1].vPosition; + points[2] = pVertices[pof->startVertIndex+2].vPosition; for (int j=pof->startVertIndex; j < pof->startVertIndex + pof->numOfVerts; j++) *************** *** 392,398 **** } pof->vCenter /= pof->numOfVerts; ! ! ! polyCount++; } --- 466,471 ---- } pof->vCenter /= pof->numOfVerts; ! ! pof->plane.SetFromPoints(points[0], points[2], points[1]); polyCount++; } *************** *** 521,525 **** for (int i=0; i<numOfPlanes; i++) { ! SWAPFLOAT(pPlanes[i].d) SWAPFLOAT(pPlanes[i].vNormal.x) SWAPFLOAT(pPlanes[i].vNormal.y) --- 594,598 ---- for (int i=0; i<numOfPlanes; i++) { ! SWAPFLOAT(pPlanes[i].fD) SWAPFLOAT(pPlanes[i].vNormal.x) SWAPFLOAT(pPlanes[i].vNormal.y) *************** *** 793,797 **** //on calcule la distance pos - plan et on regarde si on est devant ou derriere le plan ! if (plane.vNormal*pos - plane.d >= 0) index = node.front; else --- 866,870 ---- //on calcule la distance pos - plan et on regarde si on est devant ou derriere le plan ! if (plane.vNormal*pos - plane.fD >= 0) index = node.front; else *************** *** 1093,1096 **** --- 1166,1181 ---- //glDrawArrays(GL_TRIANGLE_FAN, pFace->startVertIndex, pFace->numOfVerts); glDrawElements (GL_TRIANGLES, pFace->numOfMeshVerts, GL_UNSIGNED_INT, &pMeshIndices[pFace->firstMeshIndex]); + + //BEGIN NORMALs + glBegin (GL_LINES); + Vector3 norm = pFace->plane.vNormal; + Vector3 v1 = pFace->plane.v[0]+pFace->plane.v[1]+pFace->plane.v[2]; + v1 /= 3; + Vector3 v2 = v1+norm*50; + glVertex3fv(&v1.x); + glVertex3fv(&v2.x); + glEnd (); + //END NORMALS + continue; } *************** *** 1266,1271 **** BspPlane *plane = &pPlanes[node->plane]; ! float startDistance = plane->vNormal*Start - plane->d; ! float endDistance = plane->vNormal*End - plane->d; float offset; --- 1351,1356 ---- BspPlane *plane = &pPlanes[node->plane]; ! float startDistance = plane->vNormal*Start - plane->fD; ! float endDistance = plane->vNormal*End - plane->fD; float offset; *************** *** 1370,1373 **** --- 1455,1459 ---- Vector3 CandidateToHitNormal; + Plane CandidateToHitPlane; // Go for every brush side *************** *** 1381,1391 **** if (traceType == TRACE_RAY) { ! startDistance = (MStart*plane->vNormal) - plane->d; ! endDistance = ( MEnd*plane->vNormal) - plane->d; } else if (traceType == TRACE_SPHERE) { ! startDistance = (MStart*plane->vNormal) - (plane->d + radius); ! endDistance = (MEnd*plane->vNormal) - (plane->d + radius); } else if (traceType == TRACE_BOX) --- 1467,1477 ---- if (traceType == TRACE_RAY) { ! startDistance = (MStart*plane->vNormal) - plane->fD; ! endDistance = ( MEnd*plane->vNormal) - plane->fD; } else if (traceType == TRACE_SPHERE) { ! startDistance = (MStart*plane->vNormal) - (plane->fD + radius); ! endDistance = (MEnd*plane->vNormal) - (plane->fD + radius); } else if (traceType == TRACE_BOX) *************** *** 1395,1400 **** offset.y = plane->vNormal.y < 0 ? vBoxMax.y : vBoxMin.y; offset.z = plane->vNormal.z < 0 ? vBoxMax.z : vBoxMin.z; ! startDistance = (MStart+offset)*plane->vNormal - plane->d; ! endDistance = (MEnd+offset)*plane->vNormal - plane->d; } --- 1481,1486 ---- offset.y = plane->vNormal.y < 0 ? vBoxMax.y : vBoxMin.y; offset.z = plane->vNormal.z < 0 ? vBoxMax.z : vBoxMin.z; ! startDistance = (MStart+offset)*plane->vNormal - plane->fD; ! endDistance = (MEnd+offset)*plane->vNormal - plane->fD; } *************** *** 1428,1431 **** --- 1514,1518 ---- startFraction = fraction; CandidateToHitNormal = plane->vNormal; + CandidateToHitPlane = Plane(plane->vNormal, plane->fD); } } *************** *** 1465,1468 **** --- 1552,1556 ---- result.Fraction = startFraction; result.CollisionNormal = CandidateToHitNormal; // The candidate gets postulate! + result.ColPlane = CandidateToHitPlane; } } Index: q3bsp.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** q3bsp.h 17 Nov 2004 23:12:39 -0000 1.7 --- q3bsp.h 22 Nov 2004 21:19:07 -0000 1.8 *************** *** 26,29 **** --- 26,30 ---- bool StartOut; bool AllSolid; + Plane ColPlane; }; *************** *** 39,42 **** --- 40,44 ---- { protected: + //BEGIN STRUCT enum BspFaceType *************** *** 110,114 **** { Vector3 vNormal; ! float d; }; --- 112,116 ---- { Vector3 vNormal; ! float fD; }; *************** *** 180,183 **** --- 182,186 ---- int firstMeshIndex; int numOfMeshVerts; + Plane plane; }; *************** *** 384,388 **** int* bLightMaps; int* iBump; ! public: Q3Bsp (); --- 387,392 ---- int* bLightMaps; int* iBump; ! ! public: Q3Bsp (); Index: md5mesh10.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5mesh10.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** md5mesh10.h 19 Nov 2004 12:04:04 -0000 1.8 --- md5mesh10.h 22 Nov 2004 21:19:07 -0000 1.9 *************** *** 66,71 **** inline int anim_GetNumJoints(int i) { return pAnimations[i].iNumJoints; } inline int anim_GetFrameRate(int i) { return pAnimations[i].iFrameRate; } ! inline int anim_GetNumAnimatedComponents(int i) { return pAnimations[i].iNumAnimatedComponents; } ! inline float anim_GetFrameElement (int i, int j, int k) { return pAnimations[i].pFrames[j][k]; } inline BoundingBox* anim_GetBBox(int i,int j) { return &pAnimations[i].pBBox[j]; } inline int anim_joint_GetParent (int i, int j) { return pAnimations[i].pJointInfos[j].iParent; } --- 66,74 ---- inline int anim_GetNumJoints(int i) { return pAnimations[i].iNumJoints; } inline int anim_GetFrameRate(int i) { return pAnimations[i].iFrameRate; } ! inline Quaternion anim_GetQuaternion (int i, int j, int k) { return pAnimations[i].pQuaternions[j][k]; } ! inline Vector3 anim_GetPosition (int i, int j, int k) { return pAnimations[i].pPositions[j][k]; } ! ! //inline int anim_GetNumAnimatedComponents(int i) { return pAnimations[i].iNumAnimatedComponents; } ! //inline float anim_GetFrameElement (int i, int j, int k) { return pAnimations[i].pFrames[j][k]; } inline BoundingBox* anim_GetBBox(int i,int j) { return &pAnimations[i].pBBox[j]; } inline int anim_joint_GetParent (int i, int j) { return pAnimations[i].pJointInfos[j].iParent; } *************** *** 80,84 **** inline int anim_joint_GetStartIndex (int i, int j) { return pAnimations[i].pJointInfos[j].iStartIndex; } ! inline float anim_joint_GetBaseFrameElement (int i, int j, int k) { return pAnimations[i].pBaseFrame[j][k]; } protected: --- 83,87 ---- inline int anim_joint_GetStartIndex (int i, int j) { return pAnimations[i].pJointInfos[j].iStartIndex; } ! //inline float anim_joint_GetBaseFrameElement (int i, int j, int k) { return pAnimations[i].pBaseFrame[j][k]; } protected: *************** *** 122,126 **** int iFrameRate; int iNumAnimatedComponents; ! float** pFrames; //un tableau de [iNumFrames][iNumAnimatedComponents] float** pBaseFrame; //un tableau de [iNumJoints][6], stockant, dans l'ordre, Tx, Ty, Tz, Qx, Qy, Qz a la frame de base de l'animation struct _MD5JointInfos --- 125,131 ---- int iFrameRate; int iNumAnimatedComponents; ! //float** pFrames; //un tableau de [iNumFrames][iNumAnimatedComponents] ! Quaternion** pQuaternions; //un tableau de [iNumFrames][iNumJoints] Qx,Qy,Qz ! Vector3** pPositions; //un tableau de [iNumFrames][iNumJoints] Tx,Ty,Tz float** pBaseFrame; //un tableau de [iNumJoints][6], stockant, dans l'ordre, Tx, Ty, Tz, Qx, Qy, Qz a la frame de base de l'animation struct _MD5JointInfos *************** *** 186,195 **** }; - void ChangeCoords(Vector3& v) - { - float temp = v.y; - v.y = v.z; - v.z = -temp; - } }; --- 191,194 ---- Index: glrenderer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.cc,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** glrenderer.cc 19 Nov 2004 18:54:42 -0000 1.23 --- glrenderer.cc 22 Nov 2004 21:19:07 -0000 1.24 *************** *** 1224,1228 **** #endif //les axes sont inverses dans les trucs ID ! glRotatef(-90, 1, 0, 0); _RotateNode(mesh); --- 1224,1228 ---- #endif //les axes sont inverses dans les trucs ID ! // glRotatef(-90, 1, 0, 0); _RotateNode(mesh); Index: physicengine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** physicengine.h 17 Nov 2004 23:12:39 -0000 1.9 --- physicengine.h 22 Nov 2004 21:19:07 -0000 1.10 *************** *** 19,22 **** --- 19,23 ---- //le node qui a ete touche. NULL si c'est la carte qui est touche ou si rien n'est touche PhysicNode* pNode; + Plane ColPlane; }; *************** *** 54,57 **** --- 55,59 ---- protected: void _TryToStep (PhysicNode*, float); + std::vector<PhysicNode*> pNodes; Index: Changelog =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Changelog,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Changelog 17 Nov 2004 23:12:37 -0000 1.6 --- Changelog 22 Nov 2004 21:19:06 -0000 1.7 *************** *** 1,13 **** --------------- 27 septembre 2004 --------------- ! Krtek ! * code cleaning (plus de warnings à la compilation) ! * modification des Makefile Silver: ! * le moteur physique tente de faire monter les petits obstacles ! (escaliers & autres) ! * code cleaning --------------- --- 1,86 ---- --------------- + 20 novembre 2004 + --------------- + Seb: + * SoundManager Changelog + --------------- + 11 novembre 2004 + --------------- + Silver: + * Ajout d'une classe de capture vidéo. Rajouter le flag -DTGVIDEO pour avoir un video.mpg en sortie :) (pris sur le code de Engine_0.2 de www.frustum.org ) + + Seb: + * Sortie video portee sur OSX + --------------- + 10 novembre 2004 + --------------- + Silver: + * Pas mal de deverminage dans les collisions et ailleurs + --------------- + 2 novembre 2004 + --------------- + Silver: + * Animations des MD5 + --------------- + 30 octobre 2004 + --------------- + Silver: + * Camera utilisant les quaternions qui fonctionne. + --------------- + 28 octobre 2004 + --------------- + Silver: + * Rotations utilisant les quaternions + --------------- + 24 octobre 2004 + --------------- + Silver: + * Rajout d'une fonction ToAngleVectors dans Vector3, qui considère les composants x,y,z comme des rotations autour de x,y,z et les transforme en vecteurs forward, right, up. + * Quelques bugs supprimées, notamment dans la gestion des rotations + --------------- + 21 octobre 2004 + --------------- + Silver: + * Refonte de la gestion de la hiérarchie physique. Ajoute de PhysicNode + * Changement dans la manière d'enregistrer des fonctions auprès de la console + * Suppression d'un bug lors de l'affichage de niveau non-originaux pour q3 (notamment pas mal de niveau Defrag) + --------------- + 15 octobre 2004 + --------------- + Silver: + * Ajout de classes "interceptant" les messages de cout/cerr de façon à les rediriger vers la console/fichier/terminal + * Nettoyage du code, ajout d'accesseurs + --------------- + 13 octobre 2004 + --------------- + Seb: + * SoundManager Changelog + --------------- + 10 octobre 2004 + --------------- + Silver: + * Ajout des PhysicCallBack, mécanisme qui permet d'appeler des fonctions membres de classes héritant de PhysicCallBack lorsqu'un objet entre en collision avec la map ou un autre objet. + * Quelques modifs pour permettre à l'IA de savoir si une région de la map est accessible ou pas (Q3Bsp::FindCluster) + --------------- + 28 septembre 2004 + --------------- + Silver: + * Portage Win32 (compile sur OSX aussi) + -------------- 27 septembre 2004 --------------- ! Seb: ! * beaucoup de bugs réglés pour la version OSX -> version actuellement sur le cvs compile et se lance sous osx, mais aussi Linux ! (voir screenshots) ! ! Krtek: ! * code cleaning (plus de warnings à la compilation) ! * modification des Makefile (ajout des target : linux, linuxDebug, mac et macDebug) Silver: ! * le moteur physique tente de faire monter les petits obstacles ! (escaliers & autres) ! * code cleaning ! * affichage des fps ! * chargement jpg et png --------------- *************** *** 15,19 **** --------------- Silver: ! * gestion little/big endian via des classes LittleEndian/BigEndian (fichier endian.h) --- 88,92 ---- --------------- Silver: ! * gestion little/big endian via des classes LittleEndian/BigEndian (fichier endian.h) *************** *** 22,27 **** --------------- Silver: ! * update du cvs avec les dernieres sources ! * en vrac, support du bsp, des md5 version 10 (finale) de doom3 --------------- --- 95,100 ---- --------------- Silver: ! * update du cvs avec les dernieres sources ! * en vrac, support du bsp, des md5 version 10 (finale) de doom3 --------------- *************** *** 29,39 **** --------------- Silver ! * ajout d'un TextureManager. Evite qu'il y ait plusieurs fois la même texture chargée en mémoire. De même, si ! ladite texture ne peut pas être chargée, met une texture blanche à la place ! ! * debut du projet ! * support des textures au format TGA et BMP ! * support du MD5 (DOOM III) ! * support du dot3 bump-mapping ! * debut du support pour gui --- 102,111 ---- --------------- Silver ! * ajout d'un TextureManager. Evite qu'il y ait plusieurs fois la même texture chargée en mémoire. De même, si ! ladite texture ne peut pas être chargée, met une texture blanche à la place + * debut du projet + * support des textures au format TGA et BMP + * support du MD5 (DOOM III) + * support du dot3 bump-mapping + * debut du support pour gui Index: md5mesh10.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5mesh10.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** md5mesh10.cc 19 Nov 2004 12:04:04 -0000 1.9 --- md5mesh10.cc 22 Nov 2004 21:19:07 -0000 1.10 *************** *** 29,35 **** for (int j=0; j<pAnimations[i].iNumFrames; j++) ! delete [] pAnimations[i].pFrames[j]; ! delete [] pAnimations[i].pFrames; ! } pAnimations.clear(); --- 29,38 ---- for (int j=0; j<pAnimations[i].iNumFrames; j++) ! { ! delete [] pAnimations[i].pQuaternions[j]; ! delete [] pAnimations[i].pPositions[j]; ! } ! delete [] pAnimations[i].pQuaternions; ! delete [] pAnimations[i].pPositions; } pAnimations.clear(); *************** *** 89,104 **** pFD >> pJoints[i].vPosition.x >> pJoints[i].vPosition.y >> pJoints[i].vPosition.z; ! //Util::ChangeCoords(pJoints[i].vPosition); ! //ChangeCoords(pJoints[i].vPosition); NEXT(")") NEXT("(") pFD >> q.x >> q.y >> q.z; ! //Util::ChangeCoords(q.x, q.y, q.z); q.ComputeR(); pJoints[i].qOrientation = q; - //Util::QuaternionToMatrix33(q,pJoints[i].mOrientation); } pMeshes = new _MD5Mesh[iNumMeshes]; --- 92,105 ---- pFD >> pJoints[i].vPosition.x >> pJoints[i].vPosition.y >> pJoints[i].vPosition.z; ! Util::ChangeCoords(pJoints[i].vPosition); NEXT(")") NEXT("(") pFD >> q.x >> q.y >> q.z; ! Util::ChangeCoords(q.x, q.y, q.z); q.ComputeR(); pJoints[i].qOrientation = q; } pMeshes = new _MD5Mesh[iNumMeshes]; *************** *** 177,181 **** NEXT("(") pFD >> w.vWeights.x >> w.vWeights.y >> w.vWeights.z; ! //Util::ChangeCoords(w.vWeights); } } --- 178,182 ---- NEXT("(") pFD >> w.vWeights.x >> w.vWeights.y >> w.vWeights.z; ! Util::ChangeCoords(w.vWeights); } } *************** *** 228,235 **** NEXT("numAnimatedComponents") pFD >> anim.iNumAnimatedComponents; ! ! anim.pFrames = new float*[anim.iNumFrames]; for (int i=0; i<anim.iNumFrames; i++) ! anim.pFrames[i] = new float[anim.iNumAnimatedComponents]; anim.pJointInfos = new _MD5Anim::_MD5JointInfos[anim.iNumJoints]; --- 229,237 ---- NEXT("numAnimatedComponents") pFD >> anim.iNumAnimatedComponents; ! ! float** pFrames; ! pFrames = new float*[anim.iNumFrames]; for (int i=0; i<anim.iNumFrames; i++) ! pFrames[i] = new float[anim.iNumAnimatedComponents]; anim.pJointInfos = new _MD5Anim::_MD5JointInfos[anim.iNumJoints]; *************** *** 254,260 **** --- 256,264 ---- NEXT("(") pFD >> anim.pBBox[i].vMin.x >> anim.pBBox[i].vMin.y >> anim.pBBox[i].vMin.z; + Util::ChangeCoords(anim.pBBox[i].vMin); NEXT(")") NEXT("(") pFD >> anim.pBBox[i].vMax.x >> anim.pBBox[i].vMax.y >> anim.pBBox[i].vMax.z; + Util::ChangeCoords(anim.pBBox[i].vMax); NEXT(")") *************** *** 283,289 **** NEXT("{") for (int j=0; j<anim.iNumAnimatedComponents; j++) ! pFD >> anim.pFrames[i][j]; NEXT("}") } pAnimations.push_back(anim); std::cout << "[TGE] Chargement de " << str << " termine" << std::endl; --- 287,372 ---- NEXT("{") for (int j=0; j<anim.iNumAnimatedComponents; j++) ! pFD >> pFrames[i][j]; NEXT("}") } + + anim.pQuaternions = new Quaternion*[anim.iNumFrames]; + for (int i=0; i<anim.iNumFrames; i++) + anim.pQuaternions[i] = new Quaternion[anim.iNumJoints]; + + anim.pPositions = new Vector3*[anim.iNumFrames]; + for (int i=0; i<anim.iNumFrames; i++) + anim.pPositions[i] = new Vector3[anim.iNumJoints]; + + for (int i=0; i<anim.iNumFrames; i++) + for (int j=0; j<anim.iNumJoints; j++) + { + int n = anim.pJointInfos[j].iStartIndex; + int flags = anim.pJointInfos[j].iFlags; + + //Tx + if (flags & 1) + { + anim.pPositions[i][j].x = pFrames[i][n]; + n++; + } + else + anim.pPositions[i][j].x = anim.pBaseFrame[j][0]; + + //Ty + if (flags & 2) + { + anim.pPositions[i][j].y = pFrames[i][n]; + n++; + } + else + anim.pPositions[i][j].y = anim.pBaseFrame[j][1]; + + //Tz + if (flags & 4) + { + anim.pPositions[i][j].z = pFrames[i][n]; + n++; + } + else + anim.pPositions[i][j].z = anim.pBaseFrame[j][2]; + + //Qx + if (flags & 8) + { + anim.pQuaternions[i][j].x = pFrames[i][n]; + n++; + } + else + anim.pQuaternions[i][j].x = anim.pBaseFrame[j][3]; + + //Qy + if (flags & 16) + { + anim.pQuaternions[i][j].y = pFrames[i][n]; + n++; + } + else + anim.pQuaternions[i][j].y = anim.pBaseFrame[j][4]; + + //Qz + if (flags & 32) + { + anim.pQuaternions[i][j].z = pFrames[i][n]; + n++; + } + else + anim.pQuaternions[i][j].z = anim.pBaseFrame[j][5]; + + Util::ChangeCoords(anim.pQuaternions[i][j].x, anim.pQuaternions[i][j].y, anim.pQuaternions[i][j].z); + Util::ChangeCoords(anim.pPositions[i][j]); + anim.pQuaternions[i][j].ComputeR(); + + } + + for (int i=0; i<anim.iNumFrames; i++) + delete [] pFrames[i]; + delete [] pFrames; + pAnimations.push_back(anim); std::cout << "[TGE] Chargement de " << str << " termine" << std::endl; Index: md5instance.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5instance.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** md5instance.cc 19 Nov 2004 18:54:42 -0000 1.15 --- md5instance.cc 22 Nov 2004 21:19:07 -0000 1.16 *************** *** 228,327 **** void MD5Instance::_BuildBone (int iFrame, Joint* pJoint,const Quaternion& q, const Vector3& v) { ! /*pJoint->vPosition.x = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 0) + v.x; ! pJoint->vPosition.y = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 1) + v.y; ! pJoint->vPosition.z = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 2) + v.z; ! ! pJoint->qOrientation.x = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 3) + v.x; ! pJoint->qOrientation.y = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 4) + v.y; ! pJoint->qOrientation.z = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 5) + v.z; ! ! float term = 1.0f - (pJoint->qOrientation.x*pJoint->qOrientation.x) - (pJoint->qOrientation.y*pJoint->qOrientation.y) - (pJoint->qOrientation.z*pJoint->qOrientation.z); ! if (term < 0.0f) ! pJoint->qOrientation.r = 0.0f; ! else ! pJoint->qOrientation.r = - (float) sqrt(term); */ ! Vector3 animatedPosition; ! animatedPosition.x = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 0); ! animatedPosition.y = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 1); ! animatedPosition.z = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 2); ! ! Quaternion animatedOrientation; ! animatedOrientation.x = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 3); ! animatedOrientation.y = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 4); ! animatedOrientation.z = pData->anim_joint_GetBaseFrameElement(iCurrentAnimation, pJoint->iNumber, 5); ! ! ! int flags = pData->anim_joint_GetFlags(iCurrentAnimation, pJoint->iNumber); ! int n=0; ! int sIndex = pData->anim_joint_GetStartIndex(iCurrentAnimation, pJoint->iNumber); ! ! ! //glPushMatrix (); ! // std::cout << "flags : " << std::endl; ! //std::cout << "joint : " << pJoint->iNumber << std::endl; ! if (flags & 1) //Tx est anime ! { ! // std::cout << "Tx"; ! animatedPosition.x = pData->anim_GetFrameElement(iCurrentAnimation, iFrame, sIndex+n); ! n++; ! } ! if (flags & 2) //Ty est anime ! { ! // std::cout << " Ty"; ! animatedPosition.y = pData->anim_GetFrameElement(iCurrentAnimation, iFrame, sIndex+n); ! n++; ! } ! if (flags & 4) //Tz est anime ! { ! // std::cout << " Tz"; ! animatedPosition.z = pData->anim_GetFrameElement(iCurrentAnimation, iFrame, sIndex+n); ! n++; ! } ! if (flags & 8) //Qx est anime ! { ! // std::cout << " Qx"; ! animatedOrientation.x = pData->anim_GetFrameElement(iCurrentAnimation, iFrame, sIndex+n); ! n++; ! } ! if (flags & 16) //Qy est anime ! { ! // std::cout << " Qy"; ! animatedOrientation.y = pData->anim_GetFrameElement(iCurrentAnimation, iFrame, sIndex+n); ! n++; ! } ! if (flags & 32) //Qz est anime ! { ! // std::cout << " Qz"; ! animatedOrientation.z = pData->anim_GetFrameElement(iCurrentAnimation, iFrame, sIndex+n); ! n++; ! } ! //std::cout << std::endl; ! ! animatedOrientation.ComputeR(); ! if (pJoint->iParent < 0) //pas de parent ! { ! pJoint->vPosition = animatedPosition; ! pJoint->qOrientation = animatedOrientation; ! } ! else //parent ! { ! pJoint->vPosition = q.Rotate(animatedPosition); ! pJoint->vPosition += v; ! pJoint->qOrientation = q*animatedOrientation; ! } ! for (unsigned int i=0; i<pJoint->vNodes.size(); i++) ! { ! pJoint->vNodes[i]->SetPosition(vFinalPosition+pJoint->vPosition); ! pJoint->vNodes[i]->SetRotation(qFinalRotation*pJoint->qOrientation); ! } ! //std::cout << pJoint->vPosition << std::endl; ! for (int i = 0; i < pJoint->iNumChildrens; i++) ! { ! _BuildBone(iFrame,pJoint->pChildrens[i], pJoint->qOrientation, pJoint->vPosition); ! } - //glPopMatrix (); } void MD5Instance::SetAnimation (const std::string& name) --- 228,257 ---- void MD5Instance::_BuildBone (int iFrame, Joint* pJoint,const Quaternion& q, const Vector3& v) { ! Vector3 animatedPosition = pData->anim_GetPosition(iCurrentAnimation, iFrame, pJoint->iNumber); ! Quaternion animatedOrientation = pData->anim_GetQuaternion(iCurrentAnimation, iFrame, pJoint->iNumber); ! if (pJoint->iParent < 0) //pas de parent ! { ! pJoint->vPosition = animatedPosition; ! pJoint->qOrientation = animatedOrientation; ! } ! else //parent ! { ! pJoint->vPosition = q.Rotate(animatedPosition); ! pJoint->vPosition += v; ! pJoint->qOrientation = q*animatedOrientation; ! } ! for (unsigned int i=0; i<pJoint->vNodes.size(); i++) ! { ! pJoint->vNodes[i]->SetPosition(vFinalPosition+pJoint->vPosition); ! pJoint->vNodes[i]->SetRotation(qFinalRotation*pJoint->qOrientation); ! } ! //std::cout << pJoint->vPosition << std::endl; ! for (int i = 0; i < pJoint->iNumChildrens; i++) ! { ! _BuildBone(iFrame,pJoint->pChildrens[i], pJoint->qOrientation, pJoint->vPosition); ! } } void MD5Instance::SetAnimation (const std::string& name) Index: plane.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/plane.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** plane.cc 17 Nov 2004 23:12:39 -0000 1.3 --- plane.cc 22 Nov 2004 21:19:07 -0000 1.4 *************** *** 30,38 **** int Plane::ClassifyPoint (const Vector3& v) { ! float distance = v*vNormal + fD; ! if (distance > 0) return POINT_IN_FRONT_OF_PLANE; ! if (distance < 0) return POINT_BEHIND_PLANE; --- 30,38 ---- int Plane::ClassifyPoint (const Vector3& v) { ! float distance = GetDistance(v); ! if (distance > EPSILON) return POINT_IN_FRONT_OF_PLANE; ! if (distance < EPSILON) return POINT_BEHIND_PLANE; |