Procházet zdrojové kódy

Bugfix: Selection rendering shader is functional once again

BearishSun před 8 roky
rodič
revize
cd721b6019

binární
Data/Editor/Includes/SelectionBase.bslinc.asset


binární
Data/Editor/Shaders/Selection.bsl.asset


+ 24 - 36
Data/Raw/Editor/Includes/SelectionBase.bslinc

@@ -1,12 +1,21 @@
-mixin SelectionBase
+mixin 
+#ifdef USE_BLEND_SHAPES
+	#ifdef USE_SKELETON
+		SelectionSkinnedMorph
+	#else
+		SelectionMorph
+	#endif
+#else
+	#ifdef USE_SKELETON
+		SelectionSkinned
+	#else
+		Selection
+	#endif
+#endif
 {
 	raster
 	{
 		fill = wire;
-	};
-	
-	depth
-	{
 		bias = 0.00001f;
 	};
 	
@@ -19,37 +28,6 @@ mixin SelectionBase
 		};
 	};
 	
-	code
-	{
-		cbuffer FragParams
-		{	
-			float4 selColor;
-		};
-
-		float4 fsmain(in float4 inPos : SV_Position) : SV_Target
-		{
-			return selColor;
-		}
-	};
-};
-
-mixin 
-#ifdef USE_BLEND_SHAPES
-	#ifdef USE_SKELETON
-		SelectionSkinnedMorph
-	#else
-		SelectionMorph
-	#endif
-#else
-	#ifdef USE_SKELETON
-		SelectionSkinned
-	#else
-		Selection
-	#endif
-#endif
-{
-	mixin SelectionBase;
-
 	code
 	{
 		struct VertexInput
@@ -110,5 +88,15 @@ mixin
 
 			oPosition = mul(matWorldViewProj, position);
 		}
+		
+		cbuffer FragParams
+		{	
+			float4 selColor;
+		};
+
+		float4 fsmain(in float4 inPos : SV_Position) : SV_Target
+		{
+			return selColor;
+		}		
 	};
 };

+ 3 - 3
Source/BansheeSL/BsParserFX.y

@@ -321,6 +321,9 @@ raster_option
 	| TOKEN_SCISSOR '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_Scissor; $$.value.intValue = $3; }
 	| TOKEN_MULTISAMPLE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_Multisample; $$.value.intValue = $3; }
 	| TOKEN_AALINE '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_AALine; $$.value.intValue = $3; }
+	| TOKEN_DEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_DepthBias; $$.value.floatValue = $3; }
+	| TOKEN_SDEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_SDepthBias; $$.value.floatValue = $3; }
+	| TOKEN_DEPTHCLIP '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthClip; $$.value.intValue = $3; }	
 	;	
 	
 	/* Depth state */
@@ -345,9 +348,6 @@ depth_option
 	: TOKEN_DEPTHREAD '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthRead; $$.value.intValue = $3; }
 	| TOKEN_DEPTHWRITE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_DepthWrite; $$.value.intValue = $3; }
 	| TOKEN_COMPAREFUNC '=' TOKEN_COMPFUNCVALUE ';'				{ $$.type = OT_CompareFunc; $$.value.intValue = $3; }
-	| TOKEN_DEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_DepthBias; $$.value.floatValue = $3; }
-	| TOKEN_SDEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_SDepthBias; $$.value.floatValue = $3; }
-	| TOKEN_DEPTHCLIP '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthClip; $$.value.intValue = $3; }
 	;
 	
 	/* Stencil state */

+ 3 - 0
Source/SBansheeEngine/BsScriptResourceManager.cpp

@@ -44,6 +44,9 @@ namespace bs
 		_throwExceptionIfInvalidOrDuplicate(uuid);
 #endif
 
+		if (!resource.isLoaded(false))
+			return nullptr;
+
 		UINT32 rttiId = resource->getRTTI()->getRTTIId();
 		BuiltinResourceInfo* info = ScriptAssemblyManager::instance().getBuiltinResourceInfo(rttiId);