[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49340] branches/ge_harmony/source/ gameengine: Undoing r49325, scenes need some control over filters since different scenes can have different filters .
Daniel Stokes
kupomail at gmail.com
Sun Jul 29 01:11:36 CEST 2012
Revision: 49340
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49340
Author: kupoman
Date: 2012-07-28 23:11:35 +0000 (Sat, 28 Jul 2012)
Log Message:
-----------
Undoing r49325, scenes need some control over filters since different scenes can have different filters.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49325
Modified Paths:
--------------
branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
branches/ge_harmony/source/gameengine/Converter/KX_ConvertActuators.cpp
branches/ge_harmony/source/gameengine/GameLogic/CMakeLists.txt
branches/ge_harmony/source/gameengine/GameLogic/SCA_IScene.h
branches/ge_harmony/source/gameengine/Ketsji/CMakeLists.txt
branches/ge_harmony/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
branches/ge_harmony/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
branches/ge_harmony/source/gameengine/Ketsji/KX_Scene.cpp
branches/ge_harmony/source/gameengine/Ketsji/KX_Scene.h
Added Paths:
-----------
branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h
Removed Paths:
-------------
branches/ge_harmony/source/gameengine/Ketsji/KX_2DFilterActuator.cpp
branches/ge_harmony/source/gameengine/Ketsji/KX_2DFilterActuator.h
Modified: branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
===================================================================
--- branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 2012-07-28 21:45:51 UTC (rev 49339)
+++ branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 2012-07-28 23:11:35 UTC (rev 49340)
@@ -366,8 +366,7 @@
Shader *shader = link->shader;
if (shader) {
STR_String text = STR_String(shader->source);
- RAS_IRasterizer *rast = KX_GetActiveEngine()->GetRasterizer();
- rast->EnableFilter(vector<STR_String>(), NULL, RAS_IRasterizer::RAS_2DFILTER_CUSTOMFILTER, i, text);
+ destinationscene->Update2DFilter(vector<STR_String>(), NULL, RAS_IRasterizer::RAS_2DFILTER_CUSTOMFILTER, i, text);
}
}
Modified: branches/ge_harmony/source/gameengine/Converter/KX_ConvertActuators.cpp
===================================================================
--- branches/ge_harmony/source/gameengine/Converter/KX_ConvertActuators.cpp 2012-07-28 21:45:51 UTC (rev 49339)
+++ branches/ge_harmony/source/gameengine/Converter/KX_ConvertActuators.cpp 2012-07-28 23:11:35 UTC (rev 49340)
@@ -52,9 +52,9 @@
#include "SCA_PropertyActuator.h"
#include "SCA_LogicManager.h"
#include "SCA_RandomActuator.h"
+#include "SCA_2DFilterActuator.h"
// Ketsji specific logicbricks
-#include "KX_2DFilterActuator.h"
#include "KX_SceneActuator.h"
#include "KX_IpoActuator.h"
#include "KX_SoundActuator.h"
@@ -945,7 +945,7 @@
case ACT_2DFILTER:
{
bTwoDFilterActuator *_2dfilter = (bTwoDFilterActuator*) bact->data;
- KX_2DFilterActuator *tmp = NULL;
+ SCA_2DFilterActuator *tmp = NULL;
RAS_IRasterizer::RAS_2DFILTER_MODE filtermode;
switch(_2dfilter->type)
@@ -1000,7 +1000,7 @@
break;
}
- tmp = new KX_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
+ tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
_2dfilter->float_arg,_2dfilter->int_arg,ketsjiEngine->GetRasterizer(),scene);
if (_2dfilter->text)
Modified: branches/ge_harmony/source/gameengine/GameLogic/CMakeLists.txt
===================================================================
--- branches/ge_harmony/source/gameengine/GameLogic/CMakeLists.txt 2012-07-28 21:45:51 UTC (rev 49339)
+++ branches/ge_harmony/source/gameengine/GameLogic/CMakeLists.txt 2012-07-28 23:11:35 UTC (rev 49340)
@@ -40,6 +40,7 @@
)
set(SRC
+ SCA_2DFilterActuator.cpp
SCA_ANDController.cpp
SCA_ActuatorEventManager.cpp
SCA_ActuatorSensor.cpp
@@ -82,6 +83,7 @@
Joystick/SCA_Joystick.cpp
Joystick/SCA_JoystickEvents.cpp
+ SCA_2DFilterActuator.h
SCA_ANDController.h
SCA_ActuatorEventManager.h
SCA_ActuatorSensor.h
Copied: branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp (from rev 49325, branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp)
===================================================================
--- branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp (rev 0)
+++ branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp 2012-07-28 23:11:35 UTC (rev 49340)
@@ -0,0 +1,148 @@
+/*
+ * SCA_2DFilterActuator.cpp
+ *
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file gameengine/GameLogic/SCA_2DFilterActuator.cpp
+ * \ingroup gamelogic
+ */
+
+
+#include <stddef.h>
+
+#include "SCA_IActuator.h"
+#include "SCA_2DFilterActuator.h"
+
+#include <iostream>
+
+SCA_2DFilterActuator::~SCA_2DFilterActuator()
+{
+}
+
+SCA_2DFilterActuator::SCA_2DFilterActuator(
+ SCA_IObject *gameobj,
+ RAS_IRasterizer::RAS_2DFILTER_MODE type,
+ short flag,
+ float float_arg,
+ int int_arg,
+ RAS_IRasterizer* rasterizer,
+ SCA_IScene* scene)
+ : SCA_IActuator(gameobj, KX_ACT_2DFILTER),
+ m_type(type),
+ m_disableMotionBlur(flag),
+ m_float_arg(float_arg),
+ m_int_arg(int_arg),
+ m_rasterizer(rasterizer),
+ m_scene(scene)
+{
+ m_gameobj = NULL;
+ if (gameobj) {
+ m_propNames = gameobj->GetPropertyNames();
+ m_gameobj = gameobj;
+ }
+}
+
+
+CValue* SCA_2DFilterActuator::GetReplica()
+{
+ SCA_2DFilterActuator* replica = new SCA_2DFilterActuator(*this);
+ replica->ProcessReplica();
+ return replica;
+}
+
+
+bool SCA_2DFilterActuator::Update()
+{
+ bool bNegativeEvent = IsNegativeEvent();
+ RemoveAllEvents();
+
+
+ if (bNegativeEvent)
+ return false; // do nothing on negative events
+
+ if ( m_type == RAS_IRasterizer::RAS_2DFILTER_MOTIONBLUR )
+ {
+ if (!m_disableMotionBlur)
+ m_rasterizer->EnableMotionBlur(m_float_arg);
+ else
+ m_rasterizer->DisableMotionBlur();
+
+ return false;
+ }
+ else if (m_type < RAS_IRasterizer::RAS_2DFILTER_NUMBER_OF_FILTERS)
+ {
+ m_scene->Update2DFilter(m_propNames, m_gameobj, m_type, m_int_arg, m_shaderText);
+ }
+ // once the filter is in place, no need to update it again => disable the actuator
+ return false;
+}
+
+
+void SCA_2DFilterActuator::SetShaderText(const char *text)
+{
+ m_shaderText = text;
+}
+
+#ifdef WITH_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python functions */
+/* ------------------------------------------------------------------------- */
+
+/* Integration hooks ------------------------------------------------------- */
+PyTypeObject SCA_2DFilterActuator::Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "SCA_2DFilterActuator",
+ sizeof(PyObjectPlus_Proxy),
+ 0,
+ py_base_dealloc,
+ 0,
+ 0,
+ 0,
+ 0,
+ py_base_repr,
+ 0,0,0,0,0,0,0,0,0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
+ &SCA_IActuator::Type,
+ 0,0,0,0,0,0,
+ py_base_new
+};
+
+PyMethodDef SCA_2DFilterActuator::Methods[] = {
+ /* add python functions to deal with m_msg... */
+ {NULL,NULL}
+};
+
+PyAttributeDef SCA_2DFilterActuator::Attributes[] = {
+ KX_PYATTRIBUTE_STRING_RW("shaderText", 0, 64000, false, SCA_2DFilterActuator, m_shaderText),
+ KX_PYATTRIBUTE_SHORT_RW("disableMotionBlur", 0, 1, true, SCA_2DFilterActuator, m_disableMotionBlur),
+ KX_PYATTRIBUTE_ENUM_RW("mode",RAS_IRasterizer::RAS_2DFILTER_ENABLED,RAS_IRasterizer::RAS_2DFILTER_NUMBER_OF_FILTERS,false,SCA_2DFilterActuator,m_type),
+ KX_PYATTRIBUTE_INT_RW("passNumber", 0, 100, true, SCA_2DFilterActuator, m_int_arg),
+ KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg),
+ { NULL } //Sentinel
+};
+
+#endif
Copied: branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h (from rev 49325, branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h)
===================================================================
--- branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h (rev 0)
+++ branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h 2012-07-28 23:11:35 UTC (rev 49340)
@@ -0,0 +1,69 @@
+/*
+ * SCA_2DFilterActuator.h
+ *
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file SCA_2DFilterActuator.h
+ * \ingroup gamelogic
+ */
+
+#ifndef __SCA_2DFILTERACTUATOR_H__
+#define __SCA_2DFILTERACTUATOR_H__
+
+#include "RAS_IRasterizer.h"
+#include "SCA_IActuator.h"
+#include "SCA_IScene.h"
+
+class SCA_2DFilterActuator : public SCA_IActuator
+{
+ Py_Header
+
+private:
+ vector<STR_String> m_propNames;
+ RAS_IRasterizer::RAS_2DFILTER_MODE m_type;
+ short m_disableMotionBlur;
+ float m_float_arg;
+ int m_int_arg;
+ STR_String m_shaderText;
+ RAS_IRasterizer* m_rasterizer;
+ SCA_IScene* m_scene;
+
+public:
+
+ SCA_2DFilterActuator(
+ class SCA_IObject* gameobj,
+ RAS_IRasterizer::RAS_2DFILTER_MODE type,
+ short flag,
+ float float_arg,
+ int int_arg,
+ RAS_IRasterizer* rasterizer,
+ SCA_IScene* scene);
+
+ void SetShaderText(const char *text);
+ virtual ~SCA_2DFilterActuator();
+ virtual bool Update();
+
+ virtual CValue* GetReplica();
+};
+#endif
Modified: branches/ge_harmony/source/gameengine/GameLogic/SCA_IScene.h
===================================================================
--- branches/ge_harmony/source/gameengine/GameLogic/SCA_IScene.h 2012-07-28 21:45:51 UTC (rev 49339)
+++ branches/ge_harmony/source/gameengine/GameLogic/SCA_IScene.h 2012-07-28 23:11:35 UTC (rev 49340)
@@ -35,6 +35,7 @@
#include <vector>
#include "STR_String.h"
+#include "RAS_IRasterizer.h"
#ifdef WITH_CXX_GUARDEDALLOC
#include "MEM_guardedalloc.h"
@@ -67,7 +68,11 @@
void AddDebugProperty(class CValue* debugprop,
const STR_String &name);
void RemoveAllDebugProperties();
+ virtual void Update2DFilter(std::vector<STR_String>& propNames, void* gameObj,
+ RAS_IRasterizer::RAS_2DFILTER_MODE filtermode,
+ int pass, STR_String& text) {}
+
#ifdef WITH_CXX_GUARDEDALLOC
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list