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 | |
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')
6 files changed, 50 insertions, 44 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp index a9a099bf070..7316c62f88e 100644 --- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Engine.cpp @@ -245,13 +245,13 @@ float GPC_Engine::DetermineProgress(void) void GPC_Engine::UpdateLoadingAnimation(void) { - int delta; + //int delta; float progress = DetermineProgress(); if(progress > m_previousProgress) { - delta = progress - m_previousProgress; +// delta = progress - m_previousProgress; m_previousProgress = progress; if(m_previousProgress > 1.0) m_previousProgress = 1.0; // limit to 1.0 (has to change !) diff --git a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp index df34afac615..26b4926ec97 100644 --- a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp +++ b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp @@ -324,14 +324,14 @@ int my_set_tpage(TFace *tface) if (!fDoMipMap) { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } else { int minfilter= fLinearMipMap?GL_LINEAR_MIPMAP_LINEAR:GL_LINEAR_MIPMAP_NEAREST; - gluBuild2DMipmaps(GL_TEXTURE_2D, 4, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect); + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minfilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } 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 { diff --git a/source/gameengine/GamePlayer/common/Makefile b/source/gameengine/GamePlayer/common/Makefile index 535c2efebcb..d10c1f059e0 100644 --- a/source/gameengine/GamePlayer/common/Makefile +++ b/source/gameengine/GamePlayer/common/Makefile @@ -52,6 +52,7 @@ CPPFLAGS += -I$(NAN_FUZZICS)/include CPPFLAGS += -I$(NAN_STRING)/include CPPFLAGS += -I$(NAN_MOTO)/include CPPFLAGS += -I$(NAN_SUMO)/include +CPPFLAGS += -I$(NAN_SOLID)/include CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) CPPFLAGS += -I$(NAN_BMFONT)/include @@ -67,6 +68,8 @@ CPPFLAGS += -I../../../gameengine/Network/LoopBackNetwork CPPFLAGS += -I../../../gameengine/Rasterizer CPPFLAGS += -I../../../gameengine/SceneGraph CPPFLAGS += -I../../../gameengine/Rasterizer/RAS_OpenGLRasterizer +CPPFLAGS += -I../../../gameengine/Physics/Sumo +CPPFLAGS += -I../../../gameengine/Physics/common ############################### diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 17e9e77b5d3..8aedb666c87 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -153,6 +153,7 @@ bool GPG_Application::startWindow(STR_String& title, * so that the client rectangle has the size requested. */ m_mainWindow->setClientSize(windowWidth, windowHeight); + m_mainWindow->setCursorVisibility(false); success = initEngine(m_mainWindow, stereoMode); if (success) { @@ -179,6 +180,7 @@ bool GPG_Application::startFullScreen( setting.frequency = frequency; fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual); + m_mainWindow->setCursorVisibility(false); success = initEngine(m_mainWindow, stereoMode); if (success) { diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 1d631a6f740..253a7e47b2d 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -81,6 +81,7 @@ extern "C" #include "RAS_IRasterizer.h" #include "BKE_main.h" +#include "BKE_utildefines.h" #ifdef WIN32 #ifdef NDEBUG @@ -92,6 +93,8 @@ extern "C" const int kMinWindowWidth = 100; const int kMinWindowHeight = 100; +char bprogname[FILE_MAXDIR+FILE_MAXFILE]; + void usage(char* program) { char * consoleoption; @@ -101,18 +104,19 @@ void usage(char* program) consoleoption = ""; #endif - printf("usage: %s [-p l t w h] [-f fw fh fb ff] %s[-g gamengineoptions] " + printf("usage: %s -w [-p l t w h] %s[-g gamengineoptions] " "-s stereomode filename.blend\n", program, consoleoption); + printf(" -w: display in a window\n"); printf(" -p: specify window position\n"); printf(" l = window left coordinate\n"); printf(" t = window top coordinate\n"); printf(" w = window width\n"); printf(" h = window height\n"); - printf(" -f: start game in full screen mode\n"); +/* printf(" -f: start game in full screen mode\n"); printf(" fw = full screen mode pixel width\n"); printf(" fh = full screen mode pixel height\n"); printf(" fb = full screen mode bits per pixel\n"); - printf(" ff = full screen mode frequency\n"); + printf(" ff = full screen mode frequency\n"); */ printf(" -s: start player in stereo\n"); printf(" stereomode = hwpageflip or syncdoubling depending on the type of stereo you want\n"); #ifdef _WIN32 @@ -204,8 +208,8 @@ int main(int argc, char** argv) int i; bool error = false; SYS_SystemHandle syshandle = SYS_GetSystem(); - bool fullScreen = false; - bool fullScreenParFound = false; + bool fullScreen = true; + bool fullScreenParFound = true; bool windowParFound = false; bool closeConsole = true; int stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; @@ -215,8 +219,8 @@ int main(int argc, char** argv) int windowTop = 100; int windowWidth = 640; int windowHeight = 480; - int fullScreenWidth = 640; - int fullScreenHeight= 480; + GHOST_TUns32 fullScreenWidth = 0; + GHOST_TUns32 fullScreenHeight= 0; int fullScreenBpp = 16; int fullScreenFrequency = 60; @@ -225,6 +229,7 @@ int main(int argc, char** argv) signal (SIGFPE, SIG_IGN); #endif /* __alpha__ */ #endif /* __linux__ */ + BLI_where_am_i(bprogname, argv[0]); #ifdef __APPLE__ // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh) @@ -315,24 +320,12 @@ int main(int argc, char** argv) } break; - case 'f': + case 'w': // Parse window position and size options { - fullScreen = true; - i++; - if ((i + 4) < argc) - { - fullScreenWidth = atoi(argv[i++]); - fullScreenHeight = atoi(argv[i++]); - fullScreenBpp = atoi(argv[i++]); - fullScreenFrequency = atoi(argv[i]); + fullScreen = false; fullScreenParFound = true; - } - else - { - error = true; - printf("error: too few options for fullscreen argument.\n"); - } + i++; } break; case 'c': @@ -403,6 +396,7 @@ int main(int argc, char** argv) GHOST_ISystem* system = GHOST_ISystem::getSystem(); assertd(system); + system->getMainDisplayDimensions(fullScreenWidth, fullScreenHeight); // process first batch of events. If the user // drops a file on top off the blenderplayer icon, we // recieve an event with the filename @@ -570,7 +564,7 @@ int main(int argc, char** argv) bool run = true; while (run) { - system->processEvents(true); + system->processEvents(false); system->dispatchEvents(); if (exitcode = app.getExitRequested()) { |