[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49327] branches/ge_harmony/source/ gameengine: Making the rasterizer solely responsible for filters.

Daniel Stokes kupomail at gmail.com
Sat Jul 28 12:23:43 CEST 2012


Revision: 49327
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49327
Author:   kupoman
Date:     2012-07-28 10:23:42 +0000 (Sat, 28 Jul 2012)
Log Message:
-----------
Making the rasterizer solely responsible for filters. This means moving the filter interface from the game scene and moving the 2dfilter actuator from SCA to KX to give it access to the rasterizer.

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/Ketsji/KX_2DFilterActuator.cpp
    branches/ge_harmony/source/gameengine/Ketsji/KX_2DFilterActuator.h

Removed Paths:
-------------
    branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
    branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h

Modified: branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
===================================================================
--- branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp	2012-07-28 09:45:39 UTC (rev 49326)
+++ branches/ge_harmony/source/gameengine/Converter/KX_BlenderSceneConverter.cpp	2012-07-28 10:23:42 UTC (rev 49327)
@@ -366,7 +366,8 @@
 		Shader *shader = link->shader;
 		if (shader) {
 			STR_String text = STR_String(shader->source);
-			destinationscene->Update2DFilter(vector<STR_String>(), NULL, RAS_IRasterizer::RAS_2DFILTER_CUSTOMFILTER, i, text);
+			RAS_IRasterizer *rast = KX_GetActiveEngine()->GetRasterizer();
+			rast->EnableFilter(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 09:45:39 UTC (rev 49326)
+++ branches/ge_harmony/source/gameengine/Converter/KX_ConvertActuators.cpp	2012-07-28 10:23:42 UTC (rev 49327)
@@ -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;
-			SCA_2DFilterActuator *tmp = NULL;
+			KX_2DFilterActuator *tmp = NULL;
 
 			RAS_IRasterizer::RAS_2DFILTER_MODE filtermode;
 			switch(_2dfilter->type)
@@ -1000,7 +1000,7 @@
 					break;
 			}
 
-			tmp = new SCA_2DFilterActuator(gameobj, filtermode, _2dfilter->flag,
+			tmp = new KX_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 09:45:39 UTC (rev 49326)
+++ branches/ge_harmony/source/gameengine/GameLogic/CMakeLists.txt	2012-07-28 10:23:42 UTC (rev 49327)
@@ -40,7 +40,6 @@
 )
 
 set(SRC
-	SCA_2DFilterActuator.cpp
 	SCA_ANDController.cpp
 	SCA_ActuatorEventManager.cpp
 	SCA_ActuatorSensor.cpp
@@ -83,7 +82,6 @@
 	Joystick/SCA_Joystick.cpp
 	Joystick/SCA_JoystickEvents.cpp
 
-	SCA_2DFilterActuator.h
 	SCA_ANDController.h
 	SCA_ActuatorEventManager.h
 	SCA_ActuatorSensor.h

Deleted: branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
===================================================================
--- branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp	2012-07-28 09:45:39 UTC (rev 49326)
+++ branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp	2012-07-28 10:23:42 UTC (rev 49327)
@@ -1,148 +0,0 @@
-/*
- * 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

Deleted: branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h
===================================================================
--- branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h	2012-07-28 09:45:39 UTC (rev 49326)
+++ branches/ge_harmony/source/gameengine/GameLogic/SCA_2DFilterActuator.h	2012-07-28 10:23:42 UTC (rev 49327)
@@ -1,69 +0,0 @@
-/*
- * 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 09:45:39 UTC (rev 49326)
+++ branches/ge_harmony/source/gameengine/GameLogic/SCA_IScene.h	2012-07-28 10:23:42 UTC (rev 49327)
@@ -35,7 +35,6 @@
 #include <vector>
 
 #include "STR_String.h"
-#include "RAS_IRasterizer.h"
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -68,11 +67,7 @@
 	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
 	MEM_CXX_CLASS_ALLOC_FUNCS("GE:SCA_IScene")
 #endif

Modified: branches/ge_harmony/source/gameengine/Ketsji/CMakeLists.txt
===================================================================

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list