diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2004-03-23 01:02:18 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2004-03-23 01:02:18 +0300 |
commit | 00291b5cf4a0f16ddca425b74ed30e8ac35d40e2 (patch) | |
tree | 952bb1c2f6fd8c2f34b950597ed0fa73a4ea7594 /source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | |
parent | 5b90aafbd6815e29343f8e9aba9e3e20f85b3cc0 (diff) |
[GameEngine] Commit all Kester's changes made to the gameengine to restore 2.25 like physics.
[SCons] Build with Solid as default when enabling the gameengine in the build process
[SCons] Build solid and qhull from the extern directory and link statically against them
That was about it.
There are a few things that needs double checking:
* Makefiles
* Projectfiles
* All the other systems than Linux and Windows on which the build (with scons) has been successfully tested.
Diffstat (limited to 'source/gameengine/GamePlayer/common/GPC_RenderTools.cpp')
-rw-r--r-- | source/gameengine/GamePlayer/common/GPC_RenderTools.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index 2c455f44b72..3a7520861f9 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -94,6 +94,11 @@ #include "IMB_imbuf_types.h" // End of Blender includes +#include "SM_Scene.h" +#include "SumoPhysicsEnvironment.h" +#include "KX_SumoPhysicsController.h" +#include "KX_Scene.h" + GPC_RenderTools::GPC_RenderTools() { @@ -454,8 +459,8 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in if (objectdrawmode & RAS_IPolyMaterial::SHADOW) { // shadow must be cast to the ground, physics system needed here! - KX_GameObject* gameobj = (KX_GameObject*) this->m_clientobject; MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]); + KX_GameObject *gameobj = (KX_GameObject*) this->m_clientobject; MT_Vector3 direction = MT_Vector3(0,0,-1); @@ -466,16 +471,20 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in MT_Point3 resultpoint; MT_Vector3 resultnormal; - //todo: replace by physicsenvironment raycast - - //SM_Scene* scene = (SM_Scene*) m_auxilaryClientInfo; - - SM_Object* hitObj = 0; - //scene->rayTest(gameobj->GetSumoObject(),frompoint,topoint, - // resultpoint, resultnormal); - + //todo: + //use physics abstraction + KX_Scene* kxscene = (KX_Scene*) m_auxilaryClientInfo; + SumoPhysicsEnvironment *spe = dynamic_cast<SumoPhysicsEnvironment *>( kxscene->GetPhysicsEnvironment()); + SM_Scene *scene = spe->GetSumoScene(); + KX_SumoPhysicsController *spc = dynamic_cast<KX_SumoPhysicsController *>( gameobj->GetPhysicsController()); + KX_GameObject *parent = gameobj->GetParent(); + if (!spc && parent) + spc = dynamic_cast<KX_SumoPhysicsController *>(parent->GetPhysicsController()); + if (parent) + parent->Release(); + SM_Object *thisObj = spc?spc->GetSumoObject():NULL; - if (hitObj) + if (scene->rayTest(thisObj, frompoint, topoint, resultpoint, resultnormal)) { MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]); MT_Vector3 dir = -(left.cross(resultnormal)).normalized(); @@ -483,19 +492,17 @@ void GPC_RenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmatrix,in // for the up vector, we take the 'resultnormal' returned by the physics double maat[16]={ - left[0], left[1],left[2], 0, - dir[0], dir[1],dir[2],0, - resultnormal[0],resultnormal[1],resultnormal[2],0, - 0,0,0,1}; + left[0], left[1], left[2], 0, + dir[0], dir[1], dir[2], 0, + resultnormal[0],resultnormal[1],resultnormal[2], 0, + 0, 0, 0, 1}; glTranslated(resultpoint[0],resultpoint[1],resultpoint[2]); + //glMultMatrixd(oglmatrix); glMultMatrixd(maat); - // glMultMatrixd(oglmatrix); } else { glMultMatrixd(oglmatrix); } - - } else { |