Browse Source

Engine compiles after Gizmo modifications (still untested)

Marko Pintera 11 years ago
parent
commit
77ab742482

+ 1 - 0
BansheeEditor/Include/BsGizmoManager.h

@@ -5,6 +5,7 @@
 #include "BsColor.h"
 #include "BsVector2I.h"
 #include "BsMatrix4.h"
+#include "BsGpuParam.h"
 
 namespace BansheeEngine
 {

+ 8 - 8
BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -1099,14 +1099,14 @@ namespace BansheeEngine
 			{ PickingPSFile,			"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
 			{ PickingAlphaVSFile,		"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
 			{ PickingAlphaPSFile,		"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
-			{ ShaderWireGizmoVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderWireGizmoPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderSolidGizmoVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderSolidGizmoPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo0VSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo0PSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo1VSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", GLSLShaderSubFolder },
-			{ ShaderIconGizmo1PSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"hlsl", GLSLShaderSubFolder },
+			{ ShaderWireGizmoVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderWireGizmoPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderSolidGizmoVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderSolidGizmoPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderIconGizmo0VSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderIconGizmo0PSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderIconGizmo1VSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderIconGizmo1PSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
 		};
 
 		if (FileSystem::exists(DefaultSkinFolderRaw))

+ 3 - 3
BansheeEditor/Source/BsGizmoManager.cpp

@@ -539,7 +539,7 @@ namespace BansheeEngine
 			Color normalColor, fadedColor;
 			calculateIconColors(iconData.color, *mCamera.get(), iconHeight, iconData.fixedScale, normalColor, fadedColor);
 
-			Vector3 position(sortedIconData.screenPosition.x, sortedIconData.screenPosition.y, sortedIconData.distance);
+			Vector3 position((float)sortedIconData.screenPosition.x, (float)sortedIconData.screenPosition.y, sortedIconData.distance);
 			// TODO - Does the depth need to be corrected since it was taken from a projective camera (probably)?
 
 			float halfWidth = iconWidth * 0.5f;
@@ -602,8 +602,8 @@ namespace BansheeEngine
 		if (width <= OPTIMAL_ICON_SIZE && height <= OPTIMAL_ICON_SIZE)
 			return;
 
-		float relWidth = OPTIMAL_ICON_SIZE / width;
-		float relHeight = OPTIMAL_ICON_SIZE / height;
+		float relWidth = OPTIMAL_ICON_SIZE / (float)width;
+		float relHeight = OPTIMAL_ICON_SIZE / (float)height;
 
 		float scale = std::min(relWidth, relHeight);
 

+ 2 - 3
BansheeEngine/Include/BsDrawHelperTemplate.h

@@ -94,7 +94,7 @@ namespace BansheeEngine
 			assert((vertexOffset + 2) <= meshData->getNumVertices());
 			assert((indexOffset + 2) <= meshData->getNumIndices());
 
-			pixelLine(a, b, color, positionData, vertexOffset, meshData->getVertexDesc()->getVertexStride(), indexData, indexOffset);
+			pixelLine(a, b, positionData, vertexOffset, meshData->getVertexDesc()->getVertexStride(), indexData, indexOffset);
 		}
 
 		/**
@@ -161,7 +161,7 @@ namespace BansheeEngine
 			UINT32 numPoints = (UINT32)linePoints.size();
 			for(UINT32 i = 0; i < numPoints; i += 2)
 			{
-				pixelLine(linePoints[i], linePoints[i + 1], color, positionData, curVertOffset, meshData->getVertexDesc()->getVertexStride(), indexData, curIdxOffset);
+				pixelLine(linePoints[i], linePoints[i + 1], positionData, curVertOffset, meshData->getVertexDesc()->getVertexStride(), indexData, curIdxOffset);
 
 				curVertOffset += 2;
 				curIdxOffset += 2;
@@ -228,7 +228,6 @@ namespace BansheeEngine
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset)
 		{
 			outVertices += (vertexOffset * vertexStride);
-			outColors += (vertexOffset * vertexStride);
 
 			T* vertices = (T*)outVertices;
 			(*vertices) = a;

+ 2 - 2
BansheeEngine/Source/BsCamera.cpp

@@ -588,8 +588,8 @@ namespace BansheeEngine
 	Vector2I Camera::clipToScreenPoint(const Vector2& clipPoint) const
 	{
 		Vector2I screenPoint;
-		screenPoint.x = mViewport->getX() + (clipPoint.x + 1.0f) * mViewport->getWidth() * 0.5f;
-		screenPoint.y = mViewport->getY() + (clipPoint.y + 1.0f) * mViewport->getHeight() * 0.5f;
+		screenPoint.x = Math::roundToInt(mViewport->getX() + (clipPoint.x + 1.0f) * mViewport->getWidth() * 0.5f);
+		screenPoint.y = Math::roundToInt(mViewport->getY() + (clipPoint.y + 1.0f) * mViewport->getHeight() * 0.5f);
 
 		return screenPoint;
 	}

+ 2 - 2
BansheeMono/Include/BsMonoMethod.h

@@ -14,6 +14,8 @@ namespace BansheeEngine
 	class BS_MONO_EXPORT MonoMethod
 	{
 	public:
+		~MonoMethod();
+
 		/**
 		 * @brief	Invokes the method on the provided object instance. 
 		 *			This does not respect polymorphism and will invoke the exact method
@@ -92,12 +94,10 @@ namespace BansheeEngine
 		friend class MonoProperty;
 
 		MonoMethod(::MonoMethod* method);
-		~MonoMethod();
 
 		void cacheSignature() const;
 
 		::MonoMethod* mMethod;
-		void* mThunk;
 
 		mutable MonoClass* mCachedReturnType;
 		mutable MonoClass** mCachedParameters;

+ 3 - 2
BansheeMono/Source/BsMonoClass.cpp

@@ -7,6 +7,7 @@
 #include "BsUtil.h"
 #include "BsException.h"
 #include <mono/metadata/debug-helpers.h>
+#include "BsDebug.h"
 
 namespace BansheeEngine
 {
@@ -195,11 +196,11 @@ namespace BansheeEngine
 		while (curClassMethod != nullptr)
 		{
 			MonoMethodSignature* sig = mono_method_signature(curClassMethod);
-			const char* sigDesc = mono_signature_get_desc(sig, true);
+
+			const char* sigDesc = mono_signature_get_desc(sig, false);
 			const char* methodName = mono_method_get_name(curClassMethod);
 
 			MonoMethod* curMethod = getMethodExact(methodName, sigDesc);
-
 			mCachedMethodList.push_back(curMethod);
 
 			curClassMethod = mono_class_get_methods(mClass, &iter);

+ 2 - 2
BansheeMono/Source/BsMonoMethod.cpp

@@ -9,7 +9,7 @@ namespace BansheeEngine
 		:mMethod(method), mCachedReturnType(nullptr), mCachedParameters(nullptr), 
 		mCachedNumParameters(0), mIsStatic(false), mHasCachedSignature(false)
 	{
-		mThunk = mono_method_get_unmanaged_thunk(mMethod);
+
 	}
 
 	MonoMethod::~MonoMethod()
@@ -40,7 +40,7 @@ namespace BansheeEngine
 
 	void* MonoMethod::getThunk() const
 	{
-		return mThunk;
+		return mono_method_get_unmanaged_thunk(mMethod);
 	}
 
 	String MonoMethod::getName() const

+ 12 - 0
MBansheeEngine/Math/Degree.cs

@@ -124,6 +124,18 @@ namespace BansheeEngine
             return a.value != b.value;
         }
 
+        public override bool Equals(object other)
+        {
+            if (!(other is Degree))
+                return false;
+
+            Degree degree = (Degree)other;
+            if (value.Equals(degree.value))
+                return true;
+
+            return false;
+        }
+
         public override int GetHashCode()
         {
             return value.GetHashCode();

+ 12 - 0
MBansheeEngine/Math/Radian.cs

@@ -124,6 +124,18 @@ namespace BansheeEngine
             return a.value != b.value;
         }
 
+        public override bool Equals(object other)
+        {
+            if (!(other is Radian))
+                return false;
+
+            Radian radian = (Radian)other;
+            if (value.Equals(radian.value))
+                return true;
+
+            return false;
+        }
+
         public override int GetHashCode()
         {
             return value.GetHashCode();

+ 1 - 1
SBansheeEditor/Source/BsScriptEditorPlugin.cpp

@@ -23,6 +23,6 @@ namespace BansheeEngine
 
 	extern "C" BS_SCR_BED_EXPORT void unloadPlugin()
 	{
-		ScriptGizmoManager::shutDown();
+		EditorScriptManager::shutDown();
 	}
 }

+ 8 - 8
SBansheeEditor/Source/BsScriptGizmos.cpp

@@ -20,42 +20,42 @@ namespace BansheeEngine
 		metaData.scriptClass->addInternalCall("Internal_DrawIcon", &ScriptGizmos::internal_DrawIcon);
 	}
 
-	void internal_SetColor(Color color)
+	void ScriptGizmos::internal_SetColor(Color color)
 	{
 		GizmoManager::instance().setColor(color);
 	}
 
-	void internal_SetTransform(Matrix4 transform)
+	void ScriptGizmos::internal_SetTransform(Matrix4 transform)
 	{
 		GizmoManager::instance().setTransform(transform);
 	}
 
-	void internal_DrawCube(Vector3 position, Vector3 extents)
+	void ScriptGizmos::internal_DrawCube(Vector3 position, Vector3 extents)
 	{
 		GizmoManager::instance().drawCube(position, extents);
 	}
 
-	void internal_DrawSphere(Vector3 position, float radius)
+	void ScriptGizmos::internal_DrawSphere(Vector3 position, float radius)
 	{
 		GizmoManager::instance().drawSphere(position, radius);
 	}
 
-	void internal_DrawWireCube(Vector3 position, Vector3 extents)
+	void ScriptGizmos::internal_DrawWireCube(Vector3 position, Vector3 extents)
 	{
 		GizmoManager::instance().drawWireCube(position, extents);
 	}
 
-	void internal_DrawWireSphere(Vector3 position, float radius)
+	void ScriptGizmos::internal_DrawWireSphere(Vector3 position, float radius)
 	{
 		GizmoManager::instance().drawWireSphere(position, radius);
 	}
 
-	void internal_DrawLine(Vector3 start, Vector3 end)
+	void ScriptGizmos::internal_DrawLine(Vector3 start, Vector3 end)
 	{
 		GizmoManager::instance().drawLine(start, end);
 	}
 
-	void internal_DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
+	void ScriptGizmos::internal_DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
 	{
 		GizmoManager::instance().drawFrustum(position, aspect, FOV, near, far);
 	}