public void CreateNodes(AbstractMaterialNode node, ShaderStageCapability newCapabilities, int rgbaSlot, int rSlot, int gSlot, int bSlot, int aSlot) { capabilities = newCapabilities; rgbaOutput = rgbaSlot; rOutput = rSlot; gOutput = gSlot; bOutput = bSlot; aOutput = aSlot; rgba = node.AddSlot(new Vector4MaterialSlot(rgbaOutput, kRGBAName, kRGBAName, SlotType.Output, Vector4.zero, capabilities)); r = node.AddSlot(new Vector1MaterialSlot(rOutput, kRName, kRName, SlotType.Output, 0.0f, capabilities)); g = node.AddSlot(new Vector1MaterialSlot(gOutput, kGName, kGName, SlotType.Output, 0.0f, capabilities)); b = node.AddSlot(new Vector1MaterialSlot(bOutput, kBName, kBName, SlotType.Output, 0.0f, capabilities)); a = node.AddSlot(new Vector1MaterialSlot(aOutput, kAName, kAName, SlotType.Output, 0.0f, capabilities)); }
public static Mip2DSamplingInputs CreateMip2DSamplingInputs( AbstractMaterialNode node, Texture2DMipSamplingMode mode, Mip2DSamplingInputs previousInputs, int biasInputId, int lodInputId, int ddxInputId, int ddyInputId) { if (previousInputs.bias != null) { node.RemoveSlot(previousInputs.bias.id); } if (previousInputs.lod != null) { node.RemoveSlot(previousInputs.lod.id); } if (previousInputs.ddx != null) { node.RemoveSlot(previousInputs.ddx.id); } if (previousInputs.ddy != null) { node.RemoveSlot(previousInputs.ddy.id); } Mip2DSamplingInputs inputs = Mip2DSamplingInputs.NewDefault(); inputs.biasInput = biasInputId; inputs.lodInput = lodInputId; inputs.ddxInput = ddxInputId; inputs.ddyInput = ddyInputId; switch (mode) { case Texture2DMipSamplingMode.LOD: inputs.lod = node.AddSlot(new Vector1MaterialSlot(lodInputId, kLodName, kLodName, SlotType.Input, 0.0f)); break; case Texture2DMipSamplingMode.Bias: inputs.bias = node.AddSlot(new Vector1MaterialSlot(biasInputId, kBiasName, kBiasName, SlotType.Input, 0.0f)); break; case Texture2DMipSamplingMode.Gradient: inputs.ddx = node.AddSlot(new Vector2MaterialSlot(ddxInputId, kDdxName, kDdxName, SlotType.Input, new Vector2(0.0f, 0.0f))); inputs.ddy = node.AddSlot(new Vector2MaterialSlot(ddyInputId, kDdyName, kDdyName, SlotType.Input, new Vector2(0.0f, 0.0f))); break; } return(inputs); }
public static Mip3DSamplingInputs CreateMip3DSamplingInputs( AbstractMaterialNode node, Texture3DMipSamplingMode mode, Mip3DSamplingInputs previousInputs, int lodInputId) { if (previousInputs.lod != null) { node.RemoveSlot(previousInputs.lod.id); } Mip3DSamplingInputs inputs = Mip3DSamplingInputs.NewDefault(); inputs.lodInput = lodInputId; switch (mode) { case Texture3DMipSamplingMode.LOD: inputs.lod = node.AddSlot(new Vector1MaterialSlot(lodInputId, kLodName, kLodName, SlotType.Input, 0.0f)); break; } return(inputs); }