Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3041 Modified Files: Doxyfile base.cc base.h camera.cc console.cc console.h engine.cc engine.h function.h glrenderer.cc glrenderer.h glrenderernv15.cc guibutton.cc guicontainer.cc md5mesh10.cc physicengine.cc physicengine.h q3bsp.cc q3bsp.h renderer.h scenemanager.cc scenemanager.h scenenode.cc scenenode.h texture.cc texturemanager.cc Removed Files: cube.cc cube.h d3map.cc d3map.h log.cc log.h md2mesh.cc md2mesh.h md5mesh.cc md5mesh.h md5meshdata.cc md5meshdata.h modelloader.cc modelloader.h polyexplosion.cc polyexplosion.h positionallight.cc positionallight.h quad.cc Log Message: Beaucoup de changements : -pas mal de classes inutiles (md2, md5 version 6, autres trucs de debug) supprimées -refonte d'une bonne partie de la physique & gestion de la console Index: function.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/function.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** function.h 26 Sep 2004 13:15:24 -0000 1.1.1.1 --- function.h 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 10,15 **** { public: ! inline void operator () (const std::string& s) { return exec(s); } ! virtual void exec (const std::string& ) = 0; }; --- 10,15 ---- { public: ! inline void operator () (const std::string& s, int i) { return Exec(s,i); } ! virtual void Exec (const std::string&,int ) = 0; }; Index: Doxyfile =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Doxyfile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Doxyfile 26 Sep 2004 13:15:20 -0000 1.1.1.1 --- Doxyfile 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 1,4 **** - # Doxyfile 1.3.5-KDevelop - #--------------------------------------------------------------------------- # Project related configuration options --- 1,2 ---- *************** *** 25,29 **** INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO ! STRIP_FROM_PATH = /home/silver/Terminal_G33k/tgengine/ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO --- 23,27 ---- INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO ! STRIP_FROM_PATH = /home/silver/Terminal_G33k/tgengine-0.1/ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO *************** *** 75,79 **** # configuration options related to the input files #--------------------------------------------------------------------------- ! INPUT = /home/silver/Terminal_G33k/tgengine FILE_PATTERNS = *.c \ *.cc \ --- 73,77 ---- # configuration options related to the input files #--------------------------------------------------------------------------- ! INPUT = /home/silver/Terminal_G33k/tgengine-0.1 FILE_PATTERNS = *.c \ *.cc \ --- d3map.h DELETED --- Index: renderer.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/renderer.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** renderer.h 26 Sep 2004 13:15:14 -0000 1.1.1.1 --- renderer.h 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 6,11 **** #include "material.h" #include "particleemitter.h" - #include "cube.h" - #include "positionallight.h" #include "camera.h" #include "font.h" --- 6,9 ---- *************** *** 16,20 **** { ! class Renderer : public Base { public: --- 14,18 ---- { ! class Renderer : public Base, public Function { public: *************** *** 47,58 **** //virtual void BeginBump () = 0; //virtual void EndBump () = 0; ! class funcWireFrame: public Function { public: void exec (const std::string& s); ! } fWireFrame; virtual void Render2DImage (Image2D*) = 0; - virtual void SetPositionalLight (PositionalLight*) = 0; - virtual void ToggleBSDisplay () = 0; --- 45,63 ---- //virtual void BeginBump () = 0; //virtual void EndBump () = 0; + enum { + WIREFRAME=1, + }; ! void Exec (const std::string& s, int arg) { ! switch (arg) { ! case WIREFRAME: ToggleWireFrame(); break; ! default: break; ! } ! } ! ! void WireFrame (const std::string& s); virtual void Render2DImage (Image2D*) = 0; virtual void ToggleBSDisplay () = 0; --- md2mesh.cc DELETED --- --- md5mesh.cc DELETED --- Index: engine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/engine.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** engine.h 15 Oct 2004 13:08:33 -0000 1.3 --- engine.h 21 Oct 2004 21:18:28 -0000 1.4 *************** *** 38,41 **** --- 38,42 ---- #include "logbuffer.h" #include "errbuffer.h" + #include "meshmanager.h" namespace tg *************** *** 50,54 **** */ ! class Engine : public Base { public: --- 51,55 ---- */ ! class Engine : public Base, public Function { public: *************** *** 57,61 **** */ Engine (Timer* t); ! ~Engine (); //static Renderer* pRenderer; static GLRenderer* pRenderer; --- 58,62 ---- */ Engine (Timer* t); ! virtual ~Engine (); //static Renderer* pRenderer; static GLRenderer* pRenderer; *************** *** 64,67 **** --- 65,69 ---- static Console* pConsole; static Endian* pEndian; + static MeshManager* pMeshManager; //static TextureManager* pTextureManager; *************** *** 82,88 **** void ResizeScreen (int sW, int iH, bool fS=false, bool reinit=false); ! ! class funcResize: public Function { public: void exec (const std::string& s); ! } fResize; int* GetScreenWidth () { return &screenWidth; } --- 84,100 ---- void ResizeScreen (int sW, int iH, bool fS=false, bool reinit=false); ! ! enum { ! RESIZE=1 ! }; ! ! void Exec (const std::string& s, int arg) { ! switch(arg) { ! case RESIZE: Resize(s); break; ! default: break; ! } ! } ! ! void Resize(const std::string& s); int* GetScreenWidth () { return &screenWidth; } --- polyexplosion.cc DELETED --- Index: glrenderer.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** glrenderer.h 28 Sep 2004 09:44:26 -0000 1.2 --- glrenderer.h 21 Oct 2004 21:18:28 -0000 1.3 *************** *** 59,63 **** virtual void EndShadow (); virtual void RenderParticles (ParticleEmitter*); - virtual void SetPositionalLight (PositionalLight*); virtual void ToggleBSDisplay (); virtual void SetCamera (Camera* c) { pCamera = c; } --- 59,62 ---- *************** *** 103,109 **** GLuint iCellShader; //Debug ! std::vector <arrow*> arrows; ! ! PositionalLight* pLight; GLuint iShaderTexture; --- 102,106 ---- GLuint iCellShader; //Debug ! std::vector <arrow*> arrows; GLuint iShaderTexture; Index: base.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/base.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** base.h 26 Sep 2004 13:15:04 -0000 1.1.1.1 --- base.h 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 11,15 **** { public: - void Log( const char* msg, ...); }; --- 11,14 ---- Index: scenenode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scenenode.h 15 Oct 2004 13:59:04 -0000 1.3 --- scenenode.h 21 Oct 2004 21:18:28 -0000 1.4 *************** *** 17,30 **** { public: ! bool bNoClip; bool bIsCamera; ! bool bOnGround; SceneNode (); SceneNode (Vector3 p); ! void SetPhysicCallBack(PhysicCallBack*); ! inline PhysicCallBack* GetPhysicCallBack() { return pPhysicCallBack; } virtual ~SceneNode () {} virtual void PreRender (float ) = 0; /* Position */ --- 17,32 ---- { public: ! //bool bNoClip; bool bIsCamera; ! //bool bOnGround; SceneNode (); SceneNode (Vector3 p); ! //void SetPhysicCallBack(PhysicCallBack*); ! //inline PhysicCallBack* GetPhysicCallBack() { return pPhysicCallBack; } virtual ~SceneNode () {} virtual void PreRender (float ) = 0; + + inline BoundingBox* GetBBox () { return pBBox; } /* Position */ *************** *** 32,48 **** Vector3 GetPosition () { return vPosition; } - /* Acceleration */ - Vector3 GetAccel () { return vAccel; } - virtual void SetAccel (const Vector3& v) { vAccel = v; } - inline float GetXAccel () { return vAccel.x; } - inline float GetYAccel () { return vAccel.y; } - inline float GetZAccel () { return vAccel.z; } - inline void SetXAccel (float f) { vAccel.x = f; } - inline void SetYAccel (float f) { vAccel.y = f; } - inline void SetZAccel (float f) { vAccel.z = f; } - inline void AddXAccel (float f) { vAccel.x += f; } - inline void AddYAccel (float f) { vAccel.y += f; } - inline void AddZAccel (float f) { vAccel.z += f; } - /* Rotation */ Vector3 GetEuler () { return vEuler; } --- 34,37 ---- *************** *** 57,81 **** inline void AddYRot (float f) { vEuler.y += f; } inline void AddZRot (float f) { vEuler.z += f; } - - /* Vitesse */ - Vector3 GetVelocity () { return vVelocity; } - virtual void SetVelocity (const Vector3& v) { vVelocity = v; } - inline float GetXVelocity () { return vVelocity.x; } - inline float GetYVelocity () { return vVelocity.y; } - inline float GetZVelocity () { return vVelocity.z; } - inline void SetXVelocity (float f) { vVelocity.x = f; } - inline void SetYVelocity (float f) { vVelocity.y = f; } - inline void SetZVelocity (float f) { vVelocity.z = f; } - inline void AddXVelocity (float f) { vVelocity.x += f; } - inline void AddYVelocity (float f) { vVelocity.y += f; } - inline void AddZVelocity (float f) { vVelocity.z += f; } - /* Autres */ ! virtual void CalculateBoundingVolume (); virtual bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal); ! BoundingBox* pBBox; int iLeaf; --- 46,56 ---- inline void AddYRot (float f) { vEuler.y += f; } inline void AddZRot (float f) { vEuler.z += f; } /* Autres */ ! //virtual void CalculateBoundingVolume (); virtual bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal); ! //BoundingBox* pBBox; int iLeaf; *************** *** 83,93 **** float fTime; protected: ! PhysicCallBack* pPhysicCallBack; Vector3 vEuler; Vector3 vPosition; ! Vector3 vAccel; ! Vector3 vVelocity; ! }; --- 58,69 ---- float fTime; protected: ! //PhysicCallBack* pPhysicCallBack; Vector3 vEuler; Vector3 vPosition; ! ! BoundingBox* pBBox; ! //Vector3 vAccel; ! //Vector3 vVelocity; }; --- cube.h DELETED --- Index: q3bsp.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** q3bsp.cc 15 Oct 2004 13:59:04 -0000 1.7 --- q3bsp.cc 21 Oct 2004 21:18:28 -0000 1.8 *************** *** 239,253 **** #ifdef DEBUG ! std::cout << "nombre de vertices :\t" << numOfVerts << std::endl; ! std::cout << "nombre de faces :\t" << numOfFaces << std::endl; ! std::cout << "nombre de textures:\t" << numOfTextures << std::endl; ! std::cout << "nombre de nodes:\t" << numOfNodes << std::endl; ! std::cout << "nombre de leafs:\t" << numOfLeafs << std::endl; ! std::cout << "nombre de leaffaces:\t" << numOfLeafFaces << std::endl; ! std::cout << "nombre de plans:\t" << numOfPlanes << std::endl; ! std::cout << "nombre de leafbrushes:\t" << numOfLeafBrushes << std::endl; ! std::cout << "nombre de brushes:\t" << numOfBrushes << std::endl; ! std::cout << "nombre de brushsides:\t" << numOfBrushSides << std::endl; ! std::cout << "nombre de meshindices:\t" << numOfMeshIndices << std::endl; #endif --- 239,253 ---- #ifdef DEBUG ! std::cout << "[TGE] nombre de vertices :\t" << numOfVerts << std::endl; ! std::cout << "[TGE] nombre de faces :\t" << numOfFaces << std::endl; ! std::cout << "[TGE] nombre de textures:\t" << numOfTextures << std::endl; ! std::cout << "[TGE] nombre de nodes:\t" << numOfNodes << std::endl; ! std::cout << "[TGE] nombre de leafs:\t" << numOfLeafs << std::endl; ! std::cout << "[TGE] nombre de leaffaces:\t" << numOfLeafFaces << std::endl; ! std::cout << "[TGE] nombre de plans:\t" << numOfPlanes << std::endl; ! std::cout << "[TGE] nombre de leafbrushes:\t" << numOfLeafBrushes << std::endl; ! std::cout << "[TGE] nombre de brushes:\t" << numOfBrushes << std::endl; ! std::cout << "[TGE] nombre de brushsides:\t" << numOfBrushSides << std::endl; ! std::cout << "[TGE] nombre de meshindices:\t" << numOfMeshIndices << std::endl; #endif *************** *** 276,279 **** --- 276,280 ---- pVerts[i].vPosition.y /= MAPFACTOR; pVerts[i].vPosition.z /= MAPFACTOR; + //pVerts[i].vTextureCoord[0] = 1 - pVerts[i].vTextureCoord[0]; *************** *** 290,293 **** --- 291,295 ---- } + //positionement sur le debut de la section faces pFD.seekg(lumps[kFaces].offset); *************** *** 338,343 **** } ! std::cout << "nombre de patches:\t" << numOfPatches << std::endl; ! std::cout << "nombre de faces polygonales:\t" << numOfPolygonFaces << std::endl; pPatches = new BspPatch[numOfPatches]; --- 340,345 ---- } ! std::cout << "[TGE] nombre de patches:\t" << numOfPatches << std::endl; ! std::cout << "[TGE] nombre de faces polygonales:\t" << numOfPolygonFaces << std::endl; pPatches = new BspPatch[numOfPatches]; *************** *** 366,369 **** --- 368,373 ---- pof->numOfVerts = pFaces[i].numOfVerts; pof->lightmapID = pFaces[i].lightmapID; + pof->numOfMeshVerts = pFaces[i].numMeshVerts; + pof->firstMeshIndex = pFaces[i].meshVertIndex; //Calcul du centre et du "rayon" de la face *************** *** 581,585 **** //std::cout << "-------------------" << std::endl; numOfEntities = eCount; ! std::cout << "nombre d'entites:\t" << numOfEntities << std::endl; pEntities = new BspEntity[numOfEntities+1]; --- 585,589 ---- //std::cout << "-------------------" << std::endl; numOfEntities = eCount; ! std::cout << "[TGE] nombre d'entites:\t" << numOfEntities << std::endl; pEntities = new BspEntity[numOfEntities+1]; *************** *** 649,654 **** tLevelInfos.pPointLights=new PointLight[tLevelInfos.iNumPointLights]; tLevelInfos.pStartPoints=new Vector3[tLevelInfos.iNumStartPoints]; ! std::cout << "nombre de point de depart : " << tLevelInfos.iNumStartPoints << std::endl; ! std::cout << "nombre de lights : " << tLevelInfos.iNumPointLights << std::endl; int count = 0; --- 653,658 ---- tLevelInfos.pPointLights=new PointLight[tLevelInfos.iNumPointLights]; tLevelInfos.pStartPoints=new Vector3[tLevelInfos.iNumStartPoints]; ! std::cout << "[TGE] nombre de point de depart : " << tLevelInfos.iNumStartPoints << std::endl; ! std::cout << "[TGE] nombre de lights : " << tLevelInfos.iNumPointLights << std::endl; int count = 0; *************** *** 1068,1078 **** (*_glClientActiveTextureARB)(GL_TEXTURE0_ARB); ! glTexCoordPointer(2, GL_FLOAT, sizeof(BspVertex), pVerts[0].vTextureCoord); (*_glClientActiveTextureARB)(GL_TEXTURE1_ARB); ! glTexCoordPointer(2, GL_FLOAT, sizeof(BspVertex), pVerts[0].vLightmapCoord); ! glVertexPointer(3, GL_FLOAT, sizeof(BspVertex), &pVerts[0].vPosition); ! glDrawArrays(GL_TRIANGLE_FAN, pFace->startVertIndex, pFace->numOfVerts); continue; } --- 1072,1083 ---- (*_glClientActiveTextureARB)(GL_TEXTURE0_ARB); ! glTexCoordPointer(2, GL_FLOAT, sizeof(BspVertex), pVerts[pFace->startVertIndex].vTextureCoord); (*_glClientActiveTextureARB)(GL_TEXTURE1_ARB); ! glTexCoordPointer(2, GL_FLOAT, sizeof(BspVertex), pVerts[pFace->startVertIndex].vLightmapCoord); ! glVertexPointer(3, GL_FLOAT, sizeof(BspVertex), &pVerts[pFace->startVertIndex].vPosition); ! //glDrawArrays(GL_TRIANGLE_FAN, pFace->startVertIndex, pFace->numOfVerts); ! glDrawElements (GL_TRIANGLES, pFace->numOfMeshVerts, GL_UNSIGNED_INT, &pMeshIndices[pFace->firstMeshIndex]); continue; } Index: scenemanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scenemanager.h 15 Oct 2004 14:07:32 -0000 1.3 --- scenemanager.h 21 Oct 2004 21:18:28 -0000 1.4 *************** *** 9,18 **** #include "timer.h" #include "particleemitter.h" - #include "cube.h" #include "q3bsp.h" #include "dlinkednode.h" #include "pointlight.h" - //#include "d3map.h" - #include <string> #include <map> --- 9,15 ---- *************** *** 23,34 **** class Engine; - struct CollisionResult - { - Vector3 EndPoint; - Vector3 Normal; - //le node qui a ete touche. NULL si c'est la carte qui est touche ou si rien n'est touche - SceneNode* pNode; - }; - class SceneManager : public Base { --- 20,23 ---- *************** *** 62,66 **** //void SetLevel(D3Map* d) { pD3Level = d; } ! CollisionResult Trace (Vector3 Begin, Vector3 End); protected: --- 51,55 ---- //void SetLevel(D3Map* d) { pD3Level = d; } ! inline CollisionResult Trace (Vector3 Begin, Vector3 End) { return pPhysicEngine->Trace(Begin, End); } protected: Index: console.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/console.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** console.h 15 Oct 2004 13:08:33 -0000 1.2 --- console.h 21 Oct 2004 21:18:28 -0000 1.3 *************** *** 11,15 **** { ! class Console { protected: --- 11,15 ---- { ! class Console: public Function { protected: *************** *** 25,37 **** void _ParseCommand (std::string); ! typedef std::map <std::string, Function*> functionMap; functionMap mFunctions; public: ! class funcSet: public Function { public: void exec (const std::string& s); } fSet; class funcGet: public Function { public: void exec (const std::string& s); ! } fGet; Console (CVarManager*); //affichage void SetHistoryLength (int l); --- 25,59 ---- void _ParseCommand (std::string); ! struct FuncDesc { ! Function* pFunc; ! int iArg; ! }; ! ! typedef std::map <std::string, FuncDesc*> functionMap; functionMap mFunctions; + + enum { + GET=1, + SET=2 + }; public: ! /*class funcSet: public Function { public: void exec (const std::string& s); } fSet; class funcGet: public Function { public: void exec (const std::string& s); ! } fGet;*/ ! ! void Exec (const std::string& s, int arg) { ! switch(arg) { ! case GET: Get(s); break; ! case SET: Set(s); break; ! default: break; ! } ! } ! ! void Set(const std::string& s); ! void Get(const std::string& s); Console (CVarManager*); + virtual ~Console() {} //affichage void SetHistoryLength (int l); *************** *** 52,56 **** void Output (const std::string&); //enregistrement fonctions ! void Register (std::string, Function*); }; --- 74,78 ---- void Output (const std::string&); //enregistrement fonctions ! void Register (std::string, Function*, int); }; --- md5meshdata.h DELETED --- Index: camera.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/camera.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** camera.cc 10 Oct 2004 20:49:09 -0000 1.2 --- camera.cc 21 Oct 2004 21:18:28 -0000 1.3 *************** *** 40,44 **** SDL_WarpMouse (middleX, middleY); ! float factor; if (bShift) factor = 0.5f; --- 40,44 ---- SDL_WarpMouse (middleX, middleY); ! /* float factor; if (bShift) factor = 0.5f; *************** *** 46,73 **** factor = 1.0f; ! vAccel.x = 0; ! vAccel.z = 0; if(iForward >= 1) { ! vAccel.x += sinf(fYaw*DEGTORAD)*fSpeed*factor; ! vAccel.z -= cosf(fYaw*DEGTORAD)*fSpeed*factor; } else if(iForward <= -1) { ! vAccel.x -= sinf(fYaw*DEGTORAD)*fSpeed*factor; ! vAccel.z += cosf(fYaw*DEGTORAD)*fSpeed*factor; } if(iStrafe >= 1) { ! vAccel.x += cosf(fYaw*DEGTORAD)*fSpeed*factor; ! vAccel.z += sinf(fYaw*DEGTORAD)*fSpeed*factor; } else if(iStrafe <= -1) { ! vAccel.x -= cosf(fYaw*DEGTORAD)*fSpeed*factor; ! vAccel.z -= sinf(fYaw*DEGTORAD)*fSpeed*factor; ! } /*if(iForward >= 1) { --- 46,73 ---- factor = 1.0f; ! vVelocity.x = 0; ! vVelocity.z = 0; if(iForward >= 1) { ! vVelocity.x += sinf(fYaw*DEGTORAD)*fSpeed*factor; ! vVelocity.z -= cosf(fYaw*DEGTORAD)*fSpeed*factor; } else if(iForward <= -1) { ! vVelocity.x -= sinf(fYaw*DEGTORAD)*fSpeed*factor; ! vVelocity.z += cosf(fYaw*DEGTORAD)*fSpeed*factor; } if(iStrafe >= 1) { ! vVelocity.x += cosf(fYaw*DEGTORAD)*fSpeed*factor; ! vVelocity.z += sinf(fYaw*DEGTORAD)*fSpeed*factor; } else if(iStrafe <= -1) { ! vVelocity.x -= cosf(fYaw*DEGTORAD)*fSpeed*factor; ! vVelocity.z -= sinf(fYaw*DEGTORAD)*fSpeed*factor; ! }*/ /*if(iForward >= 1) { --- quad.cc DELETED --- Index: texture.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/texture.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** texture.cc 15 Oct 2004 13:08:33 -0000 1.7 --- texture.cc 21 Oct 2004 21:18:28 -0000 1.8 *************** *** 53,57 **** unsigned char *tempbuf; ! Log ("Chargement du TGA : %s", image); fd = fopen(image, "rb"); if(fd == NULL) --- 53,57 ---- unsigned char *tempbuf; ! std::cout << "[TGE] Chargement du TGA : " << image << std::endl; fd = fopen(image, "rb"); if(fd == NULL) *************** *** 87,91 **** if((tgaheader.imageTypeCode != TGA_RGB) && (tgaheader.imageTypeCode != TGA_GREY) && (tgaheader.imageTypeCode != TGA_RLERGB) && (tgaheader.imageTypeCode != TGA_RLEGREY)) { ! Log("LoadTGA: %s doesn't look like a TGA image\n", image); fclose(fd); return false; --- 87,91 ---- if((tgaheader.imageTypeCode != TGA_RGB) && (tgaheader.imageTypeCode != TGA_GREY) && (tgaheader.imageTypeCode != TGA_RLERGB) && (tgaheader.imageTypeCode != TGA_RLEGREY)) { ! std::cerr << "[TGE] LoadTGA: " << image << " doesn't look like a TGA image\n" << std::endl; fclose(fd); return false; *************** *** 144,148 **** } } else { ! Log("LoadTGA: %s has bad or unsupported pixel format (%d)\n", image, tgaheader.bitCount); fclose(fd); return false; --- 144,148 ---- } } else { ! std::cerr << "[TGE] LoadTGA:" << image << " has bad or unsupported pixel format (" << tgaheader.bitCount << ")" << std::endl; fclose(fd); return false; *************** *** 242,246 **** //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - Log ("bitcount %i", iBpp); //priorite de la texture... ca ne semble pas vraiment utile //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 1); --- 242,245 ---- *************** *** 252,256 **** glTexImage2D(GL_TEXTURE_2D, 0, iBpp, iWidth, iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, cData); ! Log ("%s : chargement reussi", image); bLoaded = true; return true; --- 251,255 ---- glTexImage2D(GL_TEXTURE_2D, 0, iBpp, iWidth, iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, cData); ! std::cout << "[TGE] " << image <<" : chargement reussi" << std::endl; bLoaded = true; return true; *************** *** 271,275 **** if(fd == NULL) { ! std::cerr << "Impossible de charger le fichier " << image << std::endl;; return false; } --- 270,274 ---- if(fd == NULL) { ! std::cerr << "[TGE] Impossible de charger le fichier " << image << std::endl;; return false; } *************** *** 295,299 **** if(bfheader.bfType != 0x4D42) { fclose(fd); ! Log ("ae.textureloader.LoadBMP \nError loading %s: not a valid BMP file (bmp id: %x)\n", image, bfheader.bfType); return false; } --- 294,298 ---- if(bfheader.bfType != 0x4D42) { fclose(fd); ! std::cerr << "[TGE] Le fichier " << image << " ne semble pas etre une image bmp valide : " << bfheader.bfType << std::endl; return false; } *************** *** 336,340 **** } else { fclose(fd); ! Log("ae.textureloader.LoadBMP \n%s has bad or unsupported pixel format\n", image); return false; } --- 335,339 ---- } else { fclose(fd); ! std::cerr << "[TGE] L'image " << image << " a un mauvais format de pixel" << std::endl; return false; } *************** *** 417,421 **** bool Texture::LoadPNG (char* image, texType type) { ! std::cout << "chargement de "<<image<<std::endl; SDL_Surface* texture; texture = IMG_Load(image); --- 416,420 ---- bool Texture::LoadPNG (char* image, texType type) { ! std::cout << "[TGE] chargement de "<<image<<std::endl; SDL_Surface* texture; texture = IMG_Load(image); Index: glrenderernv15.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderernv15.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** glrenderernv15.cc 15 Oct 2004 13:59:04 -0000 1.5 --- glrenderernv15.cc 21 Oct 2004 21:18:28 -0000 1.6 *************** *** 78,85 **** if (mesh->bCamera) glLoadIdentity (); ! ! _RotateNode(mesh); ! glTranslatef(mesh->GetPosition().x, mesh->GetPosition().y, mesh->GetPosition().z); glScalef(mesh->fScale, mesh->fScale, mesh->fScale); --- 78,86 ---- if (mesh->bCamera) glLoadIdentity (); ! ! glTranslatef(mesh->GetPosition().x, mesh->GetPosition().y, mesh->GetPosition().z); + _RotateNode(mesh); + glScalef(mesh->fScale, mesh->fScale, mesh->fScale); *************** *** 377,381 **** bWireFrame = false; ! Engine::pConsole->Register("wireframe", &fWireFrame); Engine::pVarManager->AddVar("lightpos.x", 150.0f); --- 378,382 ---- bWireFrame = false; ! Engine::pConsole->Register("wireframe", this, WIREFRAME); Engine::pVarManager->AddVar("lightpos.x", 150.0f); --- log.cc DELETED --- Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** physicengine.cc 15 Oct 2004 13:59:04 -0000 1.10 --- physicengine.cc 21 Oct 2004 21:18:28 -0000 1.11 *************** *** 17,21 **** #define MAXBUMPS 5 ! void PhysicEngine::StepSlideMove(SceneNode* n, float eTime, Vector3& vVelocity, Vector3 origin) { BspCollisionResult trace; --- 17,21 ---- #define MAXBUMPS 5 ! void PhysicEngine::StepSlideMove(PhysicNode* n, float eTime, Vector3& vVelocity, Vector3 origin) { BspCollisionResult trace; *************** *** 29,33 **** //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->pBBox->vMin, n->pBBox->vMax); if (trace.AllSolid) --- 29,33 ---- //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); if (trace.AllSolid) *************** *** 78,82 **** void PhysicEngine::Move (float eTime) { ! SceneNode* n; /*Vector3 vVeloc1; Vector3 vVeloc2; --- 78,82 ---- void PhysicEngine::Move (float eTime) { ! PhysicNode* n; /*Vector3 vVeloc1; Vector3 vVeloc2; *************** *** 87,93 **** { n = pNodes[i]; ! //Vector3 origin = n->GetPosition(); ! //on ajoute la gravite ! if (!n->bOnGround && !n->bNoClip) n->AddYAccel(-(*pGravity)); else if (n->GetYAccel() < 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) --- 87,103 ---- { n = pNodes[i]; ! //si l'objet ne doit pas etre géré par la physique, on continue ! if (!n->Clip()) ! { ! n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); ! n->SetRot(n->GetRot()+n->GetRotVelocity()*eTime); ! n->UpdatePosition(); ! ! continue; ! } ! ! //on a un objet qui doit subir les forces et les collisions ! ! if (!n->OnGround()) n->AddYAccel(-(*pGravity)); else if (n->GetYAccel() < 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) *************** *** 98,111 **** //int red[]={1,0,0}; //Engine::pEngine->pRenderer->drawDebugArrow(n->vPosition, n->vPosition+n->vAccel*5, red); ! n->SetVelocity(n->GetAccel()*eTime); //mise a jour des volumes englobants n->CalculateBoundingVolume(); //on test les collisions avec le monde ! if (n->bNoClip) ! { ! n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); ! continue; ! } ! if (pLevel && !n->bNoClip) { //on essaie de faire monter les petits obstacles sur les y (escaliers, rebords) au joueur. Pour cela, on test si lorsqu'on monte --- 108,118 ---- //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(n->GetVelocity()+n->GetAccel()*eTime); //mise a jour des volumes englobants n->CalculateBoundingVolume(); //on test les collisions avec le monde ! ! if (pLevel) { //on essaie de faire monter les petits obstacles sur les y (escaliers, rebords) au joueur. Pour cela, on test si lorsqu'on monte *************** *** 129,189 **** float dist = sqrt(distx+distz); ! StepSlideMove (n, eTime, vUpVelocity, vUpPos); ! vUpNewPos += vUpVelocity*eTime; ! distx = (vUpNewPos.x - vUpPos.x); ! distx *= distx; ! distz = (vUpNewPos.z - vUpPos.z); ! distz *= distz; ! float updist = sqrt(distx+distz); ! ! ! if (updist > dist) //on passe l'obstacle ! { ! //std::cout << "time : " << eTime << "\t" << vUpNewPos << std::endl; ! n->SetPosition(vUpNewPos); ! if (vUpVelocity != n->GetVelocity() && n->GetPhysicCallBack() != NULL) ! { ! //std::cout << "callback" << std::endl; ! //ce ne sont pas les memes, donc il y a eu collision -> appelle de la callback ! n->GetPhysicCallBack()->Collide(NULL, Vector3(0,0,0), Vector3(0,0,0)); ! } ! ! } ! else //l'obstacle est trop haut { ! //std::cout << "time : " << eTime << "\t" << vNewPos << std::endl; ! n->SetPosition(vNewPos); ! if (vVelocity != n->GetVelocity() && n->GetPhysicCallBack() != NULL) ! { ! //std::cout << "callback" << std::endl; ! //ce ne sont pas les memes, donc il y a eu collision -> appelle de la callback ! n->GetPhysicCallBack()->Collide(NULL, Vector3(0,0,0), Vector3(0,0,0)); ! } ! ! } //Classification de la position //FIXME:on fait une differenciation entre le joueur et les autres scenenode. il ne faudrait pas! ! if (n->bIsCamera && pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*PLAYER_HEIGHT, TRACE_RAY, 0).Fraction < 1.0f) ! n->bOnGround = true; ! else if (!n->bIsCamera && pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, n->pBBox->vMin, n->pBBox->vMax).Fraction < 1.0f) ! n->bOnGround = true; else ! n->bOnGround = false; ! } - n->SetVelocity(Vector3::ZERO); } } ! void PhysicEngine::AddNode(SceneNode* obj) { pNodes.push_back(obj); } ! void PhysicEngine::RemoveNode(SceneNode* obj) { ! std::vector<SceneNode*>::iterator i; for (i = pNodes.begin(); i<pNodes.end(); i++) { --- 136,250 ---- float dist = sqrt(distx+distz); ! StepSlideMove (n, eTime, vUpVelocity, vUpPos); ! vUpNewPos += vUpVelocity*eTime; ! distx = (vUpNewPos.x - vUpPos.x); ! distx *= distx; ! distz = (vUpNewPos.z - vUpPos.z); ! distz *= distz; ! float updist = sqrt(distx+distz); ! if (updist > dist) //on passe l'obstacle ! { ! //std::cout << "time : " << eTime << "\t" << vUpNewPos << std::endl; ! n->SetPosition(vUpNewPos); ! if (vUpVelocity != n->GetVelocity() && n->GetPhysicCallBack() != NULL) { ! //std::cout << "callback" << std::endl; ! //ce ne sont pas les memes, donc il y a eu collision -> appelle de la callback ! n->GetPhysicCallBack()->Collide(NULL, Vector3(0,0,0), Vector3(0,0,0)); ! } ! } ! else //l'obstacle est trop haut ! { ! //std::cout << "time : " << eTime << "\t" << vNewPos << std::endl; ! n->SetPosition(vNewPos); ! if (vVelocity != n->GetVelocity() && n->GetPhysicCallBack() != NULL) ! { ! //std::cout << "callback" << std::endl; ! //ce ne sont pas les memes, donc il y a eu collision -> appelle de la callback ! n->GetPhysicCallBack()->Collide(NULL, Vector3(0,0,0), Vector3(0,0,0)); ! } ! } //Classification de la position //FIXME:on fait une differenciation entre le joueur et les autres scenenode. il ne faudrait pas! ! /*if (n->bIsCamera && pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*PLAYER_HEIGHT, TRACE_RAY, 0).Fraction < 1.0f) ! n->SetOnGround(true); ! else*/ ! BspCollisionResult col = pLevel->CheckRayMove(n->GetPosition(), n->GetPosition()+Vector3::NEGATIVE_UNIT_Y*BASE_HEIGHT, ! n->GetBBox()->vMin, n->GetBBox()->vMax); ! //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); ! ! n->SetRot(n->GetRot()+n->GetRotVelocity()*eTime); ! ! n->UpdatePosition(); } } } ! //TODO: Les objets doivent être classés par leaf et cela doit etre utilise pour le trace (il faudrait extraire l'arbre BSP de la map et l'envoyer au moteur physique, qui s'occuperait d'y rajouter les objets & Co) ! CollisionResult PhysicEngine::Trace (Vector3 Begin, Vector3 End) ! { ! //on choppe le resultat du trace sur la map ! CollisionResult result; ! result.pNode = NULL; ! ! BspCollisionResult mapResult = pLevel->CheckRayMove(Begin, End, TRACE_RAY, 0); ! result.EndPoint = mapResult.EndPoint; ! result.Normal = mapResult.CollisionNormal; ! //on trace ensuite sur les objets (mObjects) ! 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 (pNodes[i]->Trace(Begin, End, colPoint, colNormal)) { ! d1 = (colPoint - Begin).Magnitude(); ! d2 = (result.EndPoint - Begin).Magnitude(); ! if (d1 < d2) { ! result.EndPoint = colPoint; ! result.Normal = colNormal; ! result.pNode = pNodes[i]; ! } ! } ! } ! /* Mesh* m = pFirstObject; ! if (m != NULL) ! { ! do ! { ! if (m->Trace(Begin, End, colPoint, colNormal)) ! { ! //on regarde si le nouveau point de collision est plus proche de la caméra que l'ancien point de collision ! d1 = (colPoint - pCamera->GetPosition()).Magnitude(); ! d2 = (result.EndPoint - pCamera->GetPosition()).Magnitude(); ! if ( d1 < d2 ) ! { ! result.EndPoint = colPoint; ! result.Normal = colNormal; ! result.pNode = m; ! } ! } ! } while((m=m->GetNext()) != NULL); ! }*/ ! ! return result; ! } ! ! ! ! void PhysicEngine::AddNode(PhysicNode* obj) { pNodes.push_back(obj); } ! void PhysicEngine::RemoveNode(PhysicNode* obj) { ! std::vector<PhysicNode*>::iterator i; for (i = pNodes.begin(); i<pNodes.end(); i++) { *************** *** 193,195 **** --- 254,265 ---- } + void PhysicEngine::UpdatePosition() + { + std::vector<PhysicNode*>::iterator i; + for (i = pNodes.begin(); i<pNodes.end(); i++) + { + (*i)->UpdatePosition(); + } + } + }//END tg Index: base.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/base.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** base.cc 26 Sep 2004 13:15:04 -0000 1.1.1.1 --- base.cc 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 4,22 **** { - void Base::Log( const char *msg, ...) - { - va_list vargs; - char outBuff[256]; - - if(strlen(msg) > 254) { - std::clog << "Base::Report\t Message trop gros ( > 254) " << msg << std::endl; - } - - va_start(vargs, msg); - vsnprintf(outBuff, sizeof(outBuff), msg, vargs); - va_end(vargs); - - std::cout <<outBuff << std::endl; - } } //END tg --- 4,7 ---- Index: q3bsp.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** q3bsp.h 10 Oct 2004 21:11:55 -0000 1.2 --- q3bsp.h 21 Oct 2004 21:18:28 -0000 1.3 *************** *** 21,52 **** struct BspCollisionResult { - friend class Q3Bsp; - /** - * Retourne la fraction de la ligne qui n'entre _pas_ en collision - * @return float la fraction de la ligne - */ - inline float GetFraction () { return Fraction; } - /** - * Retourne le point de collision - * @return Vector3 le point de collision - */ - inline const Vector3& GetCollisionPoint () { return EndPoint; } - /** - * Retourne la normal au point de collision - * @return Vector3 la normal au point de collision - */ - inline const Vector3& GetCollisionNormal () { return CollisionNormal; } - /** - * Permet de savoir si le segment débute en dehors d'un solide - * @return bool faux si le point de départ du segment est dans un solide - */ - inline bool StartsOut () { return StartOut; } - /** - * Permet de savoir si le segment est complètement compris dans un solide - * @return bool vrai si le segment est complètement compris dans un solide - */ - inline bool IsAllSolid () { return AllSolid; } - - //protected: float Fraction; Vector3 EndPoint; --- 21,24 ---- *************** *** 206,209 **** --- 178,183 ---- Vector3 vCenter; float fRadius; + int firstMeshIndex; + int numOfMeshVerts; }; --- d3map.cc DELETED --- --- polyexplosion.h DELETED --- Index: console.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/console.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** console.cc 15 Oct 2004 13:08:33 -0000 1.3 --- console.cc 21 Oct 2004 21:18:28 -0000 1.4 *************** *** 8,13 **** bShow = false; pVarManager = c; ! Register("set", &fSet); ! Register("get", &fGet); } --- 8,13 ---- bShow = false; pVarManager = c; ! Register("set", this, SET); ! Register("get", this, GET); } *************** *** 60,64 **** if (firstWord.compare (i->first) == 0) { ! (*i->second) (args); } } --- 60,64 ---- if (firstWord.compare (i->first) == 0) { ! i->second->pFunc->Exec (args, i->second->iArg); } } *************** *** 66,72 **** } ! void Console::Register(std::string s, Function* f) { ! mFunctions[s] = f; } --- 66,75 ---- } ! void Console::Register(std::string s, Function* f, int arg) { ! FuncDesc* d = new FuncDesc(); ! d->pFunc = f; ! d->iArg = arg; ! mFunctions[s] = d; } *************** *** 137,141 **** } ! void Console::funcSet::exec(const std::string& s) { //on cherche le premier mot --- 140,144 ---- } ! void Console::Set (const std::string& s) { //on cherche le premier mot *************** *** 152,156 **** } ! void Console::funcGet::exec(const std::string& s) { --- 155,159 ---- } ! void Console::Get (const std::string& s) { --- cube.cc DELETED --- Index: guibutton.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/guibutton.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** guibutton.cc 26 Sep 2004 13:15:22 -0000 1.1.1.1 --- guibutton.cc 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 18,22 **** void GuiButton::Pressed () { ! Log ("Pressed ^^"); } --- 18,22 ---- void GuiButton::Pressed () { ! std::cout << "[TGE] Pressed ^^" << std::endl; } --- log.h DELETED --- Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** scenemanager.cc 15 Oct 2004 14:07:32 -0000 1.7 --- scenemanager.cc 21 Oct 2004 21:18:28 -0000 1.8 *************** *** 21,62 **** iBump = &Engine::pVarManager->GetVar("bump")->intValue; } - //TODO: Les objets doivent être classés par leaf et cela doit etre utilise pour le trace (il faudrait extraire l'arbre BSP de la map et l'envoyer au moteur physique, qui s'occuperait d'y rajouter les objets & Co) - CollisionResult SceneManager::Trace (Vector3 Begin, Vector3 End) - { - //on choppe le resultat du trace sur la map - CollisionResult result; - result.pNode = NULL; - - BspCollisionResult mapResult = pLevel->CheckRayMove(Begin, End, TRACE_RAY, 0); - result.EndPoint = mapResult.EndPoint; - result.Normal = mapResult.CollisionNormal; - //on trace ensuite sur les objets (mObjects) - Vector3 colPoint(0,0,0); - Vector3 colNormal(0,0,0); - float d1, d2; - Vector3 tmp; - - Mesh* m = pFirstObject; - if (m != NULL) - { - do - { - if (m->Trace(Begin, End, colPoint, colNormal)) - { - //on regarde si le nouveau point de collision est plus proche de la caméra que l'ancien point de collision - d1 = (colPoint - pCamera->GetPosition()).Magnitude(); - d2 = (result.EndPoint - pCamera->GetPosition()).Magnitude(); - if ( d1 < d2 ) - { - result.EndPoint = colPoint; - result.Normal = colNormal; - result.pNode = m; - } - } - } while((m=m->GetNext()) != NULL); - } - - return result; - } void SceneManager::_ProcessTimedObject (Mesh* s, float t) --- 21,24 ---- *************** *** 128,132 **** { m->PreRender(frameInterval); ! m->pBBox->CalculatePlanes(); m->iLeaf = pLevel->FindLeaf(m->GetPosition()); if ((pLevel->IsVisible(m->iLeaf) || m->bCamera)) --- 90,94 ---- { m->PreRender(frameInterval); ! m->GetBBox()->CalculatePlanes(); m->iLeaf = pLevel->FindLeaf(m->GetPosition()); if ((pLevel->IsVisible(m->iLeaf) || m->bCamera)) *************** *** 139,143 **** #endif #ifdef DEBUG ! Engine::pRenderer->RenderBBox(m->pBBox); #endif } --- 101,105 ---- #endif #ifdef DEBUG ! Engine::pRenderer->RenderBBox(m->GetBBox()); #endif } --- positionallight.h DELETED --- --- md5meshdata.cc DELETED --- --- modelloader.cc DELETED --- --- md2mesh.h DELETED --- --- positionallight.cc DELETED --- --- modelloader.h DELETED --- Index: engine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/engine.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** engine.cc 15 Oct 2004 13:08:33 -0000 1.4 --- engine.cc 21 Oct 2004 21:18:28 -0000 1.5 *************** *** 10,13 **** --- 10,14 ---- Engine* Engine::pEngine = NULL; Endian* Engine::pEndian = NULL; + MeshManager* Engine::pMeshManager = new MeshManager (); Engine::Engine (Timer* t) *************** *** 46,50 **** if (p==NULL) { ! Log ("Impossible d'obtenir des informations sur la carte graphique. Utilisation du NV15"); pRenderer = new GLRendererNV15(); return; --- 47,51 ---- if (p==NULL) { ! std::cerr << "[TGE] Impossible d'obtenir des informations sur la carte graphique. Utilisation du NV15" << std::endl; pRenderer = new GLRendererNV15(); return; *************** *** 56,70 **** if (renderer.find("GeForce2") != std::string::npos) //on a une geforce2 { ! Log ("GeForce2 detectee, utilisation du rendu NV15"); pRenderer = new GLRendererNV15(); } else if (renderer.find("ATI") != std::string::npos) // On a une ATI (Seb) { ! Log ("ATI detectee, utilisation du rendu NV15"); pRenderer = new GLRendererNV15(); } else { ! Log ("Carte graphique inconnue, utilisation du rendu NV15"); pRenderer = new GLRendererNV15(); } --- 57,71 ---- if (renderer.find("GeForce2") != std::string::npos) //on a une geforce2 { ! std::cout << "[TGE] GeForce2 detectee, utilisation du rendu NV15" << std::endl; pRenderer = new GLRendererNV15(); } else if (renderer.find("ATI") != std::string::npos) // On a une ATI (Seb) { ! std::cout << "[TGE] ATI detectee, utilisation du rendu NV15" << std::endl; pRenderer = new GLRendererNV15(); } else { ! std::cerr << "[TGE] Carte graphique inconnue, utilisation du rendu NV15" << std::endl; pRenderer = new GLRendererNV15(); } *************** *** 78,82 **** if(SDL_Init(SDL_INIT_VIDEO) < 0) { ! Log ("Erreur lors de l'initialisation de la carte graphique"); exit (-1); } --- 79,83 ---- if(SDL_Init(SDL_INIT_VIDEO) < 0) { ! std::cerr << "[TGE] Erreur lors de l'initialisation de la carte graphique" << std::endl; exit (-1); } *************** *** 86,90 **** if(vidInfo == NULL) { ! Log ("Impossible d'obtenir les informations sur la carte graphique"); exit (-1); } --- 87,91 ---- if(vidInfo == NULL) { ! std::cerr << "[TGE] Impossible d'obtenir les informations sur la carte graphique" << std::endl; exit (-1); } *************** *** 107,116 **** if(dbuff == 0) { ! Log ("Impossible d'obtenir le double tampon"); } SDL_ShowCursor(SDL_DISABLE); ! pConsole->Register("resize", &fResize); } --- 108,117 ---- if(dbuff == 0) { ! std::cerr << "[TGE] Impossible d'obtenir le double tampon" << std::endl; } SDL_ShowCursor(SDL_DISABLE); ! pConsole->Register("resize", this, RESIZE); } *************** *** 128,132 **** if(!screen) { ! Log ("Impossible de creer une fenetre"); exit (-1); } --- 129,133 ---- if(!screen) { ! std::cerr << "[TGE] Impossible de creer une fenetre" << std::endl; exit (-1); } *************** *** 140,144 **** } ! void Engine::funcResize::exec(const std::string& s) { int w, h; --- 141,145 ---- } ! void Engine::Resize(const std::string& s) { int w, h; Index: physicengine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** physicengine.h 15 Oct 2004 13:59:04 -0000 1.3 --- physicengine.h 21 Oct 2004 21:18:28 -0000 1.4 *************** *** 6,13 **** --- 6,23 ---- #include "q3bsp.h" #include "dlinkednode.h" + #include "physicnode.h" namespace tg { + struct CollisionResult + { + Vector3 EndPoint; + Vector3 Normal; + //le node qui a ete touche. NULL si c'est la carte qui est touche ou si rien n'est touche + PhysicNode* pNode; + }; + + /*class PhysicNode : public SceneNode { *************** *** 25,36 **** PhysicEngine (); void SetLevel (Q3Bsp* p) { pLevel = p; } ! void AddNode (SceneNode*); ! void RemoveNode (SceneNode*); void Move (float eTime); ! void StepSlideMove (SceneNode*, float, Vector3&,Vector3); void ClipVelocity (Vector3& vel, const Vector3 norm); ! protected: ! std::vector<SceneNode*> pNodes; Q3Bsp* pLevel; float fOverBounce; --- 35,49 ---- PhysicEngine (); void SetLevel (Q3Bsp* p) { pLevel = p; } ! void AddNode (PhysicNode*); ! void RemoveNode (PhysicNode*); void Move (float eTime); ! void StepSlideMove (PhysicNode*, float, Vector3&,Vector3); void ClipVelocity (Vector3& vel, const Vector3 norm); ! ! void UpdatePosition (); ! ! CollisionResult Trace(Vector3 Begin, Vector3 End); protected: ! std::vector<PhysicNode*> pNodes; Q3Bsp* pLevel; float fOverBounce; --- md5mesh.h DELETED --- Index: scenenode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** scenenode.cc 15 Oct 2004 13:59:04 -0000 1.4 --- scenenode.cc 21 Oct 2004 21:18:28 -0000 1.5 *************** *** 6,20 **** { vPosition.Null(); ! vVelocity.Null(); ! vAccel.Null(); pBBox = new BoundingBox (); vEuler.Null(); ! bNoClip = false; fTime = -1.0f; ! bOnGround = false; bIsCamera = false; ! pPhysicCallBack = NULL; } --- 6,20 ---- { vPosition.Null(); ! // vVelocity.Null(); ! // vAccel.Null(); pBBox = new BoundingBox (); vEuler.Null(); ! // bNoClip = false; fTime = -1.0f; ! // bOnGround = false; bIsCamera = false; ! // pPhysicCallBack = NULL; } *************** *** 23,37 **** vPosition = p; ! vVelocity.Null(); ! vAccel.Null(); pBBox = new BoundingBox (); vEuler.Null(); ! bNoClip = false; fTime = -1.0f; ! bOnGround = false; bIsCamera = false; ! pPhysicCallBack = NULL; } --- 23,37 ---- vPosition = p; ! // vVelocity.Null(); ! // vAccel.Null(); pBBox = new BoundingBox (); vEuler.Null(); ! // bNoClip = false; fTime = -1.0f; ! // bOnGround = false; bIsCamera = false; ! // pPhysicCallBack = NULL; } *************** *** 42,46 **** } ! void SceneNode::SetPhysicCallBack(PhysicCallBack* p) { pPhysicCallBack = p; --- 42,46 ---- } ! /*void SceneNode::SetPhysicCallBack(PhysicCallBack* p) { pPhysicCallBack = p; *************** *** 50,54 **** { //pBBox->Move(vPosition); ! } bool SceneNode::Trace (Vector3 Begin,Vector3 End, Vector3& colPoint, Vector3& colNormal) --- 50,54 ---- { //pBBox->Move(vPosition); ! }*/ bool SceneNode::Trace (Vector3 Begin,Vector3 End, Vector3& colPoint, Vector3& colNormal) Index: glrenderer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** glrenderer.cc 15 Oct 2004 13:59:04 -0000 1.7 --- glrenderer.cc 21 Oct 2004 21:18:28 -0000 1.8 *************** *** 7,15 **** { - void GLRenderer::funcWireFrame::exec(const std::string& s) - { - Engine::pRenderer->ToggleWireFrame (); - } - VertexProgram::VertexProgram(char* filename) { --- 7,10 ---- *************** *** 67,71 **** bWireFrame = false; ! Engine::pConsole->Register("wireframe", &fWireFrame); Engine::pVarManager->AddVar("lightpos.x", 150.0f); --- 62,66 ---- bWireFrame = false; ! Engine::pConsole->Register("wireframe", this, WIREFRAME); Engine::pVarManager->AddVar("lightpos.x", 150.0f); *************** *** 103,107 **** LoadARBFunctions (); glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &iNumARBTextureUnits); ! Log("Nombre max de canaux de texture (multitexturing) : %i", iNumARBTextureUnits); InitVertexShader (); GenerateNormalisationCubeMap (); --- 98,102 ---- LoadARBFunctions (); glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &iNumARBTextureUnits); ! std::cout << "[TGE] Nombre max de canaux de texture (multitexturing) : " << iNumARBTextureUnits << std::endl; InitVertexShader (); GenerateNormalisationCubeMap (); *************** *** 177,183 **** void GLRenderer::LoadARBFunctions () { ! Log ("Chargement des fonctions ARB"); InitARBFunctions (); ! Log ("Chargement terminé"); } --- 172,178 ---- void GLRenderer::LoadARBFunctions () { ! std::cout << "[TGE] Chargement des fonctions ARB" << std::endl; InitARBFunctions (); ! std::cout << "[TGE] Chargement terminé" << std::endl; } *************** *** 199,203 **** glLoadIdentity(); #define FOV 120 ! gluPerspective(FOV/2, ratio, 0.1f, 4000.0f); glMatrixMode(GL_MODELVIEW); --- 194,198 ---- glLoadIdentity(); #define FOV 120 ! gluPerspective(FOV/2, ratio, 0.1f, 10000.0f); glMatrixMode(GL_MODELVIEW); *************** *** 503,510 **** } - void GLRenderer::SetPositionalLight (PositionalLight* l) - { - pLight = l; - } void GLRenderer::RenderMesh (Mesh* m, PointLight* p) --- 498,501 ---- *************** *** 780,799 **** sTangent=-sTangent; tTangent=-tTangent; ! } ! ! } void GLRenderer::_RotateNode (SceneNode* s) { - #define __ROT_EULER - #ifdef __ROT_EULER glRotatef(s->GetXRot(), 1, 0, 0); glRotatef(s->GetYRot(), 0, 1, 0); glRotatef(s->GetZRot(), 0, 0, 1); - #else - const Vector3& tmp = s->qRotation.GetRotationAxis(); - glRotatef(RADTODEG*s->qRotation.GetRotationAngle(), tmp.x, tmp.y, tmp.z); - #endif } --- 771,782 ---- sTangent=-sTangent; tTangent=-tTangent; ! } } void GLRenderer::_RotateNode (SceneNode* s) { glRotatef(s->GetXRot(), 1, 0, 0); glRotatef(s->GetYRot(), 0, 1, 0); glRotatef(s->GetZRot(), 0, 0, 1); } *************** *** 1075,1082 **** if (mesh->bCamera) glLoadIdentity (); ! _RotateNode(mesh); - glTranslatef(mesh->GetPosition().x, mesh->GetPosition().y, mesh->GetPosition().z); glScalef(mesh->fScale, mesh->fScale, mesh->fScale); --- 1058,1065 ---- if (mesh->bCamera) glLoadIdentity (); ! ! glTranslatef(mesh->GetPosition().x, mesh->GetPosition().y, mesh->GetPosition().z); _RotateNode(mesh); glScalef(mesh->fScale, mesh->fScale, mesh->fScale); Index: md5mesh10.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/md5mesh10.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** md5mesh10.cc 30 Sep 2004 09:23:16 -0000 1.3 --- md5mesh10.cc 21 Oct 2004 21:18:28 -0000 1.4 *************** *** 45,49 **** int version; ! std::cout << "Chargement de " << str << std::endl; pFD.open(str, std::ios::in); --- 45,49 ---- int version; ! std::cout << "[TGE] Chargement de " << str << std::endl; pFD.open(str, std::ios::in); *************** *** 51,55 **** if (pFD.fail()) { ! Log ("Erreur lors de l'ouverture de %s", str); return false; } --- 51,55 ---- if (pFD.fail()) { ! std::cerr << "[TGE] Erreur lors de l'ouverture de " << str << std::endl; return false; } *************** *** 60,64 **** if (version != 10) { ! Log ("Mauvaise version : %i", version); return false; } --- 60,64 ---- if (version != 10) { ! std::cerr << "[TGE] Mauvaise version : " << version << std::endl; return false; } *************** *** 99,103 **** //Util::QuaternionToMatrix33(q,pJoints[i].mOrientation); } - pMeshes = new _MD5Mesh[iNumMeshes]; for (int i=0; i<iNumMeshes; i++) --- 99,102 ---- *************** *** 124,128 **** pMeshes[i].pIndexes = new unsigned int[pMeshes[i].iNumTris*3]; int iC = 0; - pFD >> buffer; //sans ca, le NEXT("tri") ne va pas bouger car tri est deja dans numtris for (int j=0; j<pMeshes[i].iNumTris; j++) --- 123,126 ---- *************** *** 157,161 **** } ! std::cout << "Chargement de " << str << " termine" << std::endl; return true; --- 155,159 ---- } ! std::cout << "[TGE] Chargement de " << str << " termine" << std::endl; return true; *************** *** 179,183 **** if (pFD.fail()) { ! Log ("Erreur lors de l'ouverture de %s", str); return false; } --- 177,181 ---- if (pFD.fail()) { ! std::cerr << "[TGE] Erreur lors de l'ouverture de " << str << std::endl; return false; } *************** *** 188,192 **** if (version != 10) { ! Log ("Mauvaise version : %i", version); return false; } --- 186,190 ---- if (version != 10) { ! std::cerr << "[TGE] Mauvaise version : " << version << std::endl; return false; } Index: guicontainer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/guicontainer.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** guicontainer.cc 26 Sep 2004 13:15:22 -0000 1.1.1.1 --- guicontainer.cc 21 Oct 2004 21:18:28 -0000 1.2 *************** *** 42,46 **** if ((x>b->GetImage()->x && x < b->GetImage()->x + b->GetImage()->width) && (y>b->GetImage()->y && y < b->GetImage()->y + b->GetImage()->height)) ! Log ("bouton"); } } --- 42,46 ---- if ((x>b->GetImage()->x && x < b->GetImage()->x + b->GetImage()->width) && (y>b->GetImage()->y && y < b->GetImage()->y + b->GetImage()->height)) ! std::cout << "[TGE] bouton" << std::endl; } } Index: texturemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/texturemanager.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texturemanager.cc 27 Sep 2004 13:32:34 -0000 1.2 --- texturemanager.cc 21 Oct 2004 21:18:28 -0000 1.3 *************** *** 10,14 **** if (!(t->LoadTexture("data/notexture.bmp", TG_TEXTURE_2D))) { ! std::cout << "fichier data/notexture.bmp non present" << std::endl; for (int i=0; i<256*256*24; i+=24) { --- 10,14 ---- if (!(t->LoadTexture("data/notexture.bmp", TG_TEXTURE_2D))) { ! std::cout << "[TGE] fichier data/notexture.bmp non present" << std::endl; for (int i=0; i<256*256*24; i+=24) { |