Created
October 30, 2017 20:38
-
-
Save xiaobin83/5a5f8a05064ee2944f26c6b2bff81be4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur Code/_Evaluator/SF_Evaluator.cs Code2/_Evaluator/SF_Evaluator.cs | |
--- Code/_Evaluator/SF_Evaluator.cs 2017-08-15 23:26:41.583391800 +0800 | |
+++ Code2/_Evaluator/SF_Evaluator.cs 2017-10-31 04:13:19.991503000 +0800 | |
@@ -343,6 +343,10 @@ | |
dependencies.NeedFragVertexColor(); // TODO: Check if it really needs to be frag | |
} | |
+ if( n is SFN_Vertex ) { | |
+ dependencies.NeedFragVertex(); | |
+ } | |
+ | |
if( n is SFN_DDX || n is SFN_DDY ) { | |
dependencies.pragmaGlsl = true; | |
} | |
@@ -2164,15 +2168,18 @@ | |
if( dependencies.vert_in_tangents ) | |
App( "float4 tangent : TANGENT;" ); | |
if( dependencies.uv0 ) | |
- App( GetUvCompCountString( 0 ) + " texcoord0 : TEXCOORD0;" ); | |
+ App( GetUvCompCountString( 0 ) + " texcoord0" + GetVertOutTexcoord() );// : TEXCOORD0;" ); | |
if( dependencies.uv1 ) | |
- App( GetUvCompCountString( 1 ) + " texcoord1 : TEXCOORD1;" ); | |
+ App( GetUvCompCountString( 1 ) + " texcoord1" + GetVertOutTexcoord() );// : TEXCOORD1;" ); | |
if( dependencies.uv2 ) | |
- App( GetUvCompCountString( 2 ) + " texcoord2 : TEXCOORD2;" ); | |
+ App( GetUvCompCountString( 2 ) + " texcoord2" + GetVertOutTexcoord() );// : TEXCOORD2;" ); | |
if( dependencies.uv3 ) | |
- App( GetUvCompCountString( 3 ) + " texcoord3 : TEXCOORD3;" ); | |
+ App( GetUvCompCountString( 3 ) + " texcoord3" + GetVertOutTexcoord() );// : TEXCOORD3;" ); | |
+ if( dependencies.vert_in_vertex) | |
+ App( "float4 vertexLocal" + GetVertOutTexcoord() );// : TEXCOORD3;" ); | |
if( dependencies.vert_in_vertexColor ) | |
App( "float4 vertexColor : COLOR;" ); | |
+ ResetVertOutTexcoord(); | |
} | |
void TransferCommonData() { | |
@@ -2205,7 +2212,9 @@ | |
App( "o.vertexColor = v.vertexColor;" ); | |
} | |
- | |
+ public void ResetVertOutTexcoord() { | |
+ dependencies.ResetTexcoordNumbers(); | |
+ } | |
public string GetVertOutTexcoord( bool numberOnly = false ) { | |
if( numberOnly ) | |
return dependencies.GetVertOutTexcoord(); | |
@@ -2235,6 +2244,8 @@ | |
App( GetUvCompCountString( 2 ) + " uv2" + GetVertOutTexcoord() ); | |
if( dependencies.uv3_frag ) | |
App( GetUvCompCountString( 3 ) + " uv3" + GetVertOutTexcoord() ); | |
+ if( dependencies.vert_out_vertex ) | |
+ App( "float4 vertexLocal" + GetVertOutTexcoord() ); | |
if( dependencies.vert_out_worldPos ) | |
App( "float4 posWorld" + GetVertOutTexcoord() ); | |
if( dependencies.vert_out_normals ) | |
@@ -2318,6 +2329,8 @@ | |
App( "o.uv2 = v.texcoord2;" ); | |
if( dependencies.uv3_frag ) | |
App( "o.uv3 = v.texcoord3;" ); | |
+ if( dependencies.vert_out_vertex ) | |
+ App( "o.vertexLocal = v.vertex;" ); | |
if( dependencies.vert_out_vertexColor ) | |
App( "o.vertexColor = v.vertexColor;" ); | |
diff -ur Code/SF_Dependencies.cs Code2/SF_Dependencies.cs | |
--- Code/SF_Dependencies.cs 2017-08-21 22:53:15.831422200 +0800 | |
+++ Code2/SF_Dependencies.cs 2017-10-31 03:45:03.281351800 +0800 | |
@@ -45,6 +45,8 @@ | |
public bool vert_in_tangents = false; | |
public bool vert_in_vertexColor = false; | |
public bool vert_out_vertexColor = false; | |
+ public bool vert_in_vertex = false; | |
+ public bool vert_out_vertex = false; | |
public bool frag_viewReflection = false; | |
public bool frag_viewDirection = false; | |
public bool frag_normalDirection = false; | |
@@ -133,6 +135,12 @@ | |
vert_out_vertexColor = true; | |
} | |
+ public void NeedFragVertex() | |
+ { | |
+ vert_in_vertex = true; | |
+ vert_out_vertex = true; | |
+ } | |
+ | |
public void NeedFragObjPos() { | |
frag_objectPos = true; | |
} | |
diff -ur Code/SF_Editor.cs Code2/SF_Editor.cs | |
--- Code/SF_Editor.cs 2017-08-21 20:28:25.555673800 +0800 | |
+++ Code2/SF_Editor.cs 2017-10-31 03:40:59.046617500 +0800 | |
@@ -277,6 +277,7 @@ | |
AddTemplate( typeof( SFN_ScreenPos ), catGeoData + "Screen Position" ); | |
AddTemplate( typeof( SFN_Tangent ), catGeoData + "Tangent Dir." ); | |
AddTemplate( typeof( SFN_TexCoord ), catGeoData + "UV Coordinates", KeyCode.U ); | |
+ AddTemplate( typeof( SFN_Vertex ), catGeoData + "Vertex" ); | |
AddTemplate( typeof( SFN_VertexColor ), catGeoData + "Vertex Color", KeyCode.V ); | |
AddTemplate( typeof( SFN_ViewVector ), catGeoData + "View Dir." ); | |
AddTemplate( typeof( SFN_ViewReflectionVector ), catGeoData + "View Refl. Dir.", KeyCode.None, "View Reflection" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment