Panagiotis Christopoulos Charitos hace 14 años
padre
commit
2df260e979

+ 4 - 4
src/Main.cpp

@@ -26,7 +26,7 @@
 #include "r/MainRenderer.h"
 #include "phys/Character.h"
 #include "phys/RigidBody.h"
-#include "script/Engine.h"
+#include "script/ScriptManager.h"
 #include "core/StdinListener.h"
 #include "scene/ModelNode.h"
 #include "rsrc/Model.h"
@@ -336,7 +336,7 @@ void mainLoopExtra()
 	if(InputSingleton::get().getKey(SDL_SCANCODE_Y) == 1)
 	{
 		INFO("Exec script");
-		script::EngineSingleton::get().execScript(util::readFile("test.py").c_str());
+		ScriptManagerSingleton::get().execScript(util::readFile("test.py").c_str());
 	}
 
 	mover->getLocalTransform().getRotation().reorthogonalize();
@@ -514,7 +514,7 @@ void initSubsystems(int argc, char* argv[])
 		"sys.stdout = StdoutCatcher()\n"
 		"sys.stderr = StderrCatcher()\n";
 
-	script::EngineSingleton::get().execScript(commonPythonCode);
+	ScriptManagerSingleton::get().execScript(commonPythonCode);
 
 	// Stdin listener
 	StdinListenerSingleton::get().start();
@@ -546,7 +546,7 @@ void execStdinScpripts()
 
 		try
 		{
-			script::EngineSingleton::get().execScript(cmd.c_str(),
+			ScriptManagerSingleton::get().execScript(cmd.c_str(),
 				"command line input");
 		}
 		catch(Exception& e)

+ 1 - 5
src/core/Globals.h

@@ -12,11 +12,7 @@ typedef Singleton<class Scene> SceneSingleton;
 typedef Singleton<class App> AppSingleton;
 typedef Singleton<class StdinListener> StdinListenerSingleton;
 typedef Singleton<class GlStateMachine> GlStateMachineSingleton;
-
-namespace script {
-typedef Singleton<class Engine> EngineSingleton;
-}
-
+typedef Singleton<class ScriptManager> ScriptManagerSingleton;
 typedef Singleton<class EventManager> EventManagerSingleton;
 
 namespace parallel {

+ 30 - 29
src/rsrc/Material.h

@@ -45,40 +45,41 @@ class ShaderProgram;
 /// 	<wireframe>true | false</wireframe>
 ///
 /// 	<shaderProgram>
-/// 		<includes>
-/// 			<include>file.glsl</include>
-/// 			<include>file2.glsl</include>
-/// 		</includes>
+/// 		<fragmentShader>
+/// 			<includes>
+/// 				<include>file.glsl</include>
+/// 				<include>file2.glsl</include>
+/// 			</includes>
 ///
-/// 		<inputs>
-/// 			<input> *
-/// 				<name>xx</name>
-/// 				<value>
-/// 					<float>0.0</float> |
-/// 					<vec2><x>0.0</x><y>0.0</y></vec2> |
-/// 					<vec3><x>0.0</x><y>0.0</y><z>0.0</z></vec3> |
-/// 					<vec4><x>0.0</x><y>0.0</y><z>0.0</z><w>0.0</w></vec4> |
-/// 					<sampler2D>path/to/image.tga</sampler2D>
-/// 				</value>
-/// 			</input>
-/// 		</inputs>
-///
-/// 		<operations>
-/// 			<operation>
-/// 				<id>x</id>
-/// 				<function>functionName</function>
-/// 				<arguments>
-/// 					<argument>xx</argument>
-/// 					<argument>yy</argument>
-/// 				</arguments>
-/// 			</operation>
-/// 		</operations>
+/// 			<inputs>
+/// 				<input>
+/// 					<name>xx</name>
+/// 					<value> *
+/// 						<float>0.0</float> |
+/// 						<vec2><x>0.0</x><y>0.0</y></vec2> |
+/// 						<vec3><x>0.0</x><y>0.0</y><z>0.0</z></vec3> |
+/// 						<vec4><x>0.0</x><y>0.0</y><z>0.0</z><w>0.0</w></vec4> |
+/// 						<sampler2D>path/to/image.tga</sampler2D>
+/// 					</value>
+/// 				</input>
+/// 			</inputs>
 ///
+/// 			<operations>
+/// 				<operation>
+/// 					<id>x</id>
+/// 					<function>functionName</function>
+/// 					<arguments>
+/// 						<argument>xx</argument>
+/// 						<argument>yy</argument>
+/// 					</arguments>
+/// 				</operation>
+/// 			</operations>
+/// 		</fragmentShader>
 /// 	</shaderProgram>
 /// </material>
 /// @endcode
-/// *: For if the value is not set then the in variable will be build in or
-///    standard varying
+/// *: If the value tag is not present then the in variable is assumed to be
+///    build
 class Material: public MaterialProperties
 {
 	public:

+ 0 - 0
src/script/Common.h → src/script/ScriptCommon.h


+ 4 - 9
src/script/Engine.cpp → src/script/ScriptManager.cpp

@@ -1,8 +1,8 @@
-#include "Engine.h"
+#include "ScriptManager.h"
 #include "util/Exception.h"
 #include "core/Logger.h"
 #include "core/Globals.h"
-#include "Common.h"
+#include "ScriptCommon.h"
 #include <Python.h>
 
 
@@ -45,16 +45,13 @@ BOOST_PYTHON_MODULE(Anki)
 }
 
 
-namespace script {
-
-
 using namespace boost::python;
 
 
 //==============================================================================
 // init                                                                        =
 //==============================================================================
-void Engine::init()
+void ScriptManager::init()
 {
 	INFO("Initializing scripting engine...");
 
@@ -71,7 +68,7 @@ void Engine::init()
 //==============================================================================
 // execScript                                                                  =
 //==============================================================================
-void Engine::execScript(const char* script, const char* scriptName)
+void ScriptManager::execScript(const char* script, const char* scriptName)
 {
 	try
 	{
@@ -85,5 +82,3 @@ void Engine::execScript(const char* script, const char* scriptName)
 	}
 }
 
-
-} // end namespace

+ 6 - 12
src/script/Engine.h → src/script/ScriptManager.h

@@ -1,17 +1,14 @@
-#ifndef SCRIPT_ENGINE_H
-#define SCRIPT_ENGINE_H
+#ifndef SCRIPT_MANAGER_H
+#define SCRIPT_MANAGER_H
 
 #include <boost/python.hpp>
 
 
-namespace script {
-
-
-/// The scripting engine using Python
-class Engine
+/// The scripting manager using Python
+class ScriptManager
 {
 	public:
-		Engine() {init();}
+		ScriptManager() {init();}
 
 		/// Execute python script
 		/// @param script Script source
@@ -34,13 +31,10 @@ class Engine
 
 
 template<typename Type>
-inline void Engine::exposeVar(const char* varName, Type* var)
+inline void ScriptManager::exposeVar(const char* varName, Type* var)
 {
 	boost::python::scope(ankiModule).attr(varName) = boost::python::ptr(var);
 }
 
 
-} // end namespace
-
-
 #endif

+ 1 - 1
src/script/core/App.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "core/App.h"
 
 

+ 1 - 1
src/script/core/Globals.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "core/Globals.h"
 #include "core/Logger.h"
 #include "r/MainRenderer.h"

+ 1 - 1
src/script/core/Logger.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "core/Logger.h"
 
 

+ 1 - 1
src/script/event/EventManager.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "event/EventManager.h"
 
 #include "event/SceneColorEvent.h"

+ 1 - 1
src/script/event/MainRendererPpsHdrEvent.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "event/MainRendererPpsHdrEvent.h"
 
 

+ 1 - 1
src/script/event/SceneColorEvent.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "event/SceneColorEvent.h"
 
 

+ 1 - 1
src/script/i/Input.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "i/Input.h"
 
 

+ 1 - 1
src/script/m/Common.h → src/script/m/ScriptMCommon.h

@@ -1,7 +1,7 @@
 #ifndef SCRIPT_M_COMMON_H
 #define SCRIPT_M_COMMON_H
 
-#include "../Common.h"
+#include "../ScriptCommon.h"
 
 
 template<typename ClassType, typename RetType,

+ 1 - 1
src/script/m/Vec2.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptMCommon.h"
 #include "m/Math.h"
 
 

+ 1 - 1
src/script/m/Vec3.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptMCommon.h"
 #include "m/Math.h"
 
 

+ 1 - 1
src/script/m/Vec4.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptMCommon.h"
 #include "m/Math.h"
 
 

+ 1 - 1
src/script/r/Bl.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "r/Bl.h"
 
 

+ 1 - 1
src/script/r/Dbg.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "r/Dbg.h"
 
 

+ 1 - 1
src/script/r/Hdr.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "r/Hdr.h"
 
 

+ 1 - 1
src/script/r/MainRenderer.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "r/MainRenderer.h"
 #include "r/Dbg.h"
 

+ 1 - 1
src/script/r/Pps.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "r/Pps.h"
 #include "r/Hdr.h"
 #include "r/Bl.h"

+ 1 - 1
src/script/r/Renderer.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "r/Renderer.h"
 
 

+ 1 - 1
src/script/scene/Camera.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/Camera.h"
 
 

+ 1 - 1
src/script/scene/MaterialRuntime.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/MaterialRuntime.h"
 
 

+ 1 - 1
src/script/scene/MaterialRuntimeVariable.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/MaterialRuntimeVariable.h"
 
 

+ 1 - 1
src/script/scene/ModelNode.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/ModelNode.h"
 
 

+ 1 - 1
src/script/scene/ModelPatchNode.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/ModelPatchNode.h"
 
 

+ 1 - 1
src/script/scene/PatchNode.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/PatchNode.h"
 
 

+ 1 - 1
src/script/scene/Scene.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/Scene.h"
 #include "scene/Camera.h"
 #include "scene/ModelNode.h"

+ 1 - 1
src/script/scene/SceneNode.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "scene/SceneNode.h"
 
 

+ 1 - 1
src/script/util/HighRezTimer.cpp

@@ -1,4 +1,4 @@
-#include "Common.h"
+#include "ScriptCommon.h"
 #include "util/HighRezTimer.h"