public void AdaptNodeOutput1To1Works ( )
{
var node = new TestNode ( ) ;
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V1Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V1Out , ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( TestNode . V1Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V1Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "({0})" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V1Out , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "({0})" , node . GetVariableNameForSlot ( TestNode . V1Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V1Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( string . Format ( "({0})" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V1Out , ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( string . Format ( "({0})" , node . GetVariableNameForSlot ( TestNode . V1Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V1Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slo t, ConcreteSlotValueType . Vector4 ) ;
Assert . AreEqual ( string . Format ( "({0})" , node . GetVariableNameForSlot ( slo t) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V1Ou t, ConcreteSlotValueType . Vector4 ) ;
Assert . AreEqual ( string . Format ( "({0})" , node . GetVariableNameForSlot ( TestNode . V1Ou t) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V2Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slo t, ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "({0}).x" , node . GetVariableNameForSlot ( slo t) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V2Ou t, ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "({0}).x" , node . GetVariableNameForSlot ( TestNode . V2Ou t) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V2Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V2Out , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( TestNode . V2Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V2Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector3 ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V2Out , ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( "ERROR!" , result ) ;
}
var node = new TestNode ( ) ;
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V2Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector4 ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V2Out , ConcreteSlotValueType . Vector4 ) ;
Assert . AreEqual ( "ERROR!" , result ) ;
}
var node = new TestNode ( ) ;
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V3Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "({0}).x" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V3Out , ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "({0}).x" , node . GetVariableNameForSlot ( TestNode . V3Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V3Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "({0}.xy)" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V3Out , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "({0}.xy)" , node . GetVariableNameForSlot ( TestNode . V3Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V3Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V3Out , ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( TestNode . V3Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V3Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector4 ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V3Out , ConcreteSlotValueType . Vector4 ) ;
Assert . AreEqual ( "ERROR!" , result ) ;
}
var node = new TestNode ( ) ;
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V4Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "({0}).x" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V4Out , ConcreteSlotValueType . Vector1 ) ;
Assert . AreEqual ( string . Format ( "({0}).x" , node . GetVariableNameForSlot ( TestNode . V4Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V4Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "({0}.xy)" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V4Out , ConcreteSlotValueType . Vector2 ) ;
Assert . AreEqual ( string . Format ( "({0}.xy)" , node . GetVariableNameForSlot ( TestNode . V4Out ) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V4Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slo t, ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( string . Format ( "({0}.xyz)" , node . GetVariableNameForSlot ( slo t) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V4Ou t, ConcreteSlotValueType . Vector3 ) ;
Assert . AreEqual ( string . Format ( "({0}.xyz)" , node . GetVariableNameForSlot ( TestNode . V4Ou t) ) , result ) ;
}
[Test]
var slot = node . FindOutputSlot < MaterialSlot > ( TestNode . V4Out ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , slot , ConcreteSlotValueType . Vector4 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( slot ) ) , result ) ;
var result = ShaderGenerator . AdaptNodeOutput ( node , TestNode . V4Out , ConcreteSlotValueType . Vector4 ) ;
Assert . AreEqual ( string . Format ( "{0}" , node . GetVariableNameForSlot ( TestNode . V4Out ) ) , result ) ;
}