BGE Redraw problem:
authorCampbell Barton <ideasman42@gmail.com>
Sat, 27 Jun 2009 23:54:20 +0000 (23:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 27 Jun 2009 23:54:20 +0000 (23:54 +0000)
at the moment only files from blender 2.4x will display in 2.5x, compared area and window structs in both cases and dont see any differences.

This doesnt fix the problem but corrects a few things related to window drawing with the BGE,
also adds a hack because I noticed the window and area pointers in the KX_BlenderCanvas were offset after initialized, maybe need to use <static cast> ?

source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/BlenderRoutines/CMakeLists.txt
source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
source/gameengine/BlenderRoutines/SConscript

index 44678cb73eb57efc94a88168a7ef650bb99ed4f6..fb222b419c30c05959ae6e2268d63d419960ca7d 100644 (file)
 
 #include "SYS_System.h"
 
+#include "GPU_extensions.h"
+#include "Value.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
        /***/
 #include "DNA_view3d_types.h"
 #include "DNA_screen_types.h"
 //XXX #include "BIF_scrarea.h"
 
 #include "BKE_main.h"
-//#include "BKE_context.h"
 #include "BLI_blenlib.h"
 #include "BLO_readfile.h"
 #include "DNA_scene_types.h"
        /***/
 
-#include "GPU_extensions.h"
-#include "Value.h"
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
 //XXX #include "BSE_headerbuttons.h"
+#include "BKE_context.h"
 #include "../../blender/windowmanager/WM_types.h"
 #include "../../blender/windowmanager/wm_window.h"
 #include "../../blender/windowmanager/wm_event_system.h"
@@ -118,19 +118,10 @@ static BlendFileData *load_game_data(char *filename)
        return bfd;
 }
 
-
-/* screw it, BKE_context.h is complaining! */
-extern "C" struct wmWindow *CTX_wm_window(const bContext *C);
-extern "C" struct ScrArea *CTX_wm_area(const bContext *C);
-extern "C" struct ARegion *CTX_wm_region(const bContext *C);
-extern "C" struct Scene *CTX_data_scene(const bContext *C);
-extern "C" struct Main *CTX_data_main(const bContext *C);
-
 extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_framing)
 {
        /* context values */
        struct wmWindow *win= CTX_wm_window(C);
-       struct ScrArea *area= CTX_wm_area(C); // curarea
        struct ARegion *ar= CTX_wm_region(C);
        struct Scene *scene= CTX_data_scene(C);
        struct Main* maggie1= CTX_data_main(C);
@@ -159,8 +150,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
 
        do
        {
-               View3D *v3d= (View3D*) area->spacedata.first;
-               RegionView3D *rv3d= (RegionView3D*) ar->regiondata;
+               View3D *v3d= CTX_wm_view3d(C);
+               RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
                // get some preferences
                SYS_SystemHandle syshandle = SYS_GetSystem();
@@ -239,13 +230,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
                        scene->camera= v3d->camera;
                }
 
-       
                // some blender stuff
                MT_CmMatrix4x4 projmat;
                MT_CmMatrix4x4 viewmat;
                float camzoom;
                int i;
-               
+
                for (i = 0; i < 16; i++)
                {
                        float *viewmat_linear= (float*) rv3d->viewmat;
@@ -257,7 +247,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
                        projmat.setElem(i, projmat_linear[i]);
                }
                
-               if(v3d->persp==V3D_CAMOB) {
+               if(rv3d->persp==V3D_CAMOB) {
                        camzoom = (1.41421 + (rv3d->camzoom / 50.0));
                        camzoom *= camzoom;
                }
@@ -348,10 +338,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
                
                if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
                {
-                       if (v3d->persp != V3D_CAMOB)
+                       if (rv3d->persp != V3D_CAMOB)
                        {
                                ketsjiengine->EnableCameraOverride(startscenename);
-                               ketsjiengine->SetCameraOverrideUseOrtho((v3d->persp == V3D_ORTHO));
+                               ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == V3D_ORTHO));
                                ketsjiengine->SetCameraOverrideProjectionMatrix(projmat);
                                ketsjiengine->SetCameraOverrideViewMatrix(viewmat);
                                ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far);
@@ -587,7 +577,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
 }
 
 extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
-                                                                struct ScrArea *area,
                                                                 struct ARegion *ar,
                                                                 char* scenename,
                                                                 struct Main* maggie,
index 3b690a215844122cebe84a6b179e2e7a2d0f9451..2874a0273cceb8f1d6b394933458bcadc89bfd69 100644 (file)
@@ -19,7 +19,8 @@ SET(INC
   ../../../source/blender/windowmanager
   ../../../source/blender 
   ../../../source/blender/include
-  ../../../source/blender/makesdna 
+  ../../../source/blender/makesdna
+  ../../../source/blender/makesrna 
   ../../../source/gameengine/Rasterizer 
   ../../../source/gameengine/GameLogic
   ../../../source/gameengine/Expressions 
index aa83d17a03a36e2d37bd4f97debef92db6fc438d..43d67e111f3317bec8589fec9bd7da08c4dc2ff1 100644 (file)
 
 #include "KX_BlenderCanvas.h"
 #include "DNA_screen_types.h"
+#include "stdio.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+// temp hack, prevents pointers being offset somehow, will need to look into this later - Campbell
+ARegion *m_ar;
+wmWindow *m_win;
+
+
 KX_BlenderCanvas::KX_BlenderCanvas(struct wmWindow *win, ARegion *ar) :
-m_win(win),
-m_ar(ar)
+__m_win(win),
+__m_ar(ar)
 {
+       m_ar= ar;
+       m_win= win;
 }
 
 KX_BlenderCanvas::~KX_BlenderCanvas()
index fd41fb90f2fc76dd81e151e200ee3df876e10e24..41bbec7770c76ce11a725d95b3c61028bea3e5f3 100644 (file)
@@ -163,8 +163,8 @@ public:
 
 private:
        /** Blender area the game engine is running within */
-       struct ARegion* m_ar;
-       struct wmWindow* m_win;
+       struct ARegion* __m_ar;
+       struct wmWindow* __m_win;
        RAS_Rect        m_area_rect;
 };
 
index c2094a158258fd4e50f8e547fe9ce4acfdd33739..fc12f453d8682e7702743dcf8b9c9031cc773dcd 100644 (file)
@@ -11,7 +11,8 @@ incs += ' #intern/ghost/include'
 incs += ' #intern/moto/include #source/gameengine/Ketsji #source/blender/blenlib'
 incs += ' #source/blender/blenkernel #source/blender'
 incs += ' #source/blender/blenfont #source/blender/editors/include'
-incs += ' #source/blender/makesdna #source/gameengine/Rasterizer #source/gameengine/GameLogic'
+incs += ' #source/blender/makesdna #source/blender/makesrna'
+incs += ' #source/gameengine/Rasterizer #source/gameengine/GameLogic'
 incs += ' #source/gameengine/Expressions #source/gameengine/Network'
 incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common'
 incs += ' #source/gameengine/Physics/Bullet'