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); }