public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode) { if (!generationMode.IsPreview()) { return; } var matOwner = owner as AbstractMaterialNode; if (matOwner == null) { throw new Exception(string.Format("Slot {0} either has no owner, or the owner is not a {1}", this, typeof(AbstractMaterialNode))); } AbstractShaderProperty property; switch (concreteValueType) { case ConcreteSlotValueType.Vector4: property = new Vector4ShaderProperty(); break; case ConcreteSlotValueType.Vector3: property = new Vector3ShaderProperty(); break; case ConcreteSlotValueType.Vector2: property = new Vector2ShaderProperty(); break; case ConcreteSlotValueType.Vector1: property = new Vector1ShaderProperty(); break; default: // This shouldn't happen due to edge validation. The generated shader will // have errors. Debug.LogError($"Invalid value type {concreteValueType} passed to Vector Slot {displayName}. Value will be ignored, please plug in an edge with a vector type."); return; } property.overrideReferenceName = matOwner.GetVariableNameForSlot(id); property.generatePropertyBlock = false; properties.AddShaderProperty(property); }
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode) { if (!generationMode.IsPreview()) { return; } var matOwner = owner as AbstractMaterialNode; if (matOwner == null) { throw new Exception(string.Format("Slot {0} either has no owner, or the owner is not a {1}", this, typeof(AbstractMaterialNode))); } AbstractShaderProperty property; switch (concreteValueType) { case ConcreteSlotValueType.Vector4: property = new Vector4ShaderProperty(); break; case ConcreteSlotValueType.Vector3: property = new Vector3ShaderProperty(); break; case ConcreteSlotValueType.Vector2: property = new Vector2ShaderProperty(); break; case ConcreteSlotValueType.Vector1: property = new Vector1ShaderProperty(); break; default: throw new ArgumentOutOfRangeException(); } property.overrideReferenceName = matOwner.GetVariableNameForSlot(id); property.generatePropertyBlock = false; properties.AddShaderProperty(property); }
public override void AddDefaultProperty(PropertyCollector properties, GenerationMode generationMode) { if (!generationMode.IsPreview()) { return; } var matOwner = owner as AbstractMaterialNode; if (matOwner == null) { throw new Exception(string.Format("Slot {0} either has no owner, or the owner is not a {1}", this, typeof(AbstractMaterialNode))); } var property = new Vector2ShaderProperty { overrideReferenceName = matOwner.GetVariableNameForSlot(id), generatePropertyBlock = false, value = value }; properties.AddShaderProperty(property); }