public Binding binding { get ; private set ; }
public bool hidden { get ; private set ; }
public Vector4 ? defaultValue { get ; private set ; }
public ShaderStageCapability stageCapability { get ; private set ; }
public SlotAttribute ( int mSlotId , Binding mImplicitBinding )
public SlotAttribute ( int mSlotId , Binding mImplicitBinding , ShaderStageCapability mStageCapability = ShaderStageCapability . All )
stageCapability = mStageCapability ;
public SlotAttribute ( int mSlotId , Binding mImplicitBinding , bool mHidden )
public SlotAttribute ( int mSlotId , Binding mImplicitBinding , bool mHidden , ShaderStageCapability mStageCapability = ShaderStageCapability . All )
stageCapability = mStageCapability ;
public SlotAttribute ( int mSlotId , Binding mImplicitBinding , float defaultX , float defaultY , float defaultZ , float defaultW )
public SlotAttribute ( int mSlotId , Binding mImplicitBinding , float defaultX , float defaultY , float defaultZ , float defaultW , ShaderStageCapability mStageCapability = ShaderStageCapability . All )
stageCapability = mStageCapability ;
}
}
MaterialSlot s ;
if ( attribute . binding = = Binding . None & & ! par . IsOut & & par . ParameterType = = typeof ( Color ) )
s = new ColorRGBAMaterialSlot ( attribute . slotId , name , par . Name , SlotType . Input , attribute . defaultValue ? ? Vector4 . zero , hidden : attribute . hidden ) ;
s = new ColorRGBAMaterialSlot ( attribute . slotId , name , par . Name , SlotType . Input , attribute . defaultValue ? ? Vector4 . zero , stageCapability : attribute . stageCapability , hidden : attribute . hidden ) ;
s = new ColorRGBAMaterialSlot ( attribute . slotId , name , par . Name , SlotType . Input , attribute . defaultValue ? ? Vector4 . zero , hidden : attribute . hidden ) ;
s = new ColorRGBAMaterialSlot ( attribute . slotId , name , par . Name , SlotType . Input , attribute . defaultValue ? ? Vector4 . zero , stageCapability : attribute . stageCapability , hidden : attribute . hidden ) ;
s = new ColorRGBMaterialSlot ( attribute . slotId , name , par . Name , SlotType . Input , attribute . defaultValue ? ? Vector4 . zero , hidden : attribute . hidden ) ;
s = new ColorRGBMaterialSlot ( attribute . slotId , name , par . Name , SlotType . Input , attribute . defaultValue ? ? Vector4 . zero , stageCapability : attribute . stageCapability , hidden : attribute . hidden ) ;
else if ( attribute . binding = = Binding . None | | par . IsOut )
s = MaterialSlot . CreateMaterialSlot (
ConvertTypeToSlotValueType ( par ) ,
par . IsOut ? SlotType . Output : SlotType . Input ,
attribute . defaultValue ? ? Vector4 . zero ,
shaderStageCapability : attribute . stageCapability ,
s = CreateBoundSlot ( attribute . binding , attribute . slotId , name , par . Name , attribute . hidden ) ;
s = CreateBoundSlot ( attribute . binding , attribute . slotId , name , par . Name , attribute . stageCapability , attribute . hidden ) ;
slots . Add ( s ) ;
m_Slots . Add ( attribute ) ;
RemoveSlotsNameNotMatching ( slots . Select ( x = > x . id ) ) ;
}
private static MaterialSlot CreateBoundSlot ( Binding attributeBinding , int slotId , string displayName , string shaderOutputName , bool hidden )
private static MaterialSlot CreateBoundSlot ( Binding attributeBinding , int slotId , string displayName , string shaderOutputName , ShaderStageCapability shaderStageCapability , bool hidden )
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object , shaderStageCapability ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object , shaderStageCapability ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object , shaderStageCapability ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object , shaderStageCapability ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View , shaderStageCapability ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View , shaderStageCapability ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View , shaderStageCapability ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View , shaderStageCapability ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World , shaderStageCapability ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World , shaderStageCapability ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World , shaderStageCapability ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World , shaderStageCapability ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent ) ;
return new NormalMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent , shaderStageCapability ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent ) ;
return new TangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent , shaderStageCapability ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent ) ;
return new BitangentMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent , shaderStageCapability ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent ) ;
return new PositionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent , shaderStageCapability ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV0 ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV0 , shaderStageCapability ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV1 ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV1 , shaderStageCapability ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV2 ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV2 , shaderStageCapability ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV3 ) ;
return new UVMaterialSlot ( slotId , displayName , shaderOutputName , UVChannel . UV3 , shaderStageCapability ) ;
return new ScreenPositionMaterialSlot ( slotId , displayName , shaderOutputName , ScreenSpaceType . Default ) ;
return new ScreenPositionMaterialSlot ( slotId , displayName , shaderOutputName , ScreenSpaceType . Default , shaderStageCapability ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Object , shaderStageCapability ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . View , shaderStageCapability ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . World , shaderStageCapability ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent ) ;
return new ViewDirectionMaterialSlot ( slotId , displayName , shaderOutputName , CoordinateSpace . Tangent , shaderStageCapability ) ;
return new VertexColorMaterialSlot ( slotId , displayName , shaderOutputName ) ;
return new VertexColorMaterialSlot ( slotId , displayName , shaderOutputName , shaderStageCapability ) ;
default :
throw new ArgumentOutOfRangeException ( "attributeBinding" , attributeBinding , null ) ;
}