diff options
Diffstat (limited to 'source/gameengine')
30 files changed, 121 insertions, 157 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 6e698166fd9..4e8f0eba9b7 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -101,7 +101,7 @@ typedef void * wmUIHandlerRemoveFunc; } #ifdef WITH_AUDASPACE -# include AUD_DEVICE_H +# include <AUD_Device.h> #endif static BlendFileData *load_game_data(const char *filename) @@ -267,7 +267,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0); bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); bool animation_record = (SYS_GetCommandLineInt(syshandle, "animation_record", 0) != 0); - bool displaylists = (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0) && GPU_display_list_support(); + bool displaylists = false; // (SYS_GetCommandLineInt(syshandle, "displaylists", 0) != 0) && GPU_display_list_support(); #ifdef WITH_PYTHON bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 0) != 0); #endif diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index aaeb2e10462..42293050753 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -56,7 +56,7 @@ set(SRC add_definitions(${GL_DEFINITIONS}) if(WITH_AUDASPACE) - add_definitions(${AUDASPACE_DEFINITIONS}) + add_definitions(-DWITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index a6b2340d7b4..6fdc823ba1a 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -324,7 +324,6 @@ static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy) void KX_BlenderCanvas::MakeScreenShot(const char *filename) { ScrArea area_dummy= {0}; - bScreen *screen = m_win->screen; unsigned int *dumprect; int dumpsx, dumpsy; @@ -340,7 +339,7 @@ void KX_BlenderCanvas::MakeScreenShot(const char *filename) } /* initialize image file format data */ - Scene *scene = (screen)? screen->scene: NULL; + Scene *scene = WM_window_get_active_scene(m_win); ImageFormatData *im_format = (ImageFormatData *)MEM_mallocN(sizeof(ImageFormatData), "im_format"); if (scene) diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index a5af525e13a..049fd49cab9 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -138,7 +138,8 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) if (pchan->prop) pchan->prop= IDP_CopyProperty(pchan->prop); #endif - pchan->prop= NULL; + pchan->prop = NULL; + pchan->draw_data = NULL; } BLI_ghash_free(ghash, NULL, NULL); @@ -469,6 +470,8 @@ bool BL_ArmatureObject::UnlinkObject(SCA_IObject* clientobj) void BL_ArmatureObject::ApplyPose() { + /* TODO: This doesn't work currently because of eval_ctx. */ +#if 0 m_armpose = m_objArma->pose; m_objArma->pose = m_pose; // in the GE, we use ctime to store the timestep @@ -491,6 +494,7 @@ void BL_ArmatureObject::ApplyPose() } m_lastapplyframe = m_lastframe; } +#endif } void BL_ArmatureObject::RestorePose() diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 8ba39e288ca..3b0fb335d21 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -45,7 +45,9 @@ * This workaround will make sure that curve_cache for curves * is up-to-date. */ -#define THREADED_DAG_WORKAROUND + +/* TODO: Disabled for now, because of eval_ctx. */ +//#define THREADED_DAG_WORKAROUND #include <math.h> #include <vector> @@ -145,6 +147,8 @@ extern "C" { #include "BKE_customdata.h" #include "BKE_cdderivedmesh.h" #include "BKE_DerivedMesh.h" +#include "BKE_group.h" +#include "BKE_layer.h" #include "BKE_material.h" /* give_current_material */ #include "BKE_image.h" #include "IMB_imbuf_types.h" @@ -589,17 +593,17 @@ static bool ConvertMaterial( /* In Multitexture use the face texture if and only if * it is set in the buttons * In GLSL is not working yet :/ 3.2011 */ - bool facetex = false; - if (validface && mat->mode & MA_FACETEXTURE) { - facetex = true; - } // foreach MTex for (int i = 0; i < MAXTEX; i++) { // use face tex - if (i == 0 && facetex ) { - facetex = false; + if (i == 0) { +#if 0 Image *tmp = (Image *)(tface->tpage); +#else + /* weak but better then nothing */ + Image *tmp = mat ? mat->edit_image : NULL; +#endif if (tmp) { material->img[i] = tmp; @@ -789,7 +793,11 @@ static bool ConvertMaterial( // check for tface tex to fallback on if (validface) { +#if 0 material->img[0] = (Image *)(tface->tpage); +#else + material->img[0] = mat ? mat->edit_image : NULL; +#endif // ------------------------ if (material->img[0]) { material->texname[0] = material->img[0]->id.name; @@ -830,7 +838,7 @@ static bool ConvertMaterial( /* No material, what to do? let's see what is in the UV and set the material accordingly * light and visible is always on */ if (validface) { - material->tile = tface->tile; + /* nop */ } else { // nothing at all @@ -869,13 +877,6 @@ static bool ConvertMaterial( if (validmat) { material->matname =(mat->id.name); } - - if (tface) { - ME_MTEXFACE_CPY(&material->mtexpoly, tface); - } - else { - memset(&material->mtexpoly, 0, sizeof(material->mtexpoly)); - } material->material = mat; return true; } @@ -894,7 +895,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol, converter->GetGLSLMaterials()); - if (ma && (ma->mode & MA_FACETEXTURE) == 0) + if (ma) converter->CacheBlenderMaterial(scene, ma, bl_mat); } @@ -910,7 +911,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace kx_blmat->Initialize(scene, bl_mat, (ma?&ma->game:NULL), lightlayer); polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat); - if (ma && (ma->mode & MA_FACETEXTURE) == 0) + if (ma) converter->CachePolyMaterial(scene, ma, polymat); } @@ -1707,6 +1708,7 @@ static ListBase *get_active_constraints2(Object *ob) return NULL; // XXX - shouldnt we care about the pose data and not the mode??? +#if 0 if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; @@ -1714,8 +1716,11 @@ static ListBase *get_active_constraints2(Object *ob) if (pchan) return &pchan->constraints; } - else + else +#endif + { return &ob->constraints; + } return NULL; } @@ -1740,7 +1745,7 @@ static void blenderSceneSetBackground(Scene *blenderscene) for (SETLOOPER(blenderscene, it, base)) { base->object->lay = base->lay; - base->object->flag = base->flag; + BKE_scene_object_base_flag_sync_from_base(base); } } @@ -2052,10 +2057,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie, for (git=tempglist.begin(); git!=tempglist.end(); git++) { Group* group = *git; - GroupObject* go; - for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + FOREACH_GROUP_OBJECT(group, blenderobject) { - Object* blenderobject = go->ob; if (converter->FindGameObject(blenderobject) == NULL) { allblobj.insert(blenderobject); @@ -2090,6 +2093,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, } } } + FOREACH_GROUP_OBJECT_END } } } diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index b40fb7a9f47..3be2c1aff43 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -133,6 +133,8 @@ bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob) // return a deformed mesh that supports mapping (with a valid CD_ORIGINDEX layer) struct DerivedMesh* BL_ModifierDeformer::GetPhysicsMesh() { + /* TODO: This doesn't work currently because of eval_ctx. */ +#if 0 /* we need to compute the deformed mesh taking into account the current * shape and skin deformers, we cannot just call mesh_create_derived_physics() * because that would use the m_transvers already deformed previously by BL_ModifierDeformer::Update(), @@ -152,10 +154,14 @@ struct DerivedMesh* BL_ModifierDeformer::GetPhysicsMesh() /* m_transverts is correct here (takes into account deform only modifiers) */ /* the derived mesh returned by this function must be released by the caller !!! */ return dm; +#endif + return NULL; } bool BL_ModifierDeformer::Update(void) { + /* TODO: This doesn't work currently because of eval_ctx. */ +#if 0 bool bShapeUpdate = BL_ShapeDeformer::Update(); if (bShapeUpdate || m_lastModifierUpdate != m_gameobj->GetLastFrame()) { @@ -208,6 +214,8 @@ bool BL_ModifierDeformer::Update(void) } } return bShapeUpdate; +#endif + return false; } bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat) diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index 4db9fcebd06..7d6195e3c38 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -113,7 +113,7 @@ if(WITH_BULLET) endif() if(WITH_AUDASPACE) - add_definitions(${AUDASPACE_DEFINITIONS}) + add_definitions(-DWITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 974dcbca95b..d78ea4eed54 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -42,7 +42,7 @@ #include "KX_ConvertActuators.h" #ifdef WITH_AUDASPACE -# include AUD_SOUND_H +# include <AUD_Sound.h> #endif // Actuators diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index 577e25d6198..5bce9fcd248 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -43,6 +43,7 @@ set(INC ../../../blender/blenlib ../../../blender/blenloader ../../../blender/blentranslation + ../../../blender/depsgraph ../../../blender/gpu ../../../blender/imbuf ../../../blender/makesdna @@ -94,7 +95,7 @@ if(WITH_INTERNATIONAL) endif() if(WITH_AUDASPACE) - add_definitions(${AUDASPACE_DEFINITIONS}) + add_definitions(-DWITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 50c34bbadaf..1b6b6defdf9 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -99,7 +99,7 @@ extern "C" #include "GHOST_Rect.h" #ifdef WITH_AUDASPACE -# include AUD_DEVICE_H +# include <AUD_Device.h> #endif static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time); @@ -586,7 +586,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixedtime", (gm->flag & GAME_ENABLE_ALL_FRAMES)) != 0); bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0); - bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0) && GPU_display_list_support(); + bool useLists = false; // (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0) && GPU_display_list_support(); bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0); bool restrictAnimFPS = (gm->flag & GAME_RESTRICT_ANIM_UPDATES) != 0; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 906e9d9a821..998058193bb 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -68,7 +68,6 @@ extern "C" #include "BKE_appdir.h" #include "BKE_blender.h" -#include "BKE_depsgraph.h" #include "BKE_global.h" #include "BKE_icons.h" #include "BKE_image.h" @@ -81,6 +80,8 @@ extern "C" #include "BKE_text.h" #include "BKE_sound.h" +#include "DEG_depsgraph.h" + #include "IMB_imbuf.h" #include "IMB_moviecache.h" @@ -509,7 +510,7 @@ int main( IMB_init(); BKE_images_init(); BKE_modifier_init(); - DAG_init(); + DEG_register_node_types(); #ifdef WITH_FFMPEG IMB_ffmpeg_init(); @@ -1201,7 +1202,7 @@ int main( IMB_exit(); BKE_images_exit(); - DAG_exit(); + DEG_free_node_types(); IMB_moviecache_destruct(); SYS_DeleteSystem(syshandle); diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp index 9cbd61590b6..572218e691d 100644 --- a/source/gameengine/Ketsji/BL_BlenderShader.cpp +++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp @@ -77,7 +77,7 @@ void BL_BlenderShader::SetProg(bool enable, double time, RAS_IRasterizer* rasty) view.getValue(&viewmat[0][0]); viewinv.getValue(&viewinvmat[0][0]); - GPU_material_bind(mGPUMat, mLightLayer, mBlenderScene->lay, time, 1, viewmat, viewinvmat, NULL, false); + GPU_material_bind(mGPUMat, mLightLayer, mBlenderScene->lay, time, 1, viewmat, viewinvmat, NULL); } else GPU_material_unbind(mGPUMat); diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp index 4f707e6267f..40384b43054 100644 --- a/source/gameengine/Ketsji/BL_Material.cpp +++ b/source/gameengine/Ketsji/BL_Material.cpp @@ -69,7 +69,6 @@ void BL_Material::Initialize() alpha = 1.f; emit = 0.f; material = 0; - memset(&mtexpoly, 0, sizeof(mtexpoly)); materialindex = 0; amb=0.5f; num_enabled = 0; diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h index 9207a41f56d..710c02f4871 100644 --- a/source/gameengine/Ketsji/BL_Material.h +++ b/source/gameengine/Ketsji/BL_Material.h @@ -84,7 +84,6 @@ public: Material* material; - MTexPoly mtexpoly; /* copy of the derived meshes tface */ Image* img[MAXTEX]; EnvMap* cubemap[MAXTEX]; diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 417f54cc8b9..cb7c0180f30 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -244,7 +244,7 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_AUDASPACE) - add_definitions(${AUDASPACE_DEFINITIONS}) + add_definitions(-DWITH_AUDASPACE) list(APPEND INC_SYS ${AUDASPACE_C_INCLUDE_DIRS} diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index d26e35f8138..98d27ef3685 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -160,12 +160,6 @@ KX_BlenderMaterial::~KX_BlenderMaterial() OnExit(); } -MTexPoly *KX_BlenderMaterial::GetMTexPoly() const -{ - // fonts on polys - return &mMaterial->mtexpoly; -} - unsigned int* KX_BlenderMaterial::GetMCol() const { // fonts on polys @@ -190,7 +184,7 @@ Material *KX_BlenderMaterial::GetBlenderMaterial() const Image *KX_BlenderMaterial::GetBlenderImage() const { - return mMaterial->mtexpoly.tpage; + return mMaterial->material ? mMaterial->material->edit_image : NULL; } Scene* KX_BlenderMaterial::GetBlenderScene() const @@ -290,11 +284,6 @@ void KX_BlenderMaterial::OnExit() mTextures[i].DeleteTex(); mTextures[i].DisableUnit(); } - - /* used to call with 'mMaterial->tface' but this can be a freed array, - * see: [#30493], so just call with NULL, this is best since it clears - * the 'lastface' pointer in GPU too - campbell */ - GPU_set_tpage(NULL, 1, mMaterial->alphablend); } @@ -310,7 +299,7 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) mLastShader = NULL; } - ras->SetAlphaBlend(TF_SOLID); + ras->SetAlphaBlend(GPU_BLEND_SOLID); BL_Texture::DisableAllTextures(); return; } @@ -334,7 +323,7 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) ras->SetAlphaBlend(mMaterial->alphablend); } else { - ras->SetAlphaBlend(TF_SOLID); + ras->SetAlphaBlend(GPU_BLEND_SOLID); ras->SetAlphaBlend(-1); // indicates custom mode // tested to be valid enums @@ -346,7 +335,7 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras) void KX_BlenderMaterial::setBlenderShaderData( bool enable, RAS_IRasterizer *ras) { if ( !enable || !mBlenderShader->Ok() ) { - ras->SetAlphaBlend(TF_SOLID); + ras->SetAlphaBlend(GPU_BLEND_SOLID); // frame cleanup. if (mLastBlenderShader) { @@ -377,7 +366,7 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) BL_Texture::DisableAllTextures(); if ( !enable ) { - ras->SetAlphaBlend(TF_SOLID); + ras->SetAlphaBlend(GPU_BLEND_SOLID); return; } @@ -420,7 +409,7 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras) ras->SetAlphaBlend(mMaterial->alphablend); } else { - ras->SetAlphaBlend(TF_SOLID); + ras->SetAlphaBlend(GPU_BLEND_SOLID); ras->SetAlphaBlend(-1); // indicates custom mode glEnable(GL_BLEND); diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index a3d10c0a89d..c562ee0c583 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -84,7 +84,6 @@ public: Material* GetBlenderMaterial() const; Image* GetBlenderImage() const; - MTexPoly *GetMTexPoly() const; unsigned int* GetMCol() const; BL_Texture * getTex (unsigned int idx) { return (idx < MAXTEX) ? mTextures + idx : NULL; diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 89aea80bb67..b22873aa862 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -30,8 +30,8 @@ * \ingroup ketsji */ - -#include "glew-mx.h" +#include "GPU_glew.h" +#include "GPU_matrix.h" #include "KX_Camera.h" #include "KX_Scene.h" #include "KX_PythonInit.h" @@ -1048,19 +1048,21 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, } const GLint *viewport; - GLdouble win[3]; - GLdouble modelmatrix[16]; - GLdouble projmatrix[16]; + GLfloat vec[3]; + GLfloat win[3]; + GLfloat modelmatrix[4][4]; + GLfloat projmatrix[4][4]; MT_Matrix4x4 m_modelmatrix = this->GetWorldToCamera(); MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); - m_modelmatrix.getValue(modelmatrix); - m_projmatrix.getValue(projmatrix); + vect.getValue(vec); + m_modelmatrix.getValue((float*) modelmatrix); + m_projmatrix.getValue((float*) projmatrix); viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); - gluProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); + gpuProject(vec, modelmatrix, projmatrix, viewport, win); vect[0] = (win[0] - viewport[0]) / viewport[2]; vect[1] = (win[1] - viewport[1]) / viewport[3]; @@ -1087,36 +1089,33 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenVect, y = 1.0 - y; //to follow Blender window coordinate system (Top-Down) - MT_Vector3 vect; - MT_Point3 campos, screenpos; - const GLint *viewport; - GLdouble win[3]; - GLdouble modelmatrix[16]; - GLdouble projmatrix[16]; + GLfloat vec[3]; + GLfloat win[3]; + GLfloat modelmatrix[4][4]; + GLfloat projmatrix[4][4]; MT_Matrix4x4 m_modelmatrix = this->GetWorldToCamera(); MT_Matrix4x4 m_projmatrix = this->GetProjectionMatrix(); - m_modelmatrix.getValue(modelmatrix); - m_projmatrix.getValue(projmatrix); + m_modelmatrix.getValue((float*) modelmatrix); + m_projmatrix.getValue((float*) projmatrix); viewport = KX_GetActiveEngine()->GetCanvas()->GetViewPort(); - vect[0] = x * viewport[2]; - vect[1] = y * viewport[3]; - - vect[0] += viewport[0]; - vect[1] += viewport[1]; + vec[0] = x * viewport[2]; + vec[1] = y * viewport[3]; - vect[2] = 0.f; + vec[0] += viewport[0]; + vec[1] += viewport[1]; - gluUnProject(vect[0], vect[1], vect[2], modelmatrix, projmatrix, viewport, &win[0], &win[1], &win[2]); + vec[2] = 0.f; - campos = this->GetCameraLocation(); - screenpos = MT_Point3(win[0], win[1], win[2]); - vect = campos-screenpos; + gpuUnProject(vec, modelmatrix, projmatrix, viewport, win); + MT_Point3 campos = this->GetCameraLocation(); + MT_Point3 screenpos(win[0], win[1], win[2]); + MT_Vector3 vect = campos - screenpos; vect.normalize(); return PyObjectFrom(vect); } diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index d08372e47d4..7abff85d39c 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -41,7 +41,7 @@ #include "RAS_CameraData.h" #include "BLI_math.h" -#include "glew-mx.h" +#include "GPU_matrix.h" // constructor KX_Dome::KX_Dome ( @@ -1685,7 +1685,7 @@ void KX_Dome::DrawEnvMap(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f,0.0f,1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); + gpuLookAt(0.0f,0.0f,1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); glPolygonMode(GL_FRONT, GL_FILL); glShadeModel(GL_SMOOTH); @@ -1830,7 +1830,7 @@ void KX_Dome::DrawDomeFisheye(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); + gpuLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); @@ -1913,7 +1913,7 @@ void KX_Dome::DrawPanorama(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); + gpuLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); @@ -1981,7 +1981,7 @@ void KX_Dome::DrawDomeWarped(void) glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0f, 0.0f, 1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); + gpuLookAt(0.0f, 0.0f, 1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 5f490747c2b..fcdcdf4a02a 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -34,6 +34,7 @@ #endif #include <stdio.h> +#include "DNA_scene_types.h" #include "KX_Light.h" #include "KX_Camera.h" @@ -44,7 +45,6 @@ #include "KX_PyMath.h" #include "DNA_object_types.h" -#include "DNA_scene_types.h" #include "DNA_lamp_types.h" #include "BKE_scene.h" @@ -65,7 +65,6 @@ KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks, m_rasterizer->AddLight(m_lightobj); m_lightobj->m_glsl = glsl; m_blenderscene = ((KX_Scene*)sgReplicationInfo)->GetBlenderScene(); - m_base = NULL; }; @@ -75,11 +74,6 @@ KX_LightObject::~KX_LightObject() m_rasterizer->RemoveLight(m_lightobj); delete(m_lightobj); } - - if (m_base) { - BKE_scene_base_unlink(m_blenderscene, m_base); - MEM_freeN(m_base); - } } @@ -93,8 +87,6 @@ CValue* KX_LightObject::GetReplica() replica->m_lightobj = m_lightobj->Clone(); replica->m_lightobj->m_light = replica; m_rasterizer->AddLight(replica->m_lightobj); - if (m_base) - m_base = NULL; return replica; } @@ -103,7 +95,6 @@ void KX_LightObject::UpdateScene(KX_Scene *kxscene) { m_lightobj->m_scene = (void*)kxscene; m_blenderscene = kxscene->GetBlenderScene(); - m_base = BKE_scene_base_add(m_blenderscene, GetBlenderObject()); } void KX_LightObject::SetLayer(int layer) diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h index b446acd6e63..b354fca4d41 100644 --- a/source/gameengine/Ketsji/KX_Light.h +++ b/source/gameengine/Ketsji/KX_Light.h @@ -51,7 +51,6 @@ protected: RAS_ILightObject* m_lightobj; class RAS_IRasterizer* m_rasterizer; //needed for registering and replication of lightobj Scene* m_blenderscene; - Base* m_base; public: KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,RAS_IRasterizer* rasterizer,RAS_ILightObject* lightobj, bool glsl); diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp index 5beda2e038a..83accb1d7a5 100644 --- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp +++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp @@ -113,6 +113,8 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts, float *&dvertices, int &ndvertsuniq, unsigned short *&dtris, int& ndtris, int &vertsPerPoly) { + /* TODO: This doesn't work currently because of eval_ctx. */ +#if 0 DerivedMesh* dm = mesh_create_derived_no_virtual(GetScene()->GetBlenderScene(), GetBlenderObject(), NULL, CD_MASK_MESH); CustomData *pdata = dm->getPolyDataLayout(dm); @@ -280,6 +282,8 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts, dm->release(dm); return true; +#endif + return false; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index b3061087344..48b50d24975 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -105,6 +105,7 @@ #include "KX_Light.h" +#include "BKE_group.h" #include "BLI_task.h" static void *KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene) @@ -720,7 +721,6 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) KX_GameObject* gameobj; Object* blgroupobj = groupobj->GetBlenderObject(); Group* group; - GroupObject *go; vector<KX_GameObject*> duplilist; if (!groupobj->GetSGNode() || @@ -738,9 +738,9 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) m_groupGameObjects.clear(); group = blgroupobj->dup_group; - for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + FOREACH_GROUP_BASE(group, base) { - Object* blenderobj = go->ob; + Object *blenderobj = base->object; if (blgroupobj == blenderobj) // this check is also in group_duplilist() continue; @@ -755,13 +755,13 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) gameobj->SetBlenderGroupObject(blgroupobj); - if ((blenderobj->lay & group->layer)==0) - { + if ((base->flag & BASE_VISIBLED) == 0) { // object is not visible in the 3D view, will not be instantiated continue; } m_groupGameObjects.insert(gameobj); } + FOREACH_GROUP_BASE_END set<CValue*>::iterator oit; for (oit=m_groupGameObjects.begin(); oit != m_groupGameObjects.end(); oit++) diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 64aab31ba22..a09429450cb 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -37,14 +37,12 @@ #include "KX_SoundActuator.h" #ifdef WITH_AUDASPACE -# ifdef WITH_SYSTEM_AUDASPACE typedef float sample_t; -# include AUD_PYTHON_H -# endif -# include AUD_SOUND_H -# include AUD_SPECIAL_H -# include AUD_DEVICE_H -# include AUD_HANDLE_H +# include <python/PyAPI.h> +# include <AUD_Sound.h> +# include <AUD_Special.h> +# include <AUD_Device.h> +# include <AUD_Handle.h> #endif #include "KX_GameObject.h" diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h index 5ec2fda722f..4f3e6f707e0 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.h +++ b/source/gameengine/Ketsji/KX_SoundActuator.h @@ -35,8 +35,8 @@ #include "SCA_IActuator.h" #ifdef WITH_AUDASPACE -# include AUD_SOUND_H -# include AUD_HANDLE_H +# include <AUD_Sound.h> +# include <AUD_Handle.h> #endif #include "BKE_sound.h" diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index c79e1c23ef6..b3cee944880 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -2234,7 +2234,9 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA std::vector<int> vert_remap_array(numverts, 0); for (mf = mface, tf = tface, i = 0; i < numpolys; mf++, tf++, i++) { - if (tf->mode & TF_DYNAMIC) { + // 2.8x TODO: use GEMAT_NOPHYSICS. + // if (tf->mode & TF_DYNAMIC) + { int flen; if (mf->v4) { @@ -2271,7 +2273,9 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA int *poly_index_pt = &m_polygonIndexArray[0]; for (mf = mface, tf = tface, i = 0; i < numpolys; mf++, tf++, i++) { - if (tf->mode & TF_DYNAMIC) { + // 2.8x TODO: use GEMAT_NOPHYSICS. + // if (tf->mode & TF_DYNAMIC) + { int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i) : i; if (mf->v4) { diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp index 2a736aa7deb..1d22d2debf9 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp @@ -233,10 +233,6 @@ Image *RAS_IPolyMaterial::GetBlenderImage() const { return NULL; } -MTexPoly *RAS_IPolyMaterial::GetMTexPoly() const -{ - return NULL; -} unsigned int *RAS_IPolyMaterial::GetMCol() const { diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index a34f7a9b390..7023d305510 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -41,7 +41,6 @@ #endif class RAS_IRasterizer; -struct MTexPoly; struct Material; struct Image; struct Scene; @@ -167,7 +166,6 @@ public: virtual Material* GetBlenderMaterial() const; virtual Image* GetBlenderImage() const; - virtual MTexPoly* GetMTexPoly() const; virtual unsigned int* GetMCol() const; virtual Scene* GetBlenderScene() const; virtual void ReleaseMaterial(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp index 69e859f06d9..18254357f85 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp @@ -43,6 +43,7 @@ #include "DNA_lamp_types.h" #include "DNA_scene_types.h" +#include "GPU_lamp.h" #include "GPU_material.h" RAS_OpenGLLight::RAS_OpenGLLight(RAS_OpenGLRasterizer *ras) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 5eed9b3b8f8..d1c3162f752 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -60,6 +60,7 @@ extern "C"{ #include "BLF_api.h" #include "BKE_DerivedMesh.h" + #include "DNA_material_types.h" } @@ -710,7 +711,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms, glattrib = unit; GPU_render_text( - polymat->GetMTexPoly(), polymat->GetDrawingMode(), mytext, mytext.Length(), polymat->GetMCol(), + polymat->GetDrawingMode(), mytext, mytext.Length(), polymat->GetMCol(), v_ptr, uv_ptr, glattrib); ClearCachingInfo(); @@ -769,7 +770,6 @@ static RAS_MeshSlot *current_ms; static RAS_MeshObject *current_mesh; static int current_blmat_nr; static GPUVertexAttribs current_gpu_attribs; -static Image *current_image; static int CheckMaterialDM(int matnr, void *attribs) { // only draw the current material @@ -781,33 +781,6 @@ static int CheckMaterialDM(int matnr, void *attribs) return 1; } -static DMDrawOption CheckTexDM(MTexPoly *mtexpoly, const bool has_mcol, int matnr) -{ - - // index is the original face index, retrieve the polygon - if (matnr == current_blmat_nr && - (mtexpoly == NULL || mtexpoly->tpage == current_image)) { - // must handle color. - if (current_wireframe) - return DM_DRAW_OPTION_NO_MCOL; - if (current_ms->m_bObjectColor) { - MT_Vector4& rgba = current_ms->m_RGBAcolor; - glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]); - // don't use mcol - return DM_DRAW_OPTION_NO_MCOL; - } - if (!has_mcol) { - // we have to set the color from the material - unsigned char rgba[4]; - current_polymat->GetMaterialRGBAColor(rgba); - glColor4ubv((const GLubyte *)rgba); - return DM_DRAW_OPTION_NORMAL; - } - return DM_DRAW_OPTION_NORMAL; - } - return DM_DRAW_OPTION_SKIP; -} - void RAS_OpenGLRasterizer::DrawDerivedMesh(class RAS_MeshSlot &ms) { // mesh data is in derived mesh @@ -824,7 +797,10 @@ void RAS_OpenGLRasterizer::DrawDerivedMesh(class RAS_MeshSlot &ms) else this->SetCullFace(false); - if (current_polymat->GetFlag() & RAS_BLENDERGLSL) { +#if 0 + if (current_polymat->GetFlag() & RAS_BLENDERGLSL) +#endif + { // GetMaterialIndex return the original mface material index, // increment by 1 to match what derived mesh is doing current_blmat_nr = current_polymat->GetMaterialIndex()+1; @@ -839,11 +815,6 @@ void RAS_OpenGLRasterizer::DrawDerivedMesh(class RAS_MeshSlot &ms) int current_blend_mode = GPU_get_material_alpha_blend(); ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM); GPU_set_material_alpha_blend(current_blend_mode); - } else { - //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol); - current_blmat_nr = current_polymat->GetMaterialIndex(); - current_image = current_polymat->GetBlenderImage(); - ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM, NULL, NULL, DM_DRAW_USE_ACTIVE_UV); } } |