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-10-24 14:52:05
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22645 Modified Files: camera.cc engine.h event.h glrenderer.cc Log Message: changements pour les mouvements Index: glrenderer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** glrenderer.cc 24 Oct 2004 13:36:59 -0000 1.9 --- glrenderer.cc 24 Oct 2004 14:51:54 -0000 1.10 *************** *** 1085,1089 **** _RotateNode(mesh); ! glScalef(mesh->fScale, mesh->fScale, mesh->fScale); --- 1085,1105 ---- _RotateNode(mesh); ! ! glLineWidth(3.0f); ! glBegin (GL_LINES); ! glColor3f(1,0,0); ! glVertex3f (0,0,0); ! glVertex3f (10,0,0); ! ! glColor3f(0,0,1); ! glVertex3f(0,0,0); ! glVertex3f(0,0,10); ! ! glColor3f(0,1,0); ! glVertex3f(0,0,0); ! glVertex3f(0,10,0); ! glEnd (); ! glLineWidth(1.0f); ! glScalef(mesh->fScale, mesh->fScale, mesh->fScale); Index: camera.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/camera.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** camera.cc 24 Oct 2004 13:36:59 -0000 1.4 --- camera.cc 24 Oct 2004 14:51:54 -0000 1.5 *************** *** 30,34 **** int mX, mY; int middleX, middleY; ! SDL_GetMouseState (&mX, &mY); middleX = 320; middleY = 240; --- 30,35 ---- int mX, mY; int middleX, middleY; ! //SDL_GetMouseState (&mX, &mY); ! Engine::pEngine->GetMouseState(&mX,&mY); middleX = 320; middleY = 240; *************** *** 38,42 **** vRot.x += ((float)mY-middleY)*fSensivity/*time*/*6; ! SDL_WarpMouse (middleX, middleY); /* float factor; --- 39,44 ---- vRot.x += ((float)mY-middleY)*fSensivity/*time*/*6; ! //SDL_WarpMouse (middleX, middleY); ! Engine::pEngine->WarpMouse(middleX, middleY); /* float factor; *************** *** 134,139 **** { glMatrixMode (GL_MODELVIEW); ! glRotatef(vRot.x, 1.0f, 0.0f, 0.0f); ! glRotatef(vRot.y, 0.0f, 1.0f, 0.0f); glTranslatef(-vPosition.x, -vPosition.y, -vPosition.z); frustum.Update(); --- 136,141 ---- { glMatrixMode (GL_MODELVIEW); ! glRotatef(vEuler.x, 1.0f, 0.0f, 0.0f); ! glRotatef(vEuler.y, 0.0f, 1.0f, 0.0f); glTranslatef(-vPosition.x, -vPosition.y, -vPosition.z); frustum.Update(); Index: engine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/engine.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** engine.h 21 Oct 2004 21:18:28 -0000 1.4 --- engine.h 24 Oct 2004 14:51:54 -0000 1.5 *************** *** 69,73 **** //static TextureManager* pTextureManager; ! void OpenApplication (); void DefaultRunLoop (); --- 69,76 ---- //static TextureManager* pTextureManager; ! ! inline void GetMouseState (int* x, int* y) { SDL_GetMouseState(x,y); } ! inline void WarpMouse (int x, int y) { SDL_WarpMouse (x,y); } ! void OpenApplication (); void DefaultRunLoop (); Index: event.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/event.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** event.h 28 Sep 2004 09:44:26 -0000 1.2 --- event.h 24 Oct 2004 14:51:54 -0000 1.3 *************** *** 26,38 **** namespace tg { - /** @defgroup eventstructs AE event structs and definitions. - * AE event structures and definitions. - * @{ - */ - /// Key definition table. /*! ! This is essentially the same as SDLKEY_*, the only ! change is in the name (AEKEY_*). */ enum tgKey { --- 26,33 ---- namespace tg { /// Key definition table. /*! ! * C'est la même chose que SDLKey, c'est juste le préfixe qui change (TGKEY) ! * Repris de AEEngine */ enum tgKey { |
|
From: julien r. <jul...@us...> - 2004-10-24 13:42:08
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4997 Removed Files: vector.cc vector.h Log Message: --- vector.cc DELETED --- --- vector.h DELETED --- |
|
From: julien r. <jul...@us...> - 2004-10-24 13:37:08
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3822 Modified Files: camera.cc camera.h glrenderer.cc glrenderernv15.cc physicengine.cc physicnode.cc physicnode.h quaternion.h scenemanager.cc scenenode.h vector3.cc vector3.h Log Message: Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** physicengine.cc 21 Oct 2004 21:18:28 -0000 1.11 --- physicengine.cc 24 Oct 2004 13:36:59 -0000 1.12 *************** *** 91,95 **** { n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); ! n->SetRot(n->GetRot()+n->GetRotVelocity()*eTime); n->UpdatePosition(); --- 91,95 ---- { n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); ! n->SetRotation(n->GetRotation()+n->GetRotationVelocity()*eTime); n->UpdatePosition(); *************** *** 180,184 **** n->SetOnGround(false); ! n->SetRot(n->GetRot()+n->GetRotVelocity()*eTime); n->UpdatePosition(); --- 180,184 ---- n->SetOnGround(false); ! n->SetRotation(n->GetRotation()+n->GetRotationVelocity()*eTime); n->UpdatePosition(); Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** scenemanager.cc 21 Oct 2004 21:18:28 -0000 1.8 --- scenemanager.cc 24 Oct 2004 13:36:59 -0000 1.9 *************** *** 68,74 **** ! /*Vector3 Target = pCamera->GetForward(); ! Target = pCamera->vPosition+Target*10000; ! CollisionResult myResult = Trace(pCamera->vPosition, Target); glPointSize(5.0f); --- 68,75 ---- ! //Vector3 Target = pCamera->GetForward(); ! Vector3 Target = Vector3::UNIT_X; ! Target = pCamera->GetForward()+Target*100000; ! CollisionResult myResult = pPhysicEngine->Trace(pCamera->GetForward(), Target); glPointSize(5.0f); *************** *** 81,85 **** GLUquadric* pquad = gluNewQuadric(); gluSphere( pquad, 10,10,10); ! glPopMatrix();*/ } --- 82,86 ---- GLUquadric* pquad = gluNewQuadric(); gluSphere( pquad, 10,10,10); ! glPopMatrix(); } *************** *** 101,105 **** #endif #ifdef DEBUG ! Engine::pRenderer->RenderBBox(m->GetBBox()); #endif } --- 102,106 ---- #endif #ifdef DEBUG ! //Engine::pRenderer->RenderBBox(m->GetBBox()); #endif } Index: physicnode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicnode.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** physicnode.cc 21 Oct 2004 21:21:00 -0000 1.1 --- physicnode.cc 24 Oct 2004 13:36:59 -0000 1.2 *************** *** 24,28 **** n = vNodes[i]; n->SetPosition(vPosition); ! n->SetEuler(vEuler); } } --- 24,28 ---- n = vNodes[i]; n->SetPosition(vPosition); ! n->SetRotation(vEuler); } } Index: physicnode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicnode.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** physicnode.h 21 Oct 2004 21:21:00 -0000 1.1 --- physicnode.h 24 Oct 2004 13:36:59 -0000 1.2 *************** *** 86,92 **** /* Rotation */ ! inline Vector3 GetRot () { return vEuler; } ! inline void SetRot (const Vector3& v) { vEuler = v; } ! inline void AddRot (const Vector3& v) { vEuler += v; } inline float GetXRot () { return vEuler.x; } inline float GetYRot () { return vEuler.y; } --- 86,92 ---- /* Rotation */ ! inline Vector3 GetRotation () { return vEuler; } ! inline void SetRotation (const Vector3& v) { vEuler = v; } ! inline void AddRotation (const Vector3& v) { vEuler += v; } inline float GetXRot () { return vEuler.x; } inline float GetYRot () { return vEuler.y; } *************** *** 100,105 **** /* Vitesse de rotation */ ! inline Vector3 GetRotVelocity () { return vEulerVelocity; } ! inline void SetRotVelocity (const Vector3& v) { vEulerVelocity = v; } inline void AddRotVelocity (const Vector3& v) { vEulerVelocity += v; } inline float GetXRotVelocity () { return vEulerVelocity.x; } --- 100,105 ---- /* Vitesse de rotation */ ! inline Vector3 GetRotationVelocity () { return vEulerVelocity; } ! inline void SetRotationVelocity (const Vector3& v) { vEulerVelocity = v; } inline void AddRotVelocity (const Vector3& v) { vEulerVelocity += v; } inline float GetXRotVelocity () { return vEulerVelocity.x; } Index: camera.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/camera.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** camera.h 26 Sep 2004 13:15:05 -0000 1.1.1.1 --- camera.h 24 Oct 2004 13:36:59 -0000 1.2 *************** *** 16,22 **** { public: ! float fYaw, fPitch, fRoll; float fSpeed; float fSensivity; /** * Variables utilises pour deplacer la camera --- 16,24 ---- { public: ! //float fYaw, fPitch, fRoll; float fSpeed; float fSensivity; + + Vector3 vRot; /** * Variables utilises pour deplacer la camera Index: quaternion.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/quaternion.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** quaternion.h 26 Sep 2004 13:15:18 -0000 1.1.1.1 --- quaternion.h 24 Oct 2004 13:36:59 -0000 1.2 *************** *** 17,24 **** { public: ! Quaternion () : r(1), x(0), y(0), z(0) {} //par defaut, on met le quaternion identite ! Quaternion (float f, float i, float j, float k) { SetRotation(f,i,j,k); } ! Quaternion (const Quaternion& q) : r(q.r), x(q.x), y(q.y), z(q.z) {} ! Quaternion (float f, Vector3 v) { SetRotation(f, v);} Quaternion operator = (const Quaternion& q); --- 17,24 ---- { public: ! inline Quaternion () : r(1), x(0), y(0), z(0) {} //par defaut, on met le quaternion identite ! inline Quaternion (float f, float i, float j, float k) { SetRotation(f,i,j,k); } ! inline Quaternion (const Quaternion& q) : r(q.r), x(q.x), y(q.y), z(q.z) {} ! inline Quaternion (float f, Vector3 v) { SetRotation(f, v);} Quaternion operator = (const Quaternion& q); *************** *** 34,38 **** Quaternion operator * (float f); Quaternion operator *= (float f); ! float Norm (); float Magnitude (); --- 34,39 ---- Quaternion operator * (float f); Quaternion operator *= (float f); ! ! inline void Null() { r=1;x=y=z=0; } float Norm (); float Magnitude (); Index: glrenderer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** glrenderer.cc 21 Oct 2004 21:18:28 -0000 1.8 --- glrenderer.cc 24 Oct 2004 13:36:59 -0000 1.9 *************** *** 776,782 **** void GLRenderer::_RotateNode (SceneNode* s) { ! glRotatef(s->GetXRot(), 1, 0, 0); ! glRotatef(s->GetYRot(), 0, 1, 0); ! glRotatef(s->GetZRot(), 0, 0, 1); } --- 776,784 ---- void GLRenderer::_RotateNode (SceneNode* s) { ! glRotatef(s->GetRotation().x, 1, 0, 0); ! glRotatef(s->GetRotation().y, 0, 1, 0); ! glRotatef(s->GetRotation().z, 0, 0, 1); ! /*Vector3 axis = s->GetRotation().GetRotationAxis(); ! glRotatef(s->GetRotation().GetRotationAngle(),axis.x, axis.y, axis.z);*/ } *************** *** 1060,1063 **** --- 1062,1087 ---- glTranslatef(mesh->GetPosition().x, mesh->GetPosition().y, mesh->GetPosition().z); + + #ifdef DEBUG + Vector3 fwd, rgt, up; + mesh->GetRotation().ToAngleVectors(fwd, rgt, up); + fwd *= 10; + rgt *= 10; + up *= 10; + 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 (); + #endif + _RotateNode(mesh); *************** *** 1080,1086 **** glEnable(GL_CULL_FACE); glFrontFace(GL_CW); - //std::cout << "adress : " << mesh << std::endl; - for (unsigned int j=0; j<iNumMeshes; j++) { --- 1104,1108 ---- *************** *** 1097,1106 **** if (mesh->GetMaterial(j) && mesh->GetMaterial(j)->HasPrimary()) glBindTexture (GL_TEXTURE_2D, mesh->GetMaterial(j)->GetFirstTexture()->iId); ! /*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);*/ ! glBegin (GL_TRIANGLES); for (unsigned int i=0; i<mesh->GetTrianglesCount(j)*3; i++) { --- 1119,1128 ---- if (mesh->GetMaterial(j) && mesh->GetMaterial(j)->HasPrimary()) glBindTexture (GL_TEXTURE_2D, mesh->GetMaterial(j)->GetFirstTexture()->iId); ! 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); ! /*glBegin (GL_TRIANGLES); for (unsigned int i=0; i<mesh->GetTrianglesCount(j)*3; i++) { *************** *** 1110,1114 **** //std::cout << "\t" << pIndexes[i] << std::endl; } ! glEnd (); --- 1132,1136 ---- //std::cout << "\t" << pIndexes[i] << std::endl; } ! glEnd ();*/ Index: camera.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/camera.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** camera.cc 21 Oct 2004 21:18:28 -0000 1.3 --- camera.cc 24 Oct 2004 13:36:59 -0000 1.4 *************** *** 9,15 **** fSpeed = s; fSensivity = sen; ! fYaw = fY; ! fPitch = fP; ! fRoll = fR; iForward = 0; iStrafe = 0; --- 9,15 ---- fSpeed = s; fSensivity = sen; ! vRot.y = fY; ! vRot.z = fP; ! vRot.x = fR; iForward = 0; iStrafe = 0; *************** *** 25,29 **** void Camera::Update (float time) { ! if (Engine::pConsole->GetState()) //si la console est ouverte, on desactive la souris) return; --- 25,29 ---- void Camera::Update (float time) { ! if (Engine::pConsole->GetState()) //si la console est ouverte, on desactive la souris return; *************** *** 35,40 **** //On se fout du temps pour ce qui est des mouvements de souris... ! fYaw += ((float)mX-middleX)*fSensivity/**time*/*6; ! fPitch += ((float)mY-middleY)*fSensivity/*time*/*6; SDL_WarpMouse (middleX, middleY); --- 35,40 ---- //On se fout du temps pour ce qui est des mouvements de souris... ! vRot.y += ((float)mX-middleX)*fSensivity/**time*/*6; ! vRot.x += ((float)mY-middleY)*fSensivity/*time*/*6; SDL_WarpMouse (middleX, middleY); *************** *** 94,103 **** }*/ ! _AngleToVectors (); } /** * Tire de la methode du meme nom de Quake II */ ! void Camera::_AngleToVectors() { --- 94,104 ---- }*/ ! vRot.ToAngleVectors(vForward, vRight, vUp); ! //_AngleToVectors (); } /** * Tire de la methode du meme nom de Quake II */ ! /*void Camera::_AngleToVectors() { *************** *** 128,153 **** vUp.y = 1; vUp.z = 0; ! /* ! ! ! vForward.x = cos_p*cos_y; ! vForward.y = -1*sin_p; ! vForward.z = -1*cos_p*sin_y; ! ! vRight.x = -1*sin_r*sin_p*cos_y+-1*cos_r*-sin_y; ! vRight.y = -1*sin_r*cos_p; ! vRight.z = sin_r*sin_p*sin_y+cos_r*cos_y; ! ! vUp.x = cos_r*sin_p*cos_y-sin_r*-sin_y; ! vUp.y = cos_r*cos_p; ! vUp.z = -cos_r*sin_p*sin_y+sin_r*cos_y; ! */ ! } void Camera::Look () { glMatrixMode (GL_MODELVIEW); ! glRotatef(fPitch, 1.0f, 0.0f, 0.0f); ! glRotatef(fYaw, 0.0f, 1.0f, 0.0f); glTranslatef(-vPosition.x, -vPosition.y, -vPosition.z); frustum.Update(); --- 129,139 ---- vUp.y = 1; vUp.z = 0; ! }*/ void Camera::Look () { glMatrixMode (GL_MODELVIEW); ! glRotatef(vRot.x, 1.0f, 0.0f, 0.0f); ! glRotatef(vRot.y, 0.0f, 1.0f, 0.0f); glTranslatef(-vPosition.x, -vPosition.y, -vPosition.z); frustum.Update(); Index: vector3.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/vector3.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** vector3.h 10 Oct 2004 20:49:09 -0000 1.2 --- vector3.h 24 Oct 2004 13:36:59 -0000 1.3 *************** *** 17,21 **** ~Vector3 () {}; ! void Cross(const Vector3 &v1, const Vector3 &v2); float Magnitude() const; --- 17,22 ---- ~Vector3 () {}; ! void ToAngleVectors (Vector3&, Vector3&, Vector3&); ! void Cross(const Vector3 &v1, const Vector3 &v2); float Magnitude() const; Index: scenenode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** scenenode.h 21 Oct 2004 21:18:28 -0000 1.4 --- scenenode.h 24 Oct 2004 13:36:59 -0000 1.5 *************** *** 35,40 **** /* Rotation */ ! Vector3 GetEuler () { return vEuler; } ! virtual void SetEuler (const Vector3& v) { vEuler = v; } inline float GetXRot () { return vEuler.x; } inline float GetYRot () { return vEuler.y; } --- 35,40 ---- /* Rotation */ ! Vector3 GetRotation () { return vEuler; } ! virtual void SetRotation (const Vector3& v) { vEuler = v; } inline float GetXRot () { return vEuler.x; } inline float GetYRot () { return vEuler.y; } Index: vector3.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/vector3.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vector3.cc 26 Sep 2004 13:15:17 -0000 1.1.1.1 --- vector3.cc 24 Oct 2004 13:36:59 -0000 1.2 *************** *** 5,8 **** --- 5,51 ---- { + void Vector3::ToAngleVectors(Vector3& forward, Vector3& right, Vector3& up) + { + float angle; + float sr, sp, sy, cr, cp, cy; + /* + * Ces formules sont prises de Quake II (q_shared.c:AngleVectors) + * Il faut savoir que par rapport a q2, les axes de tg sont pas les memes : + * y = z; + * z = -y; + */ + //Ca devrait etre y, mais pour utiliser les formules de q2, on inverse + angle = z*DEGTORAD; + sy = sinf(angle); + cy = cosf(angle); + //ca devrait etre z, mais pour utiliser les formules de q2, on echange + angle = y*DEGTORAD; + sp = sinf(angle); + cp = cosf(angle); + angle = x*DEGTORAD; + sr = sinf(angle); + cr = cosf(angle); + + forward.x = cp*cy; + forward.y = cp*sy; + forward.z = -sp; + + right.x = cr*sp*cy+-sr*-sy; + right.y = cr*sp*sy+-sr*cy; + right.z = cr*cp; + + up.x = sr*sp*cy+cr*-sy; + up.y = sr*sp*sy+cr*cy; + up.z = sr*cp; + + /*Vector3 tmp = up; + up = -right; + right = tmp;*/ + + /*forward.Set(cp*cy, cp*sy, -sp); + up.Set(cr*sp*cy+-sr*-sy,cr*sp*sy+-sr*cy, cr*cp); + right.Set(-1*sr*sp*cy+-1*cr*-sy,-1*sr*sp*sy+-1*cr*cy,-1*sr*cp);*/ + } + void Vector3::Cross(const Vector3 &v1, const Vector3 &v2) { Index: glrenderernv15.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderernv15.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** glrenderernv15.cc 21 Oct 2004 21:18:28 -0000 1.6 --- glrenderernv15.cc 24 Oct 2004 13:36:59 -0000 1.7 *************** *** 55,59 **** //vObjectLightPosition.Set(50*sinf(angle),0, 60*cosf(angle)); ! float transform[16]; glPushMatrix(); glLoadIdentity(); --- 55,59 ---- //vObjectLightPosition.Set(50*sinf(angle),0, 60*cosf(angle)); ! /*float transform[16]; glPushMatrix(); glLoadIdentity(); *************** *** 67,71 **** glPopMatrix(); vObjectLightPosition = Util::MultVectorMatrix44(vLightPos, transform); ! /*glPushMatrix(); glTranslatef(vObjectLightPosition.x, vObjectLightPosition.y, vObjectLightPosition.z); --- 67,71 ---- glPopMatrix(); vObjectLightPosition = Util::MultVectorMatrix44(vLightPos, transform); ! */ /*glPushMatrix(); glTranslatef(vObjectLightPosition.x, vObjectLightPosition.y, vObjectLightPosition.z); |
|
From: Seb <whi...@us...> - 2004-10-22 20:31:19
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8982 Modified Files: soundmanager.cc Log Message: Parsage du fichier sons termine. Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** soundmanager.cc 22 Oct 2004 19:39:04 -0000 1.12 --- soundmanager.cc 22 Oct 2004 20:31:08 -0000 1.13 *************** *** 626,630 **** { ifstream file; ! char buffer [1024]; file.open (filename, ios::in); --- 626,633 ---- { ifstream file; ! char name [1024]; ! ! bool relative; ! bool looping; file.open (filename, ios::in); *************** *** 638,643 **** while (!file.eof()) { ! file.getline(buffer, 1024); ! AddSound(buffer,false,false); } } --- 641,646 ---- while (!file.eof()) { ! file >> name >> relative >> looping ; ! AddSound(name,relative,looping); } } |
|
From: Seb <whi...@us...> - 2004-10-22 20:30:35
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8762 Modified Files: game.cc Log Message: Sons Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** game.cc 22 Oct 2004 19:42:28 -0000 1.17 --- game.cc 22 Oct 2004 20:30:22 -0000 1.18 *************** *** 37,49 **** SoundManager::pSoundManager = pSoundManager; - - //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. - //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... - pSoundManager->AddSound("fire",false,true); - pSoundManager->AddSound("thunder",false,true); - //pSoundManager->AddSound("Music",true,true); ! pSoundManager->AddSound("step",true,true); ! pSoundManager->AddSound("gun",true,false); //On prend les coordonnees de la tete de mort avec la lumiere rose --- 37,54 ---- SoundManager::pSoundManager = pSoundManager; ! /* ! On ajoute plus les sons ici. On utilise un fichier file.snd qui contient le nom des ! sons a ajouter. Il faut creer le fichier file.snd qui contient: ! ! fire 0 1 ! thunder 0 1 ! scared2 0 1 ! step 1 1 ! gun 1 1 ! ! et placer le dans data/sounds ! ! */ //On prend les coordonnees de la tete de mort avec la lumiere rose |
|
From: Seb <whi...@us...> - 2004-10-22 19:42:48
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30803 Modified Files: game.cc Log Message: Modification pour utiliser la nouvelle methode AddSound Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** game.cc 21 Oct 2004 21:29:15 -0000 1.16 --- game.cc 22 Oct 2004 19:42:28 -0000 1.17 *************** *** 37,48 **** SoundManager::pSoundManager = pSoundManager; //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... ! pSoundManager->AddWAV("fire",false,true); ! pSoundManager->AddWAV("thunder",false,true); ! //pSoundManager->AddOGG("Music",true,true); ! pSoundManager->AddWAV("step",true,true); ! pSoundManager->AddWAV("gun",true,false); //On prend les coordonnees de la tete de mort avec la lumiere rose --- 37,49 ---- SoundManager::pSoundManager = pSoundManager; + //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... ! pSoundManager->AddSound("fire",false,true); ! pSoundManager->AddSound("thunder",false,true); ! //pSoundManager->AddSound("Music",true,true); ! pSoundManager->AddSound("step",true,true); ! pSoundManager->AddSound("gun",true,false); //On prend les coordonnees de la tete de mort avec la lumiere rose |
|
From: Seb <whi...@us...> - 2004-10-22 19:39:21
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30032 Modified Files: Makefile soundmanager.cc Log Message: Oups ! Oublie une petite erreur ;-) Index: Makefile =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile 13 Oct 2004 23:08:37 -0000 1.10 --- Makefile 22 Oct 2004 19:39:04 -0000 1.11 *************** *** 6,10 **** clean: - rm -f out/* rm -f *.o rm -f *~ --- 6,9 ---- Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** soundmanager.cc 22 Oct 2004 19:26:55 -0000 1.11 --- soundmanager.cc 22 Oct 2004 19:39:04 -0000 1.12 *************** *** 640,648 **** file.getline(buffer, 1024); AddSound(buffer,false,false); - - while (buffer.find("numbones") == std::string::npos) - file >> buffer; - - file >> numBones; } } --- 640,643 ---- |
|
From: Seb <whi...@us...> - 2004-10-22 19:27:04
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26919 Modified Files: soundmanager.cc soundmanager.h Log Message: Une seule methode pour ajouter un son que ce soit un ogg ou un wav, detection automatique ! Plus une nouvelle methode qui parse un fichier et ajoute au sound manager tous les sons demande ! Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** soundmanager.cc 16 Oct 2004 15:26:48 -0000 1.10 --- soundmanager.cc 22 Oct 2004 19:26:55 -0000 1.11 *************** *** 72,75 **** --- 72,77 ---- Engine::pVarManager->AddVar("sound", 1); enable = &Engine::pVarManager->GetVar("sound")->intValue; + + ParseSoundFile("data/sounds/file.snd"); } *************** *** 78,84 **** int SoundManager::MainLoop(void* arg) { ! bool done = false; int* check; ! while (!done) { --- 80,86 ---- int SoundManager::MainLoop(void* arg) { ! bool done = false; int* check; ! while (!done) { *************** *** 90,94 **** pSoundManager->EnableSoundManager(); ! SDL_Delay(80); } --- 92,96 ---- pSoundManager->EnableSoundManager(); ! SDL_Delay(80); } *************** *** 155,159 **** } ! // Creat a new buffer for a sound ALuint SoundManager::LoadWavALBuffer(char path[40]) { --- 157,207 ---- } ! // Add a Wav or Ogg sound to the sounds list ! void SoundManager::AddSound(string name, bool relative,bool looping) ! { ! string ogg_tmp_name, wav_tmp_name; ! char *ogg_path, *wav_path; ! ! try ! { ! #ifdef SOUND_DEBUG ! cout << "OpenAL:: AddSound: " << name << endl; ! #endif ! ! wav_tmp_name = "data/sounds/"+name+".wav"; ! ogg_tmp_name = "data/sounds/"+name+".ogg"; ! ! ogg_path = (char*) ogg_tmp_name.c_str(); ! wav_path = (char*) wav_tmp_name.c_str(); ! ! if (fopen(ogg_path, "rb") != NULL) ! { ! SoundList[name] = LoadOggALSample("data/sounds/"+name+".ogg", looping); ! ! if(relative) ! alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); ! } ! else if (fopen(wav_path, "rb") != NULL) ! { ! SoundList[name] = LoadWavALSample("data/sounds/"+name+".wav", looping); ! ! if(relative) ! alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); ! } ! else ! { ! cerr << "OpenAL:: Cannot find " << name << " for reading..." << endl; ! } ! ! } ! catch(string err) ! { ! cerr << "OpenAL error: " << err.c_str() << endl; ! } ! ! LoadedFiles.clear(); ! } ! ! // Create a new buffer for a sound ALuint SoundManager::LoadWavALBuffer(char path[40]) { *************** *** 281,324 **** return source; } - - // Add a Wav sound to the sounds list - void SoundManager::AddWAV(string name, bool relative,bool looping) - { - FILE *f; - string tmp_name; - char *path; - - try - { - #ifdef SOUND_DEBUG - cout << "OpenAL:: AddWAV: " << name << endl; - #endif - - tmp_name = "data/sounds/"+name+".wav"; - - path = (char*) tmp_name.c_str(); - - f = fopen(path, "rb"); - - if (f == NULL) - { - cerr << "OpenAL:: Cannot open " << tmp_name << " for reading..." << endl; - } - else - { - SoundList[name] = LoadWavALSample("data/sounds/"+name+".wav", looping); - - if(relative) - alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); - } - - } - catch(string err) - { - cerr << "OpenAL error: " << err.c_str() << endl; - } - - LoadedFiles.clear(); - } // Creat a new buffer for a sound --- 329,332 ---- *************** *** 432,475 **** } - // Add a Wav sound to the sounds list - void SoundManager::AddOGG(string name, bool relative,bool looping) - { - FILE *f; - string tmp_name; - char *path; - - try - { - #ifdef SOUND_DEBUG - cout << "OpenAL:: AddOGG: " << name << endl; - #endif - - tmp_name = "data/sounds/"+name+".ogg"; - - path = (char*) tmp_name.c_str(); - - f = fopen(path, "rb"); - - if (f == NULL) - { - cerr << "OpenAL:: Cannot open " << tmp_name << " for reading..." << endl; - } - else - { - SoundList[name] = LoadOggALSample("data/sounds/"+name+".ogg", looping); - - if(relative) - alSourcei(SoundList[name],AL_SOURCE_RELATIVE,AL_TRUE); - } - - } - catch(string err) - { - cerr << "OpenAL:: Error: " << err.c_str() << endl; - } - - LoadedFiles.clear(); - } - // This function loads a .ogg file into a memory buffer and returns the format and frequency. void SoundManager::LoadOGG(char *fileName, vector<char> &buffer, ALenum &format, ALsizei &freq) --- 440,443 ---- *************** *** 654,657 **** --- 622,651 ---- } + // Parse a sound file + void SoundManager::ParseSoundFile (char* filename) + { + ifstream file; + char buffer [1024]; + + file.open (filename, ios::in); + if (file.fail()) + { + cerr << "OpenAL:: Cannot parse SoundFile: " << filename << endl; + return; + } + + // Read each line + while (!file.eof()) + { + file.getline(buffer, 1024); + AddSound(buffer,false,false); + + while (buffer.find("numbones") == std::string::npos) + file >> buffer; + + file >> numBones; + } + } + // Handling Errors string SoundManager::GetALErrorString(ALenum err) Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** soundmanager.h 16 Oct 2004 15:26:48 -0000 1.5 --- soundmanager.h 22 Oct 2004 19:26:55 -0000 1.6 *************** *** 52,57 **** SoundManager(); ! void AddWAV(string name, bool relative,bool looping); ! void AddOGG(string name, bool relative,bool looping); bool CheckSound(string name); --- 52,56 ---- SoundManager(); ! void AddSound(string name, bool relative,bool looping); bool CheckSound(string name); *************** *** 96,99 **** --- 95,100 ---- void LoadOGG(char *fileName, vector<char> &buffer, ALenum &format, ALsizei &freq); + void ParseSoundFile (char* filename); + vector<string> LoadedFiles; // Holds loaded file paths temporarily. vector<ALuint> Buffers; // Holds all loaded buffers. |
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5695 Modified Files: aicontroller.cc config.cfg controller.cc controller.h game.cc model.cc model.h pawn.cc pawn.h playercontroller.cc world.h Log Message: Index: config.cfg =================================================================== RCS file: /cvsroot/epfl/tggame/config.cfg,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** config.cfg 13 Oct 2004 23:46:13 -0000 1.5 --- config.cfg 21 Oct 2004 21:29:15 -0000 1.6 *************** *** 5,7 **** -set lightpos.y 0 -set bump 0 - -set sound 1 --- 5,6 ---- Index: world.h =================================================================== RCS file: /cvsroot/epfl/tggame/world.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** world.h 10 Oct 2004 21:18:41 -0000 1.3 --- world.h 21 Oct 2004 21:29:15 -0000 1.4 *************** *** 57,60 **** --- 57,62 ---- */ int GetNumPointLights (); + + Q3Bsp* GetMap() { return pMap; } protected: void _Load(char*); Index: model.h =================================================================== RCS file: /cvsroot/epfl/tggame/model.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** model.h 15 Oct 2004 14:01:01 -0000 1.6 --- model.h 21 Oct 2004 21:29:15 -0000 1.7 *************** *** 1,2 **** --- 1,3 ---- + #if 0 #ifndef _TGMODEL_H #define _TGMODEL_H *************** *** 57,60 **** --- 58,64 ---- inline void SetAcceleration (const Vector3& v) { pMD5->SetAccel(v); } inline Vector3 GetAcceleration () { return pMD5->GetAccel(); } + inline Vector3 GetVelocity () { return pMD5->GetVelocity(); } + inline void SetVelocity (const Vector3& v) { pMD5->SetVelocity(v); } + protected: bool _ParseMDLFile (char*); *************** *** 62,68 **** MD5Instance* pMD5; - MD5Mesh10* pMD5Mesh; }; #endif --- 66,72 ---- MD5Instance* pMD5; }; #endif + #endif Index: model.cc =================================================================== RCS file: /cvsroot/epfl/tggame/model.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** model.cc 15 Oct 2004 14:17:25 -0000 1.4 --- model.cc 21 Oct 2004 21:29:15 -0000 1.5 *************** *** 1,2 **** --- 1,3 ---- + #if 0 #include "model.h" *************** *** 39,45 **** meshname += buffer; ! pMD5Mesh = new MD5Mesh10 (); ! pMD5Mesh->LoadMesh ((char*)meshname.data()); ! pMD5 = new MD5Instance(pMD5Mesh); NEXT("numAnimations") pFD >> numAnims; --- 40,44 ---- meshname += buffer; ! pMD5 = Engine::pMeshManager->Load((char*)meshname.data()); NEXT("numAnimations") pFD >> numAnims; *************** *** 56,60 **** NEXT("anim") pFD >> buffer; ! pMD5Mesh->LoadAnim ((char*)(animname+buffer).data()); } if (numAnims > 0) --- 55,59 ---- NEXT("anim") pFD >> buffer; ! //pMD5Mesh->LoadAnim ((char*)(animname+buffer).data()); } if (numAnims > 0) *************** *** 72,74 **** --- 71,74 ---- p->AddNode (pMD5); } + #endif Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** game.cc 16 Oct 2004 14:36:57 -0000 1.15 --- game.cc 21 Oct 2004 21:29:15 -0000 1.16 *************** *** 77,85 **** { if (scene) ! p->GetModel()->Add(pSceneManager); if (physic && scene) ! p->GetModel()->Add(pPhysicEngine); ! if (p->GetCamera() && physic) ! pPhysicEngine->AddNode(p->GetCamera()); } --- 77,83 ---- { if (scene) ! p->Add(pSceneManager); if (physic && scene) ! p->Add(pPhysicEngine); } *************** *** 89,111 **** //on ajoute _pas_ le pawn au scenemanager #ifndef TGWIN32 ! #define CAM_SPEED 15000 #else ! #define CAM_SPEED 150000 #endif Camera* cam = new Camera (0.025f,CAM_SPEED, Vector3 (0, 100,0)); //TODO: on devrait plutot se base sur la bounding box du model ! cam->pBBox->vMin = Vector3(-10, -70, -10); ! cam->pBBox->vMax = Vector3(10, 10, 10); ! Pawn* p = new Pawn(cam); pSceneManager->SetCamera(cam); vPawns.push_back(p); ! this->AddPawn(p, true, false); pLocalController = new PlayerController(p); vControllers.push_back(pLocalController); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(20,70,20)); ! p->GetCamera()->SetPhysicCallBack(pLocalController); ! //création d'un ennemi p = new Pawn(); --- 87,122 ---- //on ajoute _pas_ le pawn au scenemanager #ifndef TGWIN32 ! #define CAM_SPEED 450 #else ! #define CAM_SPEED 4500 #endif Camera* cam = new Camera (0.025f,CAM_SPEED, Vector3 (0, 100,0)); //TODO: on devrait plutot se base sur la bounding box du model ! //cam->pBBox->vMin = Vector3(-10, -70, -10); ! //cam->pBBox->vMax = Vector3(10, 10, 10); ! Pawn* p = new Pawn(); pSceneManager->SetCamera(cam); vPawns.push_back(p); ! this->AddPawn(p); pLocalController = new PlayerController(p); vControllers.push_back(pLocalController); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(20,80,20)); ! p->Attach (cam); ! p->SetPosition (Vector3(100,80,100)); ! p->GetBBox()->vMin = Vector3(-10, -70, -10); ! p->GetBBox()->vMax = Vector3(10,10,10); ! p->SetMoveSpeed (CAM_SPEED); ! //p->GetCamera()->SetPhysicCallBack(pLocalController); + MD5Instance* pMD5 = Engine::pMeshManager->Load("data/models/cube/cube.md5mesh"); + pSceneManager->AddWorldObject (pMD5); + pMD5->SetPosition(Vector3(0,50,0)); + PhysicNode* pNode = new PhysicNode(pMD5); + pPhysicEngine->AddNode(pNode); + pNode->SetPosition (Vector3(100,50,0)); + //pNode->SetYRot (45); + + //création d'un ennemi p = new Pawn(); *************** *** 114,120 **** Controller* c = new AIController(p); vControllers.push_back(c); ! p->SetMoveSpeed(15000); ! p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(0,30,0)); ! p->GetModel()->SetPhysicCallBack(c); } --- 125,134 ---- Controller* c = new AIController(p); vControllers.push_back(c); ! p->SetMoveSpeed(CAM_SPEED); ! p->SetVelocity(Vector3(0,0,0)); ! p->SetPosition(Vector3(0,10,0)); ! p->SetRotVelocity(Vector3(0,20,0)); ! //p->SetPosition(pWorld->GetRandomStartPosition()+Vector3(0,30,0)); ! //p->GetModel()->SetPhysicCallBack(c); } *************** *** 184,186 **** } - --- 198,199 ---- Index: controller.h =================================================================== RCS file: /cvsroot/epfl/tggame/controller.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** controller.h 10 Oct 2004 21:18:41 -0000 1.4 --- controller.h 21 Oct 2004 21:29:15 -0000 1.5 *************** *** 27,37 **** protected: Pawn* pPawn; //pour les mouvements ! int iForward; ! int iStrafe; ! //pour l'orientation de la vue ! float fYaw; ! float fPitch; ! float fRoll; }; --- 27,35 ---- protected: Pawn* pPawn; + bool bDir[4]; + bool bLastDir[4]; //pour les mouvements ! //int iForward; ! //int iStrafe; }; Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** aicontroller.cc 15 Oct 2004 14:00:53 -0000 1.3 --- aicontroller.cc 21 Oct 2004 21:29:14 -0000 1.4 *************** *** 39,43 **** std::cout << "\n\n---[AI]--- C'est parti pour l'IA" << std::endl; initialised=true; - iForward=1; // srand( (unsigned)time( NULL ) ); } --- 39,42 ---- Index: pawn.h =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pawn.h 10 Oct 2004 20:54:47 -0000 1.4 --- pawn.h 21 Oct 2004 21:29:15 -0000 1.5 *************** *** 4,9 **** #include <vector3.h> #include <camera.h> ! #include "model.h" #include "actor.h" --- 4,13 ---- #include <vector3.h> #include <camera.h> + #include <md5instance.h> + #include <physicnode.h> + #include <physicengine.h> + #include <scenemanager.h> ! //#include "model.h" #include "actor.h" *************** *** 20,24 **** * @param Camera* un pointeur sur l'éventuelle caméra attachée à ce pawn */ ! Pawn (Camera* c=NULL); /** * Think : méthode appelée à toute les frames (avant le rendu) --- 24,28 ---- * @param Camera* un pointeur sur l'éventuelle caméra attachée à ce pawn */ ! Pawn (); /** * Think : méthode appelée à toute les frames (avant le rendu) *************** *** 26,50 **** */ void Think (float eTime) {} - - inline void SetPosition (const Vector3& v) { pModel->SetPosition(v); if (pCamera) pCamera->SetPosition(v);} ! inline Vector3 GetPosition () ! { ! if (pModel) return pModel->GetPosition(); ! else if (pCamera) return pCamera->GetPosition(); ! return Vector3::ZERO; ! } ! inline Camera* GetCamera () { return pCamera; } inline float GetMoveSpeed () { return fMoveSpeed; } inline void SetMoveSpeed (float s) { fMoveSpeed = s; } ! Model* GetModel () { return pModel; } protected: float fMoveSpeed; ! Model* pModel; ! Camera* pCamera; }; --- 30,61 ---- */ void Think (float eTime) {} ! inline BoundingBox* GetBBox () { return pPhysic->GetBBox(); } ! inline void SetPosition (const Vector3& v) { pPhysic->SetPosition(v); } ! inline void SetVelocity (const Vector3& v) { pPhysic->SetVelocity(v); } ! inline Vector3 GetVelocity () { return pPhysic->GetVelocity(); } ! ! inline Vector3 GetPosition () { return pPhysic->GetPosition(); } + inline void SetRotVelocity (const Vector3& v) { pPhysic->SetRotVelocity(v); } + inline float GetMoveSpeed () { return fMoveSpeed; } inline void SetMoveSpeed (float s) { fMoveSpeed = s; } + + inline void Attach (SceneNode* s) { pPhysic->AttachNode(s); } + + void Add(PhysicEngine* p) {p->AddNode(pPhysic); } + void Add(SceneManager* s) {s->AddWorldObject(pModel); } ! //Model* GetModel () { return pModel; } protected: float fMoveSpeed; ! //Model* pModel; ! MD5Instance* pModel; ! PhysicNode* pPhysic; ! ! //Camera* pCamera; }; Index: playercontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/playercontroller.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** playercontroller.cc 13 Oct 2004 18:59:55 -0000 1.5 --- playercontroller.cc 21 Oct 2004 21:29:15 -0000 1.6 *************** *** 1,4 **** --- 1,5 ---- #include "playercontroller.h" #include <soundmanager.h> + #include "game.h" using namespace tg; *************** *** 26,42 **** { case TGKEY_w: ! iForward += 1; SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_s: ! iForward -= 1; SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_a: ! iStrafe -= 1; SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_d: ! iStrafe += 1; SoundManager::pSoundManager->PlaySound("step"); break; --- 27,47 ---- { case TGKEY_w: ! //iForward += 1; ! bDir[0] = true; SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_s: ! //iForward -= 1; ! bDir[1] = true; SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_a: ! //iStrafe -= 1; ! bDir[2] = true; SoundManager::pSoundManager->PlaySound("step"); break; case TGKEY_d: ! //iStrafe += 1; ! bDir[3] = true; SoundManager::pSoundManager->PlaySound("step"); break; *************** *** 44,47 **** --- 49,55 ---- SoundManager::pSoundManager->PlaySound("gun"); break; + + case TGKEY_RIGHT: + pPawn->SetPosition(Game::pSelf->GetWorld()->GetRandomStartPosition()+Vector3(20,80,20)); default: break; *************** *** 53,63 **** { case TGKEY_w: case TGKEY_s: ! iForward = 0; SoundManager::pSoundManager->StopSound("step"); break; case TGKEY_a: case TGKEY_d: ! iStrafe = 0; SoundManager::pSoundManager->StopSound("step"); break; --- 61,80 ---- { case TGKEY_w: + bDir[0] = false; + SoundManager::pSoundManager->StopSound("step"); + break; case TGKEY_s: ! //iForward = 0; ! bDir[1] = false; SoundManager::pSoundManager->StopSound("step"); break; + case TGKEY_a: + bDir[2] = false; + SoundManager::pSoundManager->StopSound("step"); + break; case TGKEY_d: ! //iStrafe = 0; ! bDir[3] = false; SoundManager::pSoundManager->StopSound("step"); break; *************** *** 68,70 **** } - --- 85,86 ---- Index: controller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/controller.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** controller.cc 11 Oct 2004 12:25:39 -0000 1.4 --- controller.cc 21 Oct 2004 21:29:15 -0000 1.5 *************** *** 5,55 **** { pPawn = p; ! iForward = iStrafe = 0; ! fYaw = fPitch = fRoll = 0; } void Controller::MovePawn () { ! Camera* c; ! //si une caméra est attachée au pawn, on prend les données de la caméra (qui est controlée par la souris) ! if ((c=pPawn->GetCamera())) ! { ! fYaw = c->fYaw; ! fPitch = c->fPitch; ! fRoll = c->fRoll; ! ! c->iForward = iForward; ! c->iStrafe = iStrafe; ! } ! Vector3 vAccel = pPawn->GetModel()->GetAcceleration(); ! vAccel.x = 0; ! vAccel.z = 0; float fSpeed = pPawn->GetMoveSpeed (); float factor = 1.0f; ! //on garde l'accélération sur les y, elle est gérée par le moteur physique ! ! if (iForward >= 1) ! { ! 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; ! } ! pPawn->GetModel()->SetAcceleration(vAccel); } --- 5,59 ---- { pPawn = p; ! //iForward = iStrafe = 0; ! for (int i=0; i<4; i++) { ! bDir[i] = false; ! bLastDir[i] = false; ! } } void Controller::MovePawn () { ! Vector3 vVelocity(0,0,0); ! //vVelocity.x = 0; ! //vVelocity.z = 0; float fSpeed = pPawn->GetMoveSpeed (); float factor = 1.0f; ! //on garde la vitesse sur les y, elle est gérée par le moteur physique ! /*if (iForward >= 1) ! vVelocity.x += fSpeed; else if (iForward <= -1) ! vVelocity.x -= fSpeed; if (iStrafe >= 1) ! vVelocity.z += fSpeed; ! else if (iStrafe <= 1) ! vVelocity.z -= fSpeed;*/ ! if (bDir[0] && !bLastDir[0]) ! vVelocity.z -= fSpeed; ! else if (!bDir[0] && bLastDir[0]) ! vVelocity.z += fSpeed; ! ! if (bDir[1] && !bLastDir[1]) ! vVelocity.z += fSpeed; ! else if (!bDir[1] && bLastDir[1]) ! vVelocity.z -= fSpeed; ! ! if (bDir[2] && !bLastDir[2]) ! vVelocity.x -= fSpeed; ! else if (!bDir[2] && bLastDir[2]) ! vVelocity.x += fSpeed; ! ! if (bDir[3] && !bLastDir[3]) ! vVelocity.x += fSpeed; ! else if (!bDir[3] && bLastDir[3]) ! vVelocity.x -= fSpeed; ! ! for (int i=0; i<4; i++) ! bLastDir[i] = bDir[i]; ! ! //pPawn->GetModel()->SetAcceleration(vAccel); ! pPawn->SetVelocity(pPawn->GetVelocity()+vVelocity); } + Index: pawn.cc =================================================================== RCS file: /cvsroot/epfl/tggame/pawn.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pawn.cc 10 Oct 2004 20:54:47 -0000 1.3 --- pawn.cc 21 Oct 2004 21:29:15 -0000 1.4 *************** *** 3,10 **** using namespace tg; ! Pawn::Pawn(Camera* c) : Actor () { ! pModel = new Model ("data/models/pinky/pinky.mdl", MDL_PLAYER); ! pCamera = c; fMoveSpeed = 0.0f; } --- 3,13 ---- using namespace tg; ! Pawn::Pawn() : Actor () { ! //pModel = new Model ("data/models/pinky/pinky.mdl", MDL_PLAYER); ! //pCamera = c; ! pModel = Engine::pMeshManager->Load("data/models/pinky/pinky.md5mesh"); ! pPhysic = new PhysicNode(pModel); ! pPhysic->SetClip(false); fMoveSpeed = 0.0f; } |
|
From: julien r. <jul...@us...> - 2004-10-21 21:21:14
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4017 Added Files: meshmanager.cc meshmanager.h physicnode.cc physicnode.h Log Message: ajout de physicnode et meshmanager --- NEW FILE: physicnode.cc --- #include "physicnode.h" namespace tg { PhysicNode::PhysicNode(SceneNode* n) { pBBox=n->GetBBox(); bClip=true; bOnGround = false; vNodes.clear(); vNodes.push_back(n); pPhysicCallBack = NULL; vVelocity.Null(); vPosition.Null(); vAccel.Null(); vEuler.Null(); vEulerVelocity.Null(); } void PhysicNode::UpdatePosition () { SceneNode* n; for (unsigned int i=0; i<vNodes.size(); i++) { n = vNodes[i]; n->SetPosition(vPosition); n->SetEuler(vEuler); } } void PhysicNode::CalculateBoundingVolume () { } } --- NEW FILE: physicnode.h --- #ifndef _TGPHYSICNODE_H #define _TGPHYSICNODE_H #include "defs.h" #include "vector3.h" #include "boundingbox.h" #include "scenenode.h" namespace tg { /** * représentation physique d'un ou plusieurs scenenode * les scenenode sont attachés à des physicnodes qui s'occupe de mettre à jour la position des éléments attachés * lors de l'appel à la méthode UpdatePosition du moteur physic */ class PhysicNode { public: PhysicNode (SceneNode* n); ~PhysicNode (); inline void AttachNode (SceneNode* s) { vNodes.push_back(s); } inline BoundingBox* GetBBox () { return pBBox; } /** * Retourne un pointeur sur la classe servant de callback en cas de collision * @return PhysicCallBack* un pointeur sur la classe contenant la méthode callback */ inline PhysicCallBack* GetPhysicCallBack() { return pPhysicCallBack; } /** * Change la classe contenant la méthode callback * @param PhysicCallBack un pointeur sur une instance d'une classe héritant de PhysicCallBack */ 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); } /* Position */ inline void SetPosition (Vector3 v) { vPosition = v; } inline Vector3 GetPosition () { return vPosition; } /* Acceleration */ inline Vector3 GetAccel () { return vAccel; } inline 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; } /* Vitesse */ inline Vector3 GetVelocity () { return vVelocity; } inline void SetVelocity (const Vector3& v) { vVelocity = v; } inline void AddVelocity (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; } /* Rotation */ inline Vector3 GetRot () { return vEuler; } inline void SetRot (const Vector3& v) { vEuler = v; } inline void AddRot (const Vector3& v) { vEuler += v; } inline float GetXRot () { return vEuler.x; } inline float GetYRot () { return vEuler.y; } inline float GetZRot () { return vEuler.z; } inline void SetXRot (float f) { vEuler.x = f; } inline void SetYRot (float f) { vEuler.y = f; } inline void SetZRot (float f) { vEuler.z = f; } inline void AddXRot (float f) { vEuler.x += f; } inline void AddYRot (float f) { vEuler.y += f; } inline void AddZRot (float f) { vEuler.z += f; } /* Vitesse de rotation */ inline Vector3 GetRotVelocity () { return vEulerVelocity; } inline void SetRotVelocity (const Vector3& v) { vEulerVelocity = v; } inline void AddRotVelocity (const Vector3& v) { vEulerVelocity += v; } inline float GetXRotVelocity () { return vEulerVelocity.x; } inline float GetYRotVelocity () { return vEulerVelocity.y; } inline float GetZRotVelocity () { return vEulerVelocity.z; } inline void SetXRotVelocity (float f) { vEulerVelocity.x = f; } inline void SetYRotVelocity (float f) { vEulerVelocity.y = f; } inline void SetZRotVelocity (float f) { vEulerVelocity.z = f; } inline void AddXRotVelocity (float f) { vEulerVelocity.x += f; } inline void AddYRotVelocity (float f) { vEulerVelocity.y += f; } inline void AddZRotVelocity (float f) { vEulerVelocity.z += f; } void UpdatePosition (); void CalculateBoundingVolume (); protected: bool bClip; bool bOnGround; Vector3 vAccel; Vector3 vVelocity; Vector3 vEuler; Vector3 vEulerVelocity; Vector3 vPosition; BoundingBox* pBBox; PhysicCallBack* pPhysicCallBack; typedef std::vector<SceneNode*> SceneNodeList; SceneNodeList vNodes; }; } #endif --- NEW FILE: meshmanager.h --- #ifndef _TGMESHMANAGER_H #define _TGMESHMANAGER_H #include "md5instance.h" namespace tg { class MeshManager { public: MeshManager (); ~MeshManager (); MD5Instance* Load (const std::string& name); protected: typedef std::map<std::string, MD5Mesh10*> MeshesList; MeshesList mMeshes; }; } #endif --- NEW FILE: meshmanager.cc --- #include "meshmanager.h" namespace tg { MeshManager::MeshManager () { MD5Mesh10* m = new MD5Mesh10 (); m->LoadMesh("data/models/fish/fish.md5mesh"); mMeshes["nomesh"] = m; } MeshManager::~MeshManager () { delete mMeshes["nomesh"]; } MD5Instance* MeshManager::Load (const std::string& name) { MeshesList::iterator i = mMeshes.begin (); if((i=mMeshes.find(name)) == mMeshes.end()) //on doit charger le mesh { MD5Mesh10* m = new MD5Mesh10 (); if (m->LoadMesh((char*)name.data())) mMeshes[name] = m; else mMeshes[name] = mMeshes["nomesh"]; } return new MD5Instance(mMeshes[name]); } } |
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) { |
|
From: Seb <whi...@us...> - 2004-10-16 15:26:57
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32572 Modified Files: soundmanager.cc soundmanager.h Log Message: Ajout d'une MainLoop geree par un thread Activation/Desactivation du son par la console: -set sound 0 ou -set sound 1 Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** soundmanager.cc 16 Oct 2004 14:38:28 -0000 1.9 --- soundmanager.cc 16 Oct 2004 15:26:48 -0000 1.10 *************** *** 23,26 **** --- 23,28 ---- Init(); + + LoopThread = SDL_CreateThread(SoundManager::MainLoop,NULL); } *************** *** 73,76 **** --- 75,99 ---- } + // Main Loop running in LoopThread + int SoundManager::MainLoop(void* arg) + { + bool done = false; + int* check; + + while (!done) + { + check = &Engine::pVarManager->GetVar("sound")->intValue; + + if(!*check) + pSoundManager->DisableSoundManager(); + else + pSoundManager->EnableSoundManager(); + + SDL_Delay(80); + } + + return 0; + } + // Disable the Sound Manager and stop all sounds in list void SoundManager::DisableSoundManager() *************** *** 79,84 **** for (; iter!=SoundList.end(); iter++) alSourceStop(iter->second); - - Engine::pVarManager->AddVar("sound", 0); } --- 102,105 ---- *************** *** 86,90 **** void SoundManager::EnableSoundManager() { - Engine::pVarManager->AddVar("sound", 1); } --- 107,110 ---- Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** soundmanager.h 16 Oct 2004 14:38:28 -0000 1.4 --- soundmanager.h 16 Oct 2004 15:26:48 -0000 1.5 *************** *** 23,26 **** --- 23,32 ---- #include <vorbis/vorbisfile.h> + #ifdef TGWIN32 + #include <SDL/SDL_thread.h> + #else + #include <SDL_thread.h> + #endif + #include "engine.h" *************** *** 70,75 **** --- 76,85 ---- int endian; // 0 for Little-Endian, 1 for Big-Endian + + SDL_Thread *LoopThread; void Init(); + + static int MainLoop(void* arg); string GetALErrorString(ALenum err); |
|
From: Seb <whi...@us...> - 2004-10-16 14:38:37
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21546 Modified Files: soundmanager.cc soundmanager.h Log Message: Ajout d'une methode pour mettre a jour l'orientation et la position du listener (appelee depuis Game.cc) Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** soundmanager.cc 16 Oct 2004 14:05:45 -0000 1.8 --- soundmanager.cc 16 Oct 2004 14:38:28 -0000 1.9 *************** *** 2,6 **** #include "soundmanager.h" - #include "engine.h" using std::string; --- 2,5 ---- *************** *** 23,27 **** #endif ! init(); } --- 22,26 ---- #endif ! Init(); } *************** *** 38,42 **** // Intialisation ! void SoundManager::init() { #ifdef SOUND_DEBUG --- 37,41 ---- // Intialisation ! void SoundManager::Init() { #ifdef SOUND_DEBUG *************** *** 120,123 **** --- 119,138 ---- } + // Update Listener orientation and position + void SoundManager::UpdateListener(Camera* ListenerCam) + { + #ifdef SOUND_DEBUG + //cout << "OpenAL:: UpdateListener" << endl; + #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); + } + // Creat a new buffer for a sound ALuint SoundManager::LoadWavALBuffer(char path[40]) Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soundmanager.h 14 Oct 2004 13:46:47 -0000 1.3 --- soundmanager.h 16 Oct 2004 14:38:28 -0000 1.4 *************** *** 23,26 **** --- 23,28 ---- #include <vorbis/vorbisfile.h> + #include "engine.h" + #define BUFFER_SIZE 32768 // 32 KB buffers *************** *** 51,62 **** void PlaySound(string name); void StopSound(string name); - int SoundStatus(string name); void SetSoundVolume(string name, float x); - void SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz); void SetListenerPosition(float x, float y, float z); void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz); void KillALData(); --- 53,64 ---- void PlaySound(string name); void StopSound(string name); int SoundStatus(string name); void SetSoundVolume(string name, float x); void SetSoundProperties(string name, float x, float y, float z, float vx, float vy, float vz); + void SetListenerPosition(float x, float y, float z); void SetListenerOrientation(float fx, float fy, float fz, float ux, float uy, float uz); + void UpdateListener(Camera* ListenerCam); void KillALData(); *************** *** 69,74 **** int endian; // 0 for Little-Endian, 1 for Big-Endian ! void init(); ! string GetALErrorString(ALenum err); string GetALCErrorString(ALenum err); --- 71,76 ---- int endian; // 0 for Little-Endian, 1 for Big-Endian ! void Init(); ! string GetALErrorString(ALenum err); string GetALCErrorString(ALenum err); |
|
From: Seb <whi...@us...> - 2004-10-16 14:37:06
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21227 Modified Files: game.cc Log Message: La mise a jour de la position et l'orientation du listener se fait maintenant par l'appel a une methode du soundmanager Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** game.cc 15 Oct 2004 14:01:01 -0000 1.14 --- game.cc 16 Oct 2004 14:36:57 -0000 1.15 *************** *** 122,133 **** { Camera* myCam = pSceneManager->GetCamera(); ! ! Vector3 position = myCam->GetPosition(); ! ! Vector3 forward = myCam->GetForward(); ! Vector3 up = myCam->GetUp(); ! ! pSoundManager->SetListenerPosition(position.x,position.y,position.z); ! pSoundManager->SetListenerOrientation(forward.x,forward.y,forward.z,up.x,up.y,up.z); float t = pTimer->GetFrameInterval (); --- 122,126 ---- { Camera* myCam = pSceneManager->GetCamera(); ! pSoundManager->UpdateListener(myCam); float t = pTimer->GetFrameInterval (); |
|
From: Seb <whi...@us...> - 2004-10-16 14:05:56
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12647 Modified Files: soundmanager.cc Log Message: Changement de cout en cerr pour differencier Log et Erreur Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** soundmanager.cc 15 Oct 2004 20:49:27 -0000 1.7 --- soundmanager.cc 16 Oct 2004 14:05:45 -0000 1.8 *************** *** 281,285 **** catch(string err) { ! cout << "OpenAL error: " << err.c_str() << endl; } --- 281,285 ---- catch(string err) { ! cerr << "OpenAL error: " << err.c_str() << endl; } *************** *** 431,435 **** catch(string err) { ! cout << "OpenAL:: Error: " << err.c_str() << endl; } --- 431,435 ---- catch(string err) { ! cerr << "OpenAL:: Error: " << err.c_str() << endl; } |
|
From: Seb <whi...@us...> - 2004-10-16 14:01:43
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11769 Modified Files: Makefile.OSX Log Message: Qq changement pour le makefile OSX Index: Makefile.OSX =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/Makefile.OSX,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile.OSX 13 Oct 2004 23:12:52 -0000 1.6 --- Makefile.OSX 16 Oct 2004 14:01:34 -0000 1.7 *************** *** 6,9 **** --- 6,10 ---- OBJSRC = $(wildcard *.cc) OBJS = $(addsuffix .${OBJ_EXT}, $(basename $(OBJSRC))) + LIBS = -lvorbis -lvorbisfile -framework OpenAL `sdl-config --libs` -lSDL_image CFLAGS = -DTGOSX -O3 -DDEBUG -DSOUND_DEBUG CC = g++ *************** *** 13,17 **** all : $(OBJS) ! g++ -dynamiclib `sdl-config --libs` -lSDL_image -lvorbis -lvorbisfile -framework OpenAL -o out/libtgengine.dylib $(OBJS) clean : --- 14,18 ---- all : $(OBJS) ! g++ -dynamiclib $(LIBS) -o out/libtgengine.dylib $(OBJS) clean : |
|
From: Gilles M. <kr...@us...> - 2004-10-15 22:30:07
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17220 Modified Files: AUTHORS README Log Message: Modification mineure sur les fichiers AUTHOR et README... Index: README =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/README,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** README 26 Sep 2004 13:15:31 -0000 1.1.1.1 --- README 15 Oct 2004 22:29:53 -0000 1.2 *************** *** 10,12 **** --- 10,13 ---- - diverses documentations de www.gamedev.net - diverses documentations de www.gametutorials.com + - diverses documentations de www.flipcode.com Index: AUTHORS =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/AUTHORS,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AUTHORS 28 Sep 2004 09:02:58 -0000 1.3 --- AUTHORS 15 Oct 2004 22:29:53 -0000 1.4 *************** *** 1,4 **** Julien "silver" Rebetez : julien.rebetez *chez* epfl.ch ! Mac OS X Port: Sebastien "whistle_master" Samyn : sebastien.samyn *chez* epfl.ch --- 1,17 ---- + Graphical And Physical engine : Julien "silver" Rebetez : julien.rebetez *chez* epfl.ch ! Scripting Language : ! Gilles "KrteK" Meier : gilles.meier *chez* epfl.ch ! ! Artificial Intelligency : ! Yohann "varyoh" Coppel : yohann.coppel *chez* epfl.ch ! ! Map Editor : ! Christophe "scorp" Donatsch : christophe.donatsch *chez* epfl.ch ! ! Mac OS X Port & Sound : Sebastien "whistle_master" Samyn : sebastien.samyn *chez* epfl.ch + + Network Developement : + Luis Fernando "cerel" Alonsoz Couso : luis.couso *chez* epfl.ch |
|
From: Seb <whi...@us...> - 2004-10-15 20:49:59
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25369 Modified Files: soundmanager.cc Log Message: Pour krtek, une ligne vide a la fin ;-) Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** soundmanager.cc 15 Oct 2004 13:08:33 -0000 1.6 --- soundmanager.cc 15 Oct 2004 20:49:27 -0000 1.7 *************** *** 691,692 **** --- 691,693 ---- } + |
|
From: julien r. <jul...@us...> - 2004-10-15 14:17:50
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv834 Modified Files: model.cc Log Message: Index: model.cc =================================================================== RCS file: /cvsroot/epfl/tggame/model.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** model.cc 30 Sep 2004 10:31:42 -0000 1.3 --- model.cc 15 Oct 2004 14:17:25 -0000 1.4 *************** *** 65,69 **** void Model::Add(SceneManager* s) { ! s->AddWorldObject (pMD5, "md5mesh"); } --- 65,69 ---- void Model::Add(SceneManager* s) { ! s->AddWorldObject (pMD5); } |
|
From: julien r. <jul...@us...> - 2004-10-15 14:07:46
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30439 Modified Files: scenemanager.cc scenemanager.h Log Message: menage... Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** scenemanager.cc 15 Oct 2004 13:59:04 -0000 1.6 --- scenemanager.cc 15 Oct 2004 14:07:32 -0000 1.7 *************** *** 7,12 **** SceneManager::SceneManager (Timer* t) { - mObjects.clear (); - mEmitters.clear (); pTimer = t; pPhysicEngine=NULL; --- 7,10 ---- *************** *** 39,61 **** Vector3 tmp; - /*ObjectsList::iterator i = mObjects.begin(); - int count = 0; - for (; i != mObjects.end(); i++) - { - count++; - if (i->second->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->vPosition).Magnitude(); - d2 = (result.EndPoint - pCamera->vPosition).Magnitude(); - if ( d1 < d2 ) - { - result.EndPoint = colPoint; - result.Normal = colNormal; - result.pNode = i->second; - } - } - }*/ - Mesh* m = pFirstObject; if (m != NULL) --- 37,40 ---- *************** *** 143,169 **** } - - /*if(pD3Level) - { - //pD3Level->SetCamera(pCamera); - pD3Level->Render (); - }*/ - - /*ObjectsList::iterator i = mObjects.begin(); - for (; i != mObjects.end(); i++) - { - i->second->PreRender(frameInterval); - //mise a jour des plans constituant la bounding box - i->second->pBBox->CalculatePlanes(); - i->second->iLeaf = pLevel->FindLeaf(i->second->GetPosition()); - if ((!(i->second->iRenderFlags & M_UNVISIBLE)) && pLevel->IsVisible(i->second->iLeaf)) - { - Engine::pRenderer->RenderMesh(i->second); - Engine::pRenderer->RenderBBox(i->second->pBBox); - } - }*/ - - - Mesh* m = pFirstObject; if (m != NULL) --- 122,125 ---- *************** *** 225,238 **** #endif - /*EmittersList::iterator j = mEmitters.begin (); - for (; j!=mEmitters.end(); j++) - { - j->second->PreRender (frameInterval); - Engine::pRenderer->RenderParticles (j->second); - }*/ - - - - ParticleEmitter* p = pFirstEmitter; if (p != NULL) --- 181,184 ---- *************** *** 316,320 **** } ! void SceneManager::AddWorldObject (Mesh* obj, std::string name) { if (pFirstObject) //le premier noeud existe --- 262,266 ---- } ! void SceneManager::AddWorldObject (Mesh* obj) { if (pFirstObject) //le premier noeud existe *************** *** 332,342 **** pCurrentObject = obj; } - mObjects[name] = obj; } ! void SceneManager::AddParticlesEmitter (ParticleEmitter* p, std::string name) { - // pEmitList.push_back(p); - //mEmitters[name] = p; if (pFirstEmitter) //le premier noeud existe { --- 278,285 ---- pCurrentObject = obj; } } ! void SceneManager::AddParticlesEmitter (ParticleEmitter* p) { if (pFirstEmitter) //le premier noeud existe { *************** *** 353,357 **** pCurrentEmitter = p; } - //mEmitters[name] = p; } --- 296,299 ---- *************** *** 374,382 **** } - void SceneManager::RemoveParticlesEmitter (std::string name) - { - mEmitters.erase(name); - } - void SceneManager::RemoveParticlesEmitter(ParticleEmitter* p) { --- 316,319 ---- *************** *** 448,455 **** } - void SceneManager::RemoveWorldObject (std::string name) - { - mObjects.erase(name); - } void SceneManager::RemoveWorldObject(Mesh* obj) --- 385,388 ---- *************** *** 484,497 **** } ! void SceneManager::AddTimedWorldObject (Mesh* obj, std::string name, float time) { obj->fTime = time; ! AddWorldObject(obj, name); } ! void SceneManager::AddTimedParticleEmitter (ParticleEmitter* p, std::string name, float time) { p->fTime = time; ! AddParticlesEmitter(p, name); } --- 417,430 ---- } ! void SceneManager::AddTimedWorldObject (Mesh* obj, float time) { obj->fTime = time; ! AddWorldObject(obj); } ! void SceneManager::AddTimedParticleEmitter (ParticleEmitter* p, float time) { p->fTime = time; ! AddParticlesEmitter(p); } Index: scenemanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scenemanager.h 28 Sep 2004 18:03:12 -0000 1.2 --- scenemanager.h 15 Oct 2004 14:07:32 -0000 1.3 *************** *** 41,51 **** void SetCamera (Camera* pcam); Camera* GetCamera() { return pCamera; } ! void AddParticlesEmitter (ParticleEmitter* p, std::string name); ! void RemoveParticlesEmitter (std::string name); void RemoveParticlesEmitter(ParticleEmitter* p); void SetPhysicEngine (PhysicEngine* c) { pPhysicEngine = c;} ! void AddWorldObject (Mesh* obj, std::string name); ! void RemoveWorldObject (std::string name); void RemoveWorldObject (Mesh* obj); --- 41,49 ---- void SetCamera (Camera* pcam); Camera* GetCamera() { return pCamera; } ! void AddParticlesEmitter (ParticleEmitter* p); void RemoveParticlesEmitter(ParticleEmitter* p); void SetPhysicEngine (PhysicEngine* c) { pPhysicEngine = c;} ! void AddWorldObject (Mesh* obj); void RemoveWorldObject (Mesh* obj); *************** *** 55,63 **** * Cette fonction ne test PAS si l'objet existe deja dans la liste ! (-> risque de duplication) */ ! void AddTimedWorldObject (Mesh* obj, std::string name, float time); /**Ajoute un emetteur de particules qui sera detruit (delete) apres 'time' secondes * Cette fonction ne test PAS si l'objet existe deja dans la liste ! (-> risque de duplication) */ ! void AddTimedParticleEmitter (ParticleEmitter* p, std::string name, float time); void SetLevel(Q3Bsp* p) { pLevel = p; if(pPhysicEngine) pPhysicEngine->SetLevel(p);} --- 53,61 ---- * Cette fonction ne test PAS si l'objet existe deja dans la liste ! (-> risque de duplication) */ ! void AddTimedWorldObject (Mesh* obj, float time); /**Ajoute un emetteur de particules qui sera detruit (delete) apres 'time' secondes * Cette fonction ne test PAS si l'objet existe deja dans la liste ! (-> risque de duplication) */ ! void AddTimedParticleEmitter (ParticleEmitter* p,float time); void SetLevel(Q3Bsp* p) { pLevel = p; if(pPhysicEngine) pPhysicEngine->SetLevel(p);} *************** *** 72,83 **** void _RenderLight (PointLight*); - typedef std::map<std::string, Mesh*> ObjectsList; - ObjectsList mObjects; Mesh* pFirstObject; Mesh* pCurrentObject; - typedef std::map<std::string, ParticleEmitter*> EmittersList; - EmittersList mEmitters; ParticleEmitter* pFirstEmitter; ParticleEmitter* pCurrentEmitter; --- 70,77 ---- *************** *** 89,93 **** Camera* pCamera; Q3Bsp* pLevel; - //D3Map* pD3Level; Timer* pTimer; --- 83,86 ---- |
|
From: julien r. <jul...@us...> - 2004-10-15 14:01:10
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28787 Modified Files: aicontroller.cc game.cc model.h Log Message: fixes Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** game.cc 14 Oct 2004 13:47:59 -0000 1.13 --- game.cc 15 Oct 2004 14:01:01 -0000 1.14 *************** *** 14,18 **** Engine::pEngine = pEngine; - SoundManager::pSoundManager = pSoundManager; pSceneManager = new SceneManager (pTimer); --- 14,17 ---- *************** *** 37,40 **** --- 36,40 ---- _CreatePlayers (); + SoundManager::pSoundManager = pSoundManager; //On ajoute les sons que l'on veut. On fixe "Music" relatif au Listener. //FIXME: Chargement d'une musique d'ambiance au format ogg prend plus de temps qu'avec le format wav... *************** *** 56,66 **** //On baisse le volume de la musique d'ambiance ! //pSoundManager->SetSoundVolume("Music",0.5); //On joue les sons pSoundManager->PlaySound("fire"); pSoundManager->PlaySound("thunder"); ! //pSoundManager->PlaySound("Music"); ! } --- 56,65 ---- //On baisse le volume de la musique d'ambiance ! pSoundManager->SetSoundVolume("Music",0.5); //On joue les sons pSoundManager->PlaySound("fire"); pSoundManager->PlaySound("thunder"); ! pSoundManager->PlaySound("Music"); } Index: aicontroller.cc =================================================================== RCS file: /cvsroot/epfl/tggame/aicontroller.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** aicontroller.cc 14 Oct 2004 13:21:06 -0000 1.2 --- aicontroller.cc 15 Oct 2004 14:00:53 -0000 1.3 *************** *** 23,29 **** float fVarZ = vCentre.z - vPos.z; float fDist = sqrt(fVarX*fVarX + fVarZ*fVarZ); ! std::cout << "EndPoint Z: " << vCentre.z << " Position : " << vPos ! << " Distance : " << abs(fVarZ) << std::endl; } --- 23,29 ---- float fVarZ = vCentre.z - vPos.z; float fDist = sqrt(fVarX*fVarX + fVarZ*fVarZ); ! /* std::cout << "EndPoint Z: " << vCentre.z << " Position : " << vPos ! << " Distance : " << abs(fVarZ) << std::endl;*/ } Index: model.h =================================================================== RCS file: /cvsroot/epfl/tggame/model.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** model.h 10 Oct 2004 20:54:47 -0000 1.5 --- model.h 15 Oct 2004 14:01:01 -0000 1.6 *************** *** 55,60 **** inline Vector3 GetPosition () { return pMD5->GetPosition(); } inline void SetPosition (const Vector3& v) { pMD5->SetPosition(v); } ! inline void SetAcceleration (const Vector3& v) { pMD5->vAccel = v; } ! inline Vector3 GetAcceleration () { return pMD5->vAccel; } protected: bool _ParseMDLFile (char*); --- 55,60 ---- inline Vector3 GetPosition () { return pMD5->GetPosition(); } inline void SetPosition (const Vector3& v) { pMD5->SetPosition(v); } ! inline void SetAcceleration (const Vector3& v) { pMD5->SetAccel(v); } ! inline Vector3 GetAcceleration () { return pMD5->GetAccel(); } protected: bool _ParseMDLFile (char*); |
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27717 Modified Files: defs.h glrenderer.cc glrenderernv15.cc mesh.cc physicengine.cc physicengine.h q3bsp.cc scenemanager.cc scenenode.cc scenenode.h Log Message: Code cleaning Index: physicengine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** physicengine.cc 10 Oct 2004 21:11:55 -0000 1.9 --- physicengine.cc 15 Oct 2004 13:59:04 -0000 1.10 *************** *** 11,15 **** Engine::pVarManager->AddVar("gravity", 800); ! fGravity = &Engine::pVarManager->GetVar("gravity")->floatValue; //pFirstNode = NULL; //pCurrentNode = NULL; --- 11,15 ---- Engine::pVarManager->AddVar("gravity", 800); ! pGravity = &Engine::pVarManager->GetVar("gravity")->floatValue; //pFirstNode = NULL; //pCurrentNode = NULL; *************** *** 90,96 **** //on ajoute la gravite if (!n->bOnGround && !n->bNoClip) ! n->vAccel.y -= (*fGravity); ! else if (n->vAccel.y < 0) //si l'objet touche le sol, il faut ramener la gravité à zéro, sinon, l'objet va se retrouver avec une gravité négative très grande (ça l'empeche de sauter notamment) ! n->vAccel.y = 0; /*std::cout << n << "\t" ; std::cout << n->bOnGround; --- 90,96 ---- //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) ! n->SetYAccel(0.0f); /*std::cout << n << "\t" ; std::cout << n->bOnGround; *************** *** 98,102 **** //int red[]={1,0,0}; //Engine::pEngine->pRenderer->drawDebugArrow(n->vPosition, n->vPosition+n->vAccel*5, red); ! n->vVelocity = n->vAccel*eTime; //mise a jour des volumes englobants n->CalculateBoundingVolume(); --- 98,102 ---- //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(); *************** *** 104,108 **** if (n->bNoClip) { ! n->SetPosition(n->GetPosition()+n->vVelocity*eTime); continue; } --- 104,108 ---- if (n->bNoClip) { ! n->SetPosition(n->GetPosition()+n->GetVelocity()*eTime); continue; } *************** *** 113,118 **** ////TODO: lorsqu'on monte les escaliers, ça se fait par petit saut (normal, on ajoute 10 a la position en un coup. //Il faudrait faire ça de manière à ce qu'on ait l'impression de glisser sur les escaliers ! Vector3 vVelocity = n->vVelocity; ! Vector3 vUpVelocity = n->vVelocity; Vector3 vPos = n->GetPosition(); Vector3 vNewPos = vPos; --- 113,118 ---- ////TODO: lorsqu'on monte les escaliers, ça se fait par petit saut (normal, on ajoute 10 a la position en un coup. //Il faudrait faire ça de manière à ce qu'on ait l'impression de glisser sur les escaliers ! Vector3 vVelocity = n->GetVelocity(); ! Vector3 vUpVelocity = n->GetVelocity(); Vector3 vPos = n->GetPosition(); Vector3 vNewPos = vPos; *************** *** 142,146 **** //std::cout << "time : " << eTime << "\t" << vUpNewPos << std::endl; n->SetPosition(vUpNewPos); ! if (vUpVelocity != n->vVelocity && n->GetPhysicCallBack() != NULL) { //std::cout << "callback" << std::endl; --- 142,146 ---- //std::cout << "time : " << eTime << "\t" << vUpNewPos << std::endl; n->SetPosition(vUpNewPos); ! if (vUpVelocity != n->GetVelocity() && n->GetPhysicCallBack() != NULL) { //std::cout << "callback" << std::endl; *************** *** 155,159 **** //std::cout << "time : " << eTime << "\t" << vNewPos << std::endl; n->SetPosition(vNewPos); ! if (vVelocity != n->vVelocity && n->GetPhysicCallBack() != NULL) { //std::cout << "callback" << std::endl; --- 155,159 ---- //std::cout << "time : " << eTime << "\t" << vNewPos << std::endl; n->SetPosition(vNewPos); ! if (vVelocity != n->GetVelocity() && n->GetPhysicCallBack() != NULL) { //std::cout << "callback" << std::endl; *************** *** 174,178 **** } ! n->vVelocity.Null(); } } --- 174,178 ---- } ! n->SetVelocity(Vector3::ZERO); } } Index: mesh.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/mesh.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** mesh.cc 26 Sep 2004 13:15:12 -0000 1.1.1.1 --- mesh.cc 15 Oct 2004 13:59:04 -0000 1.2 *************** *** 7,12 **** { _TG_INIT_DLINKEDNODE(NULL, NULL) - iPhysicFlags |= M_RIGIDBODY | M_BSPHERE; - iRenderFlags = 0; pColor[0] = 1; pColor[1] = 1; --- 7,10 ---- Index: scenemanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenemanager.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** scenemanager.cc 10 Oct 2004 20:49:09 -0000 1.5 --- scenemanager.cc 15 Oct 2004 13:59:04 -0000 1.6 *************** *** 66,71 **** { //on regarde si le nouveau point de collision est plus proche de la caméra que l'ancien point de collision ! d1 = (colPoint - pCamera->vPosition).Magnitude(); ! d2 = (result.EndPoint - pCamera->vPosition).Magnitude(); if ( d1 < d2 ) { --- 66,71 ---- { //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 ) { *************** *** 174,178 **** m->pBBox->CalculatePlanes(); m->iLeaf = pLevel->FindLeaf(m->GetPosition()); ! if ((!(m->iRenderFlags & M_UNVISIBLE)) && (pLevel->IsVisible(m->iLeaf) || m->bCamera)) { --- 174,178 ---- m->pBBox->CalculatePlanes(); m->iLeaf = pLevel->FindLeaf(m->GetPosition()); ! if ((pLevel->IsVisible(m->iLeaf) || m->bCamera)) { *************** *** 196,200 **** do { ! if ((!(m->iRenderFlags & M_UNVISIBLE)) && pLevel->IsVisible(m->iLeaf)) { Engine::pRenderer->RenderMeshShadow(m); --- 196,200 ---- do { ! if (pLevel->IsVisible(m->iLeaf)) { Engine::pRenderer->RenderMeshShadow(m); *************** *** 242,246 **** p->PreRender(frameInterval); p->iLeaf = pLevel->FindLeaf(p->GetPosition()); ! if ((!(p->iRenderFlags & M_UNVISIBLE)) && pLevel->IsVisible(p->iLeaf)) { Engine::pRenderer->RenderParticles(p); --- 242,246 ---- p->PreRender(frameInterval); p->iLeaf = pLevel->FindLeaf(p->GetPosition()); ! if (pLevel->IsVisible(p->iLeaf)) { Engine::pRenderer->RenderParticles(p); Index: q3bsp.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/q3bsp.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** q3bsp.cc 10 Oct 2004 21:11:55 -0000 1.6 --- q3bsp.cc 15 Oct 2004 13:59:04 -0000 1.7 *************** *** 799,803 **** bool Q3Bsp::IsVisible(int leaf) { ! int iCamLeaf = FindLeaf(pCamera->vPosition); int iCamCluster = pLeafs[iCamLeaf].cluster; int iTestCluster = pLeafs[leaf].cluster; --- 799,803 ---- bool Q3Bsp::IsVisible(int leaf) { ! int iCamLeaf = FindLeaf(pCamera->GetPosition()); int iCamCluster = pLeafs[iCamLeaf].cluster; int iTestCluster = pLeafs[leaf].cluster; *************** *** 1002,1006 **** memset (pVisibleFaces, 0, sizeof(bool)*numOfFaces); ! int iCamLeaf = FindLeaf(pCamera->vPosition); int iCamCluster = pLeafs[iCamLeaf].cluster; for (int i=0; i<numOfLeafs; i++) --- 1002,1006 ---- memset (pVisibleFaces, 0, sizeof(bool)*numOfFaces); ! int iCamLeaf = FindLeaf(pCamera->GetPosition()); int iCamCluster = pLeafs[iCamLeaf].cluster; for (int i=0; i<numOfLeafs; i++) Index: scenenode.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scenenode.cc 10 Oct 2004 20:49:09 -0000 1.3 --- scenenode.cc 15 Oct 2004 13:59:04 -0000 1.4 *************** *** 9,18 **** vAccel.Null(); - iPhysicFlags = 0; - iRenderFlags = 0; - pBBox = new BoundingBox (); - qRotation.SetRotation(20,0,1,0); - matRotation.identity(); vEuler.Null(); --- 9,13 ---- *************** *** 30,39 **** vVelocity.Null(); vAccel.Null(); - iPhysicFlags = 0; - iRenderFlags = 0; pBBox = new BoundingBox (); - qRotation.SetRotation(0,0,1,0); - matRotation.identity(); vEuler.Null(); --- 25,30 ---- Index: glrenderer.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderer.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** glrenderer.cc 30 Sep 2004 09:23:16 -0000 1.6 --- glrenderer.cc 15 Oct 2004 13:59:04 -0000 1.7 *************** *** 789,795 **** #define __ROT_EULER #ifdef __ROT_EULER ! glRotatef(s->vEuler.x, 1, 0, 0); ! glRotatef(s->vEuler.y, 0, 1, 0); ! glRotatef(s->vEuler.z, 0, 0, 1); #else const Vector3& tmp = s->qRotation.GetRotationAxis(); --- 789,795 ---- #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(); Index: physicengine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/physicengine.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** physicengine.h 10 Oct 2004 20:49:09 -0000 1.2 --- physicengine.h 15 Oct 2004 13:59:04 -0000 1.3 *************** *** 35,39 **** Q3Bsp* pLevel; float fOverBounce; ! float* fGravity; }; --- 35,39 ---- Q3Bsp* pLevel; float fOverBounce; ! float* pGravity; }; Index: scenenode.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/scenenode.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scenenode.h 10 Oct 2004 20:49:09 -0000 1.2 --- scenenode.h 15 Oct 2004 13:59:04 -0000 1.3 *************** *** 28,57 **** virtual void PreRender (float ) = 0; virtual void SetPosition (Vector3 v); Vector3 GetPosition () { return vPosition; } virtual void CalculateBoundingVolume (); virtual bool Trace (Vector3 Begin, Vector3 End, Vector3& colPoint, Vector3& colNormal); - uint32 iPhysicFlags; - uint32 iRenderFlags; - BoundingBox* pBBox; - Quaternion qRotation; - mat3 matRotation; - Vector3 vEuler; - - Vector3 vVelocity; - Vector3 vAccel; - int iLeaf; //utilise par les noeuds a duree limite (SceneManager::AddTimed). Inferieur a 0 si noeud non-limite dans le temps float fTime; - //protected: - Vector3 vPosition; protected: PhysicCallBack* pPhysicCallBack; }; --- 28,92 ---- virtual void PreRender (float ) = 0; + /* Position */ virtual void SetPosition (Vector3 v); 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; } + virtual void SetEuler (const Vector3& v) { vEuler = v; } + inline float GetXRot () { return vEuler.x; } + inline float GetYRot () { return vEuler.y; } + inline float GetZRot () { return vEuler.z; } + inline void SetXRot (float f) { vEuler.x = f; } + inline void SetYRot (float f) { vEuler.y = f; } + inline void SetZRot (float f) { vEuler.z = f; } + inline void AddXRot (float f) { vEuler.x += f; } + 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; //utilise par les noeuds a duree limite (SceneManager::AddTimed). Inferieur a 0 si noeud non-limite dans le temps float fTime; protected: PhysicCallBack* pPhysicCallBack; + + Vector3 vEuler; + Vector3 vPosition; + Vector3 vAccel; + Vector3 vVelocity; }; Index: defs.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/defs.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** defs.h 10 Oct 2004 20:49:09 -0000 1.4 --- defs.h 15 Oct 2004 13:59:03 -0000 1.5 *************** *** 63,79 **** enum { - M_RIGIDBODY = 1, //l'objet va être considéré comme ayant une présence physique - M_BSPHERE, //il est inscrit dans une Sphere - }; - - enum - { - M_BUMPMAPPED = 1, - M_UNVISIBLE = 2, - M_CAMERA = 3 - }; - - enum - { POINT_ON_PLANE = 1, POINT_IN_FRONT_OF_PLANE = 2, --- 63,66 ---- Index: glrenderernv15.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/glrenderernv15.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** glrenderernv15.cc 27 Sep 2004 21:34:05 -0000 1.4 --- glrenderernv15.cc 15 Oct 2004 13:59:04 -0000 1.5 *************** *** 59,65 **** glLoadIdentity(); ! glRotatef(-mesh->vEuler.x, 1, 0, 0); ! glRotatef(-mesh->vEuler.y, 0, 1, 0); ! glRotatef(-mesh->vEuler.z, 0, 0, 1); glTranslatef(-mesh->GetPosition().x, -mesh->GetPosition().y, -mesh->GetPosition().z); --- 59,65 ---- glLoadIdentity(); ! glRotatef(-mesh->GetXRot(), 1, 0, 0); ! glRotatef(-mesh->GetYRot(), 0, 1, 0); ! glRotatef(-mesh->GetZRot(), 0, 0, 1); glTranslatef(-mesh->GetPosition().x, -mesh->GetPosition().y, -mesh->GetPosition().z); |
|
From: julien r. <jul...@us...> - 2004-10-15 13:09:08
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15342 Modified Files: console.cc console.h engine.cc engine.h log.cc log.h soundmanager.cc texture.cc Added Files: errbuffer.cc errbuffer.h logbuffer.cc logbuffer.h Log Message: classes facilitant la gestion des sorties (cout et cerr) --- NEW FILE: logbuffer.cc --- #include "logbuffer.h" #include "engine.h" namespace tg { LogBuffer::LogBuffer (char* file, bool console) { bConsole = console; bFile = false; pFile = NULL; if (file != NULL) { pFile = fopen(file, "w+t"); printf("Utilisation de %s pour ecrire les logs\n", file); bFile = true; fprintf(pFile, "LOG\n"); } else printf("Pas de fichier de log\n"); if (!pFile) { printf("Erreur lors de la creation du fichier de log : %s\n", file); bFile = false; } } LogBuffer::~LogBuffer () { fclose (pFile); } int LogBuffer::sync() { return 0; } int LogBuffer::overflow(int c) { if (bFile) { //apparement, n'envoie pas de eof(), envoie des \n if (traits_type::eq_int_type(traits_type::eof(), c)) fprintf(pFile, "\n"); else fprintf(pFile, "%c",(char)c); } if (bConsole) { if ((char)c == '\n') Engine::pConsole->NextLine(); else Engine::pConsole->Print((char)c); } printf ("%c", c); return 0; } } Index: log.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/log.cc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** log.cc 26 Sep 2004 13:15:18 -0000 1.1.1.1 --- log.cc 15 Oct 2004 13:08:33 -0000 1.2 *************** *** 27,31 **** { va_list arg; ! char buf[256]; va_start(arg, desc); --- 27,31 ---- { va_list arg; ! char buf[2048]; va_start(arg, desc); --- NEW FILE: logbuffer.h --- #ifndef _TGLOGBUFFER_H #define _TGLOGBUFFER_H #include <iostream> #include <fstream> #include "defs.h" namespace tg { class LogBuffer : public std::streambuf { public: /** * @param file le nom du fichier de sortie * @param console si on fait egalement les sorties sur la console */ LogBuffer(char* file, bool console); ~LogBuffer(); int sync (); int overflow (int c); protected: FILE* pFile; bool bConsole; bool bFile; }; } #endif Index: console.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/console.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** console.cc 27 Sep 2004 14:45:56 -0000 1.2 --- console.cc 15 Oct 2004 13:08:33 -0000 1.3 *************** *** 105,108 **** --- 105,117 ---- } } + + void Console::NextLineNoExecute () + { + if((sCurrentLine.size() > 0) && (sCurrentLine.find_first_not_of(" \t\n")!= std::string::npos)) + { + vHistory.push_back (sCurrentLine); + sCurrentLine.clear(); + } + } void Console::SetPrompt (const std::string& p) Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** soundmanager.cc 14 Oct 2004 13:46:47 -0000 1.5 --- soundmanager.cc 15 Oct 2004 13:08:33 -0000 1.6 *************** *** 689,691 **** } ! } \ No newline at end of file --- 689,692 ---- } ! } ! Index: engine.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/engine.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** engine.cc 10 Oct 2004 20:49:09 -0000 1.3 --- engine.cc 15 Oct 2004 13:08:33 -0000 1.4 *************** *** 26,34 **** pEndian = new BigEndian (); } } Engine::~Engine () { ! } --- 26,40 ---- pEndian = new BigEndian (); } + + pLog = new LogBuffer ("log.txt", true); + std::cout.rdbuf (pLog); + pErr = new ErrBuffer ("err.txt", true); + std::cerr.rdbuf (pErr); } Engine::~Engine () { ! delete pLog; ! delete pErr; } --- NEW FILE: errbuffer.h --- #ifndef _TGERRBUFFER_H #define _TGERRBUFFER_H #include <iostream> #include <fstream> #include "defs.h" namespace tg { class ErrBuffer : public std::streambuf { public: /** * @param file le nom du fichier de sortie * @param console si on fait egalement les sorties sur la console */ ErrBuffer(char* file, bool console); ~ErrBuffer(); int sync (); int overflow (int c); protected: FILE* pFile; bool bConsole; bool bFile; }; } #endif Index: log.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/log.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** log.h 26 Sep 2004 13:15:18 -0000 1.1.1.1 --- log.h 15 Oct 2004 13:08:33 -0000 1.2 *************** *** 21,25 **** ~Log (); ! void Report (const char *from, const char *desc, ...); protected: std::ofstream fFile; --- 21,53 ---- ~Log (); ! /** ! * Report : affiche un message. similaire à printf au niveau des paramètres et du formatage ! * @see printf ! */ ! void Report (const char* from, const char* desc, ...); ! ! /** ! * Error : signale une erreur et termine le programme ! ! * @see printf ! */ ! void Error (const char* from, const char* desc, ...); ! ! /** ! *Debug: affiche des messages de déverminage uniquement si TG_DEBUG ! * est dans les flags lors de la compilation ! * @see printf ! */ ! void Debug (const char* from, const char* desc, ...); ! ! /** ! * Re-definition de <<, qui font en fait un appel a report ! ! inline friend void operator << (const Vector3& v) { Report("(%f,%f,%f)", v.x, v.y, v.z); } ! inline friend void operator << (int i) { Report ("%i", i); } ! inline friend void operator << (unsigned int i); ! inline friend void operator << (float f); ! inline friend void operator << (char c); ! inline friend void operator << (char* s); ! */ protected: std::ofstream fFile; Index: console.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/console.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** console.h 26 Sep 2004 13:15:23 -0000 1.1.1.1 --- console.h 15 Oct 2004 13:08:33 -0000 1.2 *************** *** 41,44 **** --- 41,45 ---- void Print (char c); void NextLine (); + void NextLineNoExecute (); void SetPrompt (const std::string& p); std::string* GetPrompt () { return &sPrompt; } *************** *** 57,58 **** --- 58,60 ---- #endif + --- NEW FILE: errbuffer.cc --- #include "errbuffer.h" #include "engine.h" namespace tg { ErrBuffer::ErrBuffer (char* file, bool console) { bConsole = console; bFile = false; pFile = NULL; if (file != NULL) { pFile = fopen(file, "w+t"); printf("Utilisation de %s pour ecrire les logs\n", file); bFile = true; fprintf(pFile, "ERR\n"); } else printf("Pas de fichier de log\n"); if (!pFile) { printf("Erreur lors de la creation du fichier de log : %s\n", file); bFile = false; } } ErrBuffer::~ErrBuffer () { fclose (pFile); } int ErrBuffer::sync() { return 0; } int ErrBuffer::overflow(int c) { if (bFile) { //apparement, n'envoie pas de eof(), envoie des \n if (traits_type::eq_int_type(traits_type::eof(), c)) fprintf(pFile, "\n"); else fprintf(pFile, "%c",(char)c); } if (bConsole) { if ((char)c == '\n') Engine::pConsole->NextLine(); else Engine::pConsole->Print((char)c); } printf ("%c", c); return 0; } } Index: engine.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/engine.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** engine.h 28 Sep 2004 09:44:26 -0000 1.2 --- engine.h 15 Oct 2004 13:08:33 -0000 1.3 *************** *** 36,39 **** --- 36,41 ---- #include "tgendian.h" #include "defs.h" + #include "logbuffer.h" + #include "errbuffer.h" namespace tg *************** *** 96,99 **** --- 98,104 ---- int screenBpp; int videoFlags; + + LogBuffer* pLog; + ErrBuffer* pErr; const SDL_VideoInfo* vidInfo; Index: texture.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/texture.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** texture.cc 30 Sep 2004 09:23:16 -0000 1.6 --- texture.cc 15 Oct 2004 13:08:33 -0000 1.7 *************** *** 271,275 **** if(fd == NULL) { ! Log ("Impossible de charger le fichier %s", image); return false; } --- 271,275 ---- if(fd == NULL) { ! std::cerr << "Impossible de charger le fichier " << image << std::endl;; return false; } |
|
From: Seb <whi...@us...> - 2004-10-14 13:48:09
|
Update of /cvsroot/epfl/tggame In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22685 Modified Files: game.cc Log Message: Mis en commentaire le chargement de la musique de fond pour le moment car temps de chargement trop long. Index: game.cc =================================================================== RCS file: /cvsroot/epfl/tggame/game.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** game.cc 13 Oct 2004 23:46:13 -0000 1.12 --- game.cc 14 Oct 2004 13:47:59 -0000 1.13 *************** *** 41,45 **** pSoundManager->AddWAV("fire",false,true); pSoundManager->AddWAV("thunder",false,true); ! pSoundManager->AddOGG("Music",true,true); pSoundManager->AddWAV("step",true,true); --- 41,45 ---- pSoundManager->AddWAV("fire",false,true); pSoundManager->AddWAV("thunder",false,true); ! //pSoundManager->AddOGG("Music",true,true); pSoundManager->AddWAV("step",true,true); *************** *** 56,65 **** //On baisse le volume de la musique d'ambiance ! pSoundManager->SetSoundVolume("Music",0.5); //On joue les sons pSoundManager->PlaySound("fire"); pSoundManager->PlaySound("thunder"); ! pSoundManager->PlaySound("Music"); } --- 56,65 ---- //On baisse le volume de la musique d'ambiance ! //pSoundManager->SetSoundVolume("Music",0.5); //On joue les sons pSoundManager->PlaySound("fire"); pSoundManager->PlaySound("thunder"); ! //pSoundManager->PlaySound("Music"); } |
|
From: Seb <whi...@us...> - 2004-10-14 13:46:58
|
Update of /cvsroot/epfl/tgengine-0.1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22358 Modified Files: soundmanager.cc soundmanager.h Log Message: Moins de variables pour l'affichage de debug. Index: soundmanager.cc =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** soundmanager.cc 13 Oct 2004 23:12:52 -0000 1.4 --- soundmanager.cc 14 Oct 2004 13:46:47 -0000 1.5 *************** *** 22,26 **** cout << "OpenAL:: Starting SoundManager" << endl; #endif ! init(); } --- 22,26 ---- cout << "OpenAL:: Starting SoundManager" << endl; #endif ! init(); } *************** *** 63,74 **** alutInit(NULL, 0); - const ALubyte *alversion, *alrenderer, *alvendor, *alext; - alversion = alGetString( AL_VERSION ); - alrenderer = alGetString( AL_RENDERER ); - alvendor = alGetString( AL_VENDOR ); - alext = alGetString( AL_EXTENSIONS ); - #ifdef SOUND_DEBUG ! cout << "OpenAL:: Loading Lib: Vers = " << alversion << " | Renderer = " << alrenderer << " | Vendor = " << alvendor << endl; #endif --- 63,70 ---- alutInit(NULL, 0); #ifdef SOUND_DEBUG ! cout << "OpenAL:: Loading Lib: Version = " << (char*)alGetString(AL_VERSION) << flush; ! cout << " | Renderer = " << (char*)alGetString(AL_RENDERER) << flush; ! cout << " | Vendor = " << (char*)alGetString(AL_VENDOR) << endl; #endif Index: soundmanager.h =================================================================== RCS file: /cvsroot/epfl/tgengine-0.1/soundmanager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soundmanager.h 13 Oct 2004 18:38:19 -0000 1.2 --- soundmanager.h 14 Oct 2004 13:46:47 -0000 1.3 *************** *** 64,68 **** void EnableSoundManager(); void DisableSoundManager(); ! private: --- 64,68 ---- void EnableSoundManager(); void DisableSoundManager(); ! private: |