|
|
|
|
|
|
outputString.Deindent(); |
|
|
|
outputString.AddShaderChunk("}", false); |
|
|
|
|
|
|
|
visitor.AddShaderChunk(outputString.GetShaderString(0), true); |
|
|
|
visitor.AddShaderChunk(outputString.GetShaderString(0), true, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
public void TestGenerateNodeCodeGeneratesCorrectCode() |
|
|
|
{ |
|
|
|
string expected = string.Format("half {0} = unity_test_half ({1}, {2}, {3});" |
|
|
|
string expected = string.Format("half {0} = unity_test_half ({1}, {2}, {3});{4}" |
|
|
|
, m_InputThree.GetVariableNameForSlot(Vector1Node.OutputSlotId)); |
|
|
|
, m_InputThree.GetVariableNameForSlot(Vector1Node.OutputSlotId) |
|
|
|
, Environment.NewLine); |
|
|
|
Assert.AreEqual(expected, visitor.GetShaderString(0).Trim()); |
|
|
|
Assert.AreEqual(expected, visitor.GetShaderString(0)); |
|
|
|
} |
|
|
|
|
|
|
|
[Test] |
|
|
|
|
|
|
"inline half unity_test_half (half arg1, half arg2, half arg3)\r\n" |
|
|
|
+ "{\r\n" |
|
|
|
+ "\treturn arg1 + arg2 + arg3;\r\n" |
|
|
|
+ "}"; |
|
|
|
"inline half unity_test_half (half arg1, half arg2, half arg3)" + Environment.NewLine |
|
|
|
+ "{" + Environment.NewLine |
|
|
|
+ "\treturn arg1 + arg2 + arg3;" + Environment.NewLine |
|
|
|
+ "}" + Environment.NewLine; |
|
|
|
Assert.AreEqual(expected, visitor.GetShaderString(0).Trim()); |
|
|
|
Assert.AreEqual(expected, visitor.GetShaderString(0)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |