List <StageElement> GetElementsForStage(Rendering.ShaderType stageType) { if (stageType == Rendering.ShaderType.Vertex) { return(vertexStageElements); } else if (stageType == Rendering.ShaderType.Fragment) { return(fragmentStageElements); } return(null); }
public void AppendBlockInstance(BlockInstance blockInstance, Rendering.ShaderType stageType) { List <StageElement> stageElements = GetElementsForStage(stageType); if (stageElements == null) { throw new Exception($"Stage {stageType} is not valid."); } stageElements.Add(new StageElement { BlockInstance = blockInstance }); }
public void AppendCustomizationPoint(CustomizationPoint customizationPoint, Rendering.ShaderType stageType) { List <StageElement> stageElements = GetElementsForStage(stageType); if (stageElements == null) { throw new Exception($"Stage {stageType} is not valid."); } // Make sure the customization point hasn't been added multiple times. var element = stageElements.Find((e) => (e.CustomizationPoint == customizationPoint)); if (element != null) { throw new Exception($"Customization point {customizationPoint.Name} cannot be added to a stage multiple times."); } stageElements.Add(new StageElement { CustomizationPoint = customizationPoint }); }