diff options
Diffstat (limited to 'source/gameengine')
16 files changed, 84 insertions, 265 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index efd93eb3102..2f0f70ed9fe 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1570,13 +1570,6 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2]; break; } - case OB_BOUND_CAPSULE: - { - objprop.m_boundclass = KX_BOUNDCAPSULE; - objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]); - objprop.m_boundobject.c.m_height = bb.m_extends[2]; - break; - } } } @@ -2698,4 +2691,4 @@ void BL_ConvertBlenderObjects(struct Main* maggie, MT_Scalar distance = (activecam)? activecam->GetCameraFar() - activecam->GetCameraNear(): 100.0f; RAS_BucketManager *bucketmanager = kxscene->GetBucketManager(); bucketmanager->OptimizeBuckets(distance); -}
\ No newline at end of file +} diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 4792ead8be2..3a5bb92b4fa 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -932,7 +932,7 @@ Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path) return NULL; } -bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char *filter, KX_Scene *scene_merge, char **err_str) +bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str) { bContext *C; Main *main_newlib; /* stored as a dynamic 'main' until we free it */ @@ -941,7 +941,6 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char BlendHandle *bpy_openlib = NULL; /* ptr to the open .blend file */ int idcode= BLO_idcode_from_name(group); short flag= 0; /* dont need any special options */ - bool found = false; /* used for error reporting when using item */ ReportList reports; static char err_local[255]; @@ -950,48 +949,50 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group); return false; } + + if(GetMainDynamicPath(path)) { + snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path); + *err_str= err_local; + return false; + } - main_newlib = GetMainDynamicPath(path); - - if (main_newlib == NULL) - { - bpy_openlib = BLO_blendhandle_from_file( (char *)path ); - if(bpy_openlib==NULL) { - snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path); - *err_str= err_local; - return false; - } - - main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain"); - C= CTX_create(); - CTX_data_main_set(C, main_newlib); - BKE_reports_init(&reports, RPT_STORE); + bpy_openlib = BLO_blendhandle_from_file( (char *)path ); + if(bpy_openlib==NULL) { + snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path); + *err_str= err_local; + return false; + } + + main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain"); + C= CTX_create(); + CTX_data_main_set(C, main_newlib); + BKE_reports_init(&reports, RPT_STORE); - /* here appending/linking starts */ - main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path); - - names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode); - - int i=0; - LinkNode *n= names; - while(n) { - BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0); - n= (LinkNode *)n->next; - i++; - } - BLI_linklist_free(names, free); /* free linklist *and* each node's data */ - - BLO_library_append_end(C, main_tmp, &bpy_openlib, idcode, flag); - BLO_blendhandle_close(bpy_openlib); - - CTX_free(C); - BKE_reports_clear(&reports); - /* done linking */ - - /* needed for lookups*/ - GetMainDynamic().push_back(main_newlib); - strncpy(main_newlib->name, path, sizeof(main_newlib->name)); + /* here appending/linking starts */ + main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path); + + names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode); + + int i=0; + LinkNode *n= names; + while(n) { + BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0); + n= (LinkNode *)n->next; + i++; } + BLI_linklist_free(names, free); /* free linklist *and* each node's data */ + + BLO_library_append_end(C, main_tmp, &bpy_openlib, idcode, flag); + BLO_blendhandle_close(bpy_openlib); + + CTX_free(C); + BKE_reports_clear(&reports); + /* done linking */ + + /* needed for lookups*/ + GetMainDynamic().push_back(main_newlib); + strncpy(main_newlib->name, path, sizeof(main_newlib->name)); + if(idcode==ID_ME) { /* Convert all new meshes into BGE meshes */ @@ -999,39 +1000,24 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char KX_Scene *kx_scene= m_currentScene; for(mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) { - /* If item is defined, use it to filter meshes */ - if (!strcmp(filter, "") || !strcmp(filter, mesh->name+2)) - { - found = true; - RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this); - kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); - } + RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this); + kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); } } else if(idcode==ID_SCE) { /* Merge all new linked in scene into the existing one */ ID *scene; for(scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) { - /* If item is defined, use it to filter scenes */ - if (!strcmp(filter, "") || !strcmp(filter, scene->name+2)) - { - found = true; - printf("Loading scene: %s\n", scene->name+2); - /* merge into the base scene */ - KX_Scene* other= m_ketsjiEngine->CreateScene((Scene *)scene); - scene_merge->MergeScene(other); - - // RemoveScene(other); // Dont run this, it frees the entire scene converter data, just delete the scene - delete other; - } + printf("SceneName: %s\n", scene->name); + + /* merge into the base scene */ + KX_Scene* other= m_ketsjiEngine->CreateScene((Scene *)scene); + scene_merge->MergeScene(other); + + // RemoveScene(other); // Dont run this, it frees the entire scene converter data, just delete the scene + delete other; } } - - if (found == false) - { - printf("Item not found: %s\n", filter); - return false; - } return true; } diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index 341e4546430..3dd3afb5662 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -142,7 +142,7 @@ public: struct Main* GetMainDynamicPath(const char *path); vector<struct Main*> &GetMainDynamic(); - bool LinkBlendFile(const char *path, char *group, char *filter, KX_Scene *scene_merge, char **err_str); + bool LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str); bool MergeScene(KX_Scene *to, KX_Scene *from); RAS_MeshObject *ConvertMeshSpecial(KX_Scene* kx_scene, Main *maggie, const char *name); bool FreeBlendFile(struct Main *maggie); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index bde4bf3892b..71507642226 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -228,8 +228,7 @@ static HWND findGhostWindowHWND(GHOST_IWindow* window) bool GPG_Application::startScreenSaverPreview( HWND parentWindow, const bool stereoVisual, - const int stereoMode, - const GHOST_TUns16 samples) + const int stereoMode) { bool success = false; @@ -241,7 +240,7 @@ bool GPG_Application::startScreenSaverPreview( STR_String title = ""; m_mainWindow = fSystem->createWindow(title, 0, 0, windowWidth, windowHeight, GHOST_kWindowStateMinimized, - GHOST_kDrawingContextTypeOpenGL, stereoVisual, samples); + GHOST_kDrawingContextTypeOpenGL, stereoVisual); if (!m_mainWindow) { printf("error: could not create main window\n"); exit(-1); @@ -283,10 +282,9 @@ bool GPG_Application::startScreenSaverFullScreen( int height, int bpp,int frequency, const bool stereoVisual, - const int stereoMode, - const GHOST_TUns16 samples) + const int stereoMode) { - bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode, samples); + bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode); if (ret) { HWND ghost_hwnd = findGhostWindowHWND(m_mainWindow); @@ -308,14 +306,13 @@ bool GPG_Application::startWindow(STR_String& title, int windowWidth, int windowHeight, const bool stereoVisual, - const int stereoMode, - const GHOST_TUns16 samples) + const int stereoMode) { bool success; // Create the main window //STR_String title ("Blender Player - GHOST"); m_mainWindow = fSystem->createWindow(title, windowLeft, windowTop, windowWidth, windowHeight, GHOST_kWindowStateNormal, - GHOST_kDrawingContextTypeOpenGL, stereoVisual, samples); + GHOST_kDrawingContextTypeOpenGL, stereoVisual); if (!m_mainWindow) { printf("error: could not create main window\n"); exit(-1); @@ -337,11 +334,10 @@ bool GPG_Application::startWindow(STR_String& title, bool GPG_Application::startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parentWindow, const bool stereoVisual, - const int stereoMode, - const GHOST_TUns16 samples) { + const int stereoMode) { m_mainWindow = fSystem->createWindow(title, 0, 0, 0, 0, GHOST_kWindowStateNormal, - GHOST_kDrawingContextTypeOpenGL, stereoVisual,samples, parentWindow); + GHOST_kDrawingContextTypeOpenGL, stereoVisual, parentWindow); if (!m_mainWindow) { printf("error: could not create main window\n"); @@ -362,8 +358,7 @@ bool GPG_Application::startFullScreen( int height, int bpp,int frequency, const bool stereoVisual, - const int stereoMode, - const GHOST_TUns16 samples) + const int stereoMode) { bool success; // Create the main window diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index e6a47628923..48a6c8e78ec 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -59,12 +59,12 @@ public: bool SetGameEngineData(struct Main* maggie, struct Scene* scene, int argc, char** argv); bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight, - const bool stereoVisual, const int stereoMode, const GHOST_TUns16 numOfAASamples = 0); - bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); - bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); + const bool stereoVisual, const int stereoMode); + bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode); + bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode); #ifdef WIN32 - bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); - bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); + bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode); + bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode); #endif virtual bool processEvent(GHOST_IEvent* event); diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 69df00949a8..b7ed8666325 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -214,7 +214,6 @@ void usage(const char* program) printf(" -c: keep console window open\n\n"); #endif printf(" -d: turn debugging on\n\n"); - printf(" -m: sets the number of samples to request for multisampling"); printf(" -g: game engine options:\n\n"); printf(" Name Default Description\n"); printf(" ------------------------------------------------------------------------\n"); @@ -230,7 +229,6 @@ void usage(const char* program) printf("\n"); printf("example: %s -w 320 200 10 10 -g noaudio c:\\loadtest.blend\n", program); printf("example: %s -g show_framerate = 0 c:\\loadtest.blend\n", program); - printf("example: %s -m 4 game.blend", program); } static void get_filename(int argc, char **argv, char *filename) @@ -336,7 +334,6 @@ int main(int argc, char** argv) int windowHeight = 480; GHOST_TUns32 fullScreenWidth = 0; GHOST_TUns32 fullScreenHeight= 0; - GHOST_TUns16 aaSamples = 4; int fullScreenBpp = 32; int fullScreenFrequency = 60; GHOST_TEmbedderWindowID parentWindow = 0; @@ -511,12 +508,6 @@ int main(int argc, char** argv) } } break; - case 'm': - i++; - - if ((i+1) < argc) - aaSamples = atoi(argv[i++]); - break; case 'h': usage(argv[0]); @@ -819,13 +810,13 @@ int main(int argc, char** argv) if (scr_saver_mode == SCREEN_SAVER_MODE_SAVER) { app.startScreenSaverFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode, aaSamples); + stereoWindow, stereomode); } else #endif { app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode, aaSamples); + stereoWindow, stereomode); } } else @@ -865,16 +856,16 @@ int main(int argc, char** argv) #ifdef WIN32 if (scr_saver_mode == SCREEN_SAVER_MODE_PREVIEW) { - app.startScreenSaverPreview(scr_saver_hwnd, stereoWindow, stereomode, aaSamples); + app.startScreenSaverPreview(scr_saver_hwnd, stereoWindow, stereomode); } else #endif { if (parentWindow != 0) - app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode, aaSamples); + app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode); else app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight, - stereoWindow, stereomode, aaSamples); + stereoWindow, stereomode); } } } diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 1d41a7bcddb..c4af701f87b 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -69,10 +69,6 @@ ELSE(WITH_SDL) ADD_DEFINITIONS(-DDISABLE_SDL) ENDIF(WITH_SDL) -if(WITH_DDS) - ADD_DEFINITIONS(-DWITH_DDS) -ENDIF(WITH_DDS) - IF(WITH_PYTHON) SET(INC ${INC} ${PYTHON_INC}) ELSE(WITH_PYTHON) diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index 850bf4b4ad4..879bcd472c6 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -53,8 +53,7 @@ typedef enum { KX_BOUNDCONE, KX_BOUNDMESH, KX_BOUNDPOLYTOPE, - KX_BOUND_DYN_MESH, - KX_BOUNDCAPSULE + KX_BOUND_DYN_MESH } KX_BoundBoxClass; struct KX_BoxBounds diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index e793f9d5966..44ae032179b 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -184,14 +184,6 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, bm = shapeInfo->CreateBulletShape(ci.m_margin); break; } - case KX_BOUNDCAPSULE: - { - shapeInfo->m_radius = objprop->m_boundobject.c.m_radius; - shapeInfo->m_height = objprop->m_boundobject.c.m_height; - shapeInfo->m_shapeType = PHY_SHAPE_CAPSULE; - bm = shapeInfo->CreateBulletShape(ci.m_margin); - break; - } case KX_BOUNDMESH: { // mesh shapes can be shared, check first if we already have a shape on that mesh diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 7b0283a2efd..0198555753e 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -628,13 +628,12 @@ static PyObject *gLibLoad(PyObject*, PyObject* args) KX_Scene *kx_scene= gp_KetsjiScene; char *path; char *group; - char *filter= ""; char *err_str= NULL; - if (!PyArg_ParseTuple(args,"ss|s:LibLoad",&path, &group, &filter)) + if (!PyArg_ParseTuple(args,"ss:LibLoad",&path, &group)) return NULL; - if(kx_scene->GetSceneConverter()->LinkBlendFile(path, group, filter, kx_scene, &err_str)) { + if(kx_scene->GetSceneConverter()->LinkBlendFile(path, group, kx_scene, &err_str)) { Py_RETURN_TRUE; } diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 505d3fa10a0..58dc8a314bf 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -23,9 +23,6 @@ incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include # incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_OPENGL_INC'] -if env['WITH_BF_DDS']: - defs.append('WITH_DDS') - if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] else: diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index ac0f61857f5..fe429200dd4 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -2027,11 +2027,6 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b collisionShape->setMargin(margin); break; - case PHY_SHAPE_CAPSULE: - collisionShape = new btCapsuleShapeZ(m_radius, m_height); - collisionShape->setMargin(margin); - break; - case PHY_SHAPE_MESH: // Let's use the latest btScaledBvhTriangleMeshShape: it allows true sharing of // triangle mesh information between duplicates => drastic performance increase when diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h index 4b5cdd41b9a..08d94a2850a 100644 --- a/source/gameengine/Physics/common/PHY_DynamicTypes.h +++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h @@ -138,7 +138,6 @@ typedef enum PHY_ShapeType { PHY_SHAPE_SPHERE, PHY_SHAPE_CYLINDER, PHY_SHAPE_CONE, - PHY_SHAPE_CAPSULE, PHY_SHAPE_MESH, PHY_SHAPE_POLYTOPE, PHY_SHAPE_COMPOUND, diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index c0e08dba992..4527850a8e9 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -194,15 +194,6 @@ void RAS_2DFilterManager::AnalyseShader(int passindex, vector<STR_String>& propN { texflag[passindex] |= 0x2; } - if(glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredRenderTexture") != -1) - { - texflag[passindex] |= 0x4; - } - if(glGetUniformLocationARB(m_filters[passindex], "bgl_QuartedDepthTexture") != -1) - { - if(GLEW_ARB_depth_texture) - texflag[passindex] |= 0x8; - } if(m_gameObjects[passindex]) { @@ -250,29 +241,6 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex) glUniform1iARB(uniformLoc, 2); } } - - /* Send the quartered render texture to glsl program if it needs */ - if(texflag[passindex] & 0x4){ - uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredRenderTexture"); - glActiveTextureARB(GL_TEXTURE3); - glBindTexture(GL_TEXTURE_2D, texname[3]); - - if (uniformLoc != -1) - { - glUniform1iARB(uniformLoc, 3); - } - } - - if(texflag[passindex] & 0x5){ - uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredDepthTexture"); - glActiveTextureARB(GL_TEXTURE4); - glBindTexture(GL_TEXTURE_2D, texname[4]); - - if (uniformLoc != -1) - { - glUniform1iARB(uniformLoc, 4); - } - } uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_TextureCoordinateOffset"); if (uniformLoc != -1) @@ -309,24 +277,15 @@ void RAS_2DFilterManager::EndShaderProgram() void RAS_2DFilterManager::FreeTextures() { - // Update this when adding new textures! - for (int i=0; i<5; i++) - { - if(texname[i]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[i]); - } - - if(fbo != (unsigned int)-1) - glDeleteFramebuffersEXT(1, &fbo); - /*if(texname[0]!=(unsigned int)-1) + if(texname[0]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[0]); if(texname[1]!=(unsigned int)-1) glDeleteTextures(1, (GLuint*)&texname[1]); if(texname[2]!=(unsigned int)-1) - glDeleteTextures(1, (GLuint*)&texname[2]);*/ + glDeleteTextures(1, (GLuint*)&texname[2]); } -void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance, bool qrender, bool qdepth) +void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance) { FreeTextures(); @@ -362,25 +321,6 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance, bool qrender glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } - - if(qrender){ - glGenTextures(1, (GLuint*)&texname[3]); - glBindTexture(GL_TEXTURE_2D, texname[3]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texturewidth/2, textureheight/2, 0, GL_RGBA8, - GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - - glGenFramebuffersEXT(1, &fbo); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texname[3], 0); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - } void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas) @@ -437,8 +377,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) { bool need_depth=false; bool need_luminance=false; - bool need_qrender=false; - bool need_qdepth=false; int num_filters = 0; int passindex; @@ -454,11 +392,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) need_depth = true; if(texflag[passindex] & 0x2) need_luminance = true; - if(texflag[passindex] & 0x4) - need_qrender = true; - if(texflag[passindex] & 0x8) - need_qdepth = true; - if(need_depth && need_luminance && need_qrender && need_qdepth) + if(need_depth && need_luminance) break; } } @@ -478,7 +412,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) if(need_tex_update) { - SetupTextures(need_depth, need_luminance, need_qrender, need_qdepth); + SetupTextures(need_depth, need_luminance); need_tex_update = false; } @@ -494,12 +428,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0); } - if(need_qdepth){ - glActiveTextureARB(GL_TEXTURE4); - glBindTexture(GL_TEXTURE_2D, texname[4]); - glCopyTexImage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT, 0, 0, texturewidth, textureheight, 0); - } - glViewport(0,0, texturewidth, textureheight); glDisable(GL_DEPTH_TEST); @@ -520,53 +448,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glActiveTextureARB(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texname[0]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, texturewidth, textureheight, 0); - //glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, im_buff); - - if(need_qrender){ - //glActiveTextureARB(GL_TEXTURE3); - //glBindTexture(GL_TEXTURE_2D, texname[3]); - //glReadPixels(0, 0, texturewidth, textureheight, GL_RGB, GL_UNSIGNED_BYTE, im_buff); - //gluScaleImage(GL_RGB, texturewidth, textureheight, GL_UNSIGNED_BYTE, im_buff, - // texturewidth/2, textureheight/2, GL_UNSIGNED_BYTE, scaled_buff); - //glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texturewidth, textureheight, GL_RGBA, GL_UNSIGNED_BYTE, im_buff); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - if(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT) { - glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT); - glViewport(0, 0, texturewidth/2, textureheight/2); - - /* glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, texturewidth/2, 0, textureheight/2); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity();*/ - glClearColor(0, 0, 0, 1); - - glClear(GL_COLOR_BUFFER_BIT); - /*glBindTexture(GL_TEXTURE_2D, texname[0]); - glBegin(GL_QUADS); - glColor4f(0.f, 1.f, 1.f, 1.f); - glTexCoord2f(1.f, 1.f); glVertex2f(1,1); - glTexCoord2f(0.f, 1.f); glVertex2f(-1,1); - glTexCoord2f(0.f, 0.f); glVertex2f(-1,-1); - glTexCoord2f(1.f, 0.f); glVertex2f(1,-1); - glEnd();*/ - - glFlush(); - //glPopMatrix(); - //glMatrixMode(GL_PROJECTION); - //glPopMatrix(); - - glPopAttrib(); - } else { - printf("Could not use the framebuffer\n"); - } - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - } - - glClearColor(1, 0, 1, 1); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_QUADS); diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h index 2519473520a..7ff7cde7882 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.h @@ -45,7 +45,7 @@ private: void EndShaderProgram(); void PrintShaderErrors(unsigned int shader, const char *task, const char *code); - void SetupTextures(bool depth, bool luminance, bool qrender, bool qdepth); + void SetupTextures(bool depth, bool luminance); void FreeTextures(); void UpdateOffsetMatrix(RAS_ICanvas* canvas); @@ -54,15 +54,13 @@ private: float canvascoord[4]; float textureoffsets[18]; float view[4]; - /* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture - * texname[3] contains quartered render to texture, texname[4] contains quartered depth texture*/ - unsigned int texname[5]; + /* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture*/ + unsigned int texname[3]; int texturewidth; int textureheight; int canvaswidth; int canvasheight; int numberoffilters; - unsigned int fbo; /* bit 0: enable/disable depth texture * bit 1: enable/disable luminance texture*/ short texflag[MAX_RENDER_PASS]; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index ec5f4c4ac6d..122a738e4f3 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -297,7 +297,6 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time) m_last_frontface = true; glShadeModel(GL_SMOOTH); - glEnable(GL_MULTISAMPLE_ARB); m_2DCanvas->BeginFrame(); @@ -383,7 +382,6 @@ void RAS_OpenGLRasterizer::EndFrame() FlushDebugLines(); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDisable(GL_MULTISAMPLE_ARB); m_2DCanvas->EndFrame(); } |