public void RebuildAllSlots(bool inspectProperty) { List <int> usedSlots = new List <int>(); AddSlot(new UVMaterialSlot(UVInputId, UVInputName, UVInputName, UVChannel.UV0)); usedSlots.Add(UVInputId); AddSlot(new VirtualTextureInputMaterialSlot(VirtualTextureInputId, VirtualTextureInputName, VirtualTextureInputName)); usedSlots.Add(VirtualTextureInputId); // at this point we can't tell how many output slots we will have (because we can't find the VT property yet) // so, we create all of the possible output slots, so any edges created will connect properly // then we can trim down the set of slots later.. UpdateLayerOutputSlots(inspectProperty, usedSlots); // Create slots if (m_LodCalculation == LodCalculation.VtLevel_Lod) { var slot = new Vector1MaterialSlot(LODInputId, LODSlotName, LODSlotName, SlotType.Input, 0.0f, ShaderStageCapability.All, LODSlotName); AddSlot(slot); usedSlots.Add(LODInputId); } if (m_LodCalculation == LodCalculation.VtLevel_Bias) { var slot = new Vector1MaterialSlot(BiasInputId, BiasSlotName, BiasSlotName, SlotType.Input, 0.0f, ShaderStageCapability.Fragment, BiasSlotName); AddSlot(slot); usedSlots.Add(BiasInputId); } if (m_LodCalculation == LodCalculation.VtLevel_Derivatives) { var slot1 = new Vector2MaterialSlot(DxInputId, DxSlotName, DxSlotName, SlotType.Input, Vector2.one, ShaderStageCapability.All, DxSlotName); var slot2 = new Vector2MaterialSlot(DyInputId, DySlotName, DySlotName, SlotType.Input, Vector2.one, ShaderStageCapability.All, DySlotName); AddSlot(slot1); AddSlot(slot2); usedSlots.Add(DxInputId); usedSlots.Add(DyInputId); } RemoveSlotsNameNotMatching(usedSlots, true); }
public MaterialSlot CreateVectorSlot(int dimension, int id, string name, SlotType slotType, Vector4 value = default) { MaterialSlot slot = null; switch (dimension) { case 1: slot = new Vector1MaterialSlot(id, name, name, slotType, value.x); break; case 2: slot = new Vector2MaterialSlot(id, name, name, slotType, value); break; case 3: slot = new Vector3MaterialSlot(id, name, name, slotType, value); break; case 4: slot = new Vector4MaterialSlot(id, name, name, slotType, value); break; } return(slot); }