浏览代码

Refactoring & Material

Panagiotis Christopoulos Charitos 14 年之前
父节点
当前提交
5727fb9c85

+ 15 - 0
src/Resources/material/Fwd.h

@@ -0,0 +1,15 @@
+#ifndef MATERIAL_FWD_H
+#define MATERIAL_FWD_H
+
+
+namespace material {
+
+class Variable;
+class BuildinVariable;
+class UserVariable;
+class Material;
+
+}
+
+
+#endif

+ 0 - 0
src/Scene/MaterialRuntime.cpp → src/Scene/material_runtime/MaterialRuntime.cpp


+ 0 - 0
src/Scene/MaterialRuntime.h → src/Scene/material_runtime/MaterialRuntime.h


+ 6 - 0
src/Scene/UserMaterialVariableRuntime.cpp → src/Scene/material_runtime/Variable.cpp

@@ -2,6 +2,9 @@
 #include "Resources/UserVariable.h"
 
 
+namespace material_runtime {
+
+
 //==============================================================================
 // ConstructVisitor::operator() <RsrcPtr<Texture> >                            =
 //==============================================================================
@@ -54,3 +57,6 @@ void UserVariableRuntime::setValue<
 	throw EXCEPTION("You shouldn't call this setter");
 	boost::get<ConstPtrRsrcPtrTexture>(data) = v;
 }
+
+
+} // end namespace

+ 18 - 12
src/Scene/UserMaterialVariableRuntime.h → src/Scene/material_runtime/Variable.h

@@ -1,19 +1,22 @@
-#ifndef USER_MATERIAL_VARIABLE_RUNTIME_H
-#define USER_MATERIAL_VARIABLE_RUNTIME_H
+#ifndef MATERIAL_RUNTIME_VARIABLE_H
+#define MATERIAL_RUNTIME_VARIABLE_H
 
 #include "Util/Accessors.h"
 #include "Math/Math.h"
 #include "Resources/RsrcPtr.h"
+#include "Resources/material/Fwd.h"
 #include <boost/variant.hpp>
 
 
-class UserVariable;
 class Texture;
 
 
+namespace material_runtime {
+
+
 /// This holds a copy of the MtlUserDefinedVar's data in order to be changed
 /// inside the main loop
-class UserVariableRuntime
+class Variable
 {
 	public:
 		typedef const RsrcPtr<Texture>* ConstPtrRsrcPtrTexture;
@@ -25,13 +28,13 @@ class UserVariableRuntime
 			ConstPtrRsrcPtrTexture> DataVariant;
 
 		/// Constructor
-		UserVariableRuntime(const UserVariable& umv);
+		Variable(const material::UserVariable& umv);
 		/// Destructor
-		~UserVariableRuntime();
+		~Variable();
 
 		/// @name Accessors
 		/// @{
-		GETTER_R(UserVariable, umv, getUserVariable)
+		GETTER_R(material::UserVariable, umv, getUserVariable)
 		GETTER_RW(DataVariant, data, getDataVariant)
 
 		/// Get the value of the variant
@@ -55,9 +58,9 @@ class UserVariableRuntime
 		class ConstructVisitor: public boost::static_visitor<void>
 		{
 			public:
-				UserVariableRuntime& udvr;
+				Variable& udvr;
 
-				ConstructVisitor(UserVariableRuntime& udmvr);
+				ConstructVisitor(Variable& udmvr);
 
 				/// Template method that applies to all DataVariant values
 				/// except texture resource
@@ -66,15 +69,18 @@ class UserVariableRuntime
 					{udvr.getDataVariant() = x;}
 		};
 
-		const UserVariable& umv; ///< Know the resource
+		const material::UserVariable& umv; ///< Know the resource
 		DataVariant data; /// The data
 };
 
 
-inline UserVariableRuntime::ConstructVisitor::ConstructVisitor(
-	UserVariableRuntime& udvr_)
+inline Variable::ConstructVisitor::ConstructVisitor(
+	material::UserVariable& udvr_)
 :	udvr(udvr_)
 {}
 
 
+} // end namespace
+
+
 #endif