4 using System.Collections.Generic;
6 using SiliconStudio.Core;
7 using SiliconStudio.Paradox.Graphics;
9 namespace SiliconStudio.
Paradox.Effects
37 if (renderModel == null)
throw new ArgumentNullException(
"renderModel");
38 if (mesh == null)
throw new ArgumentNullException(
"mesh");
47 public bool Enabled {
get; set; }
55 var currentPass = context.CurrentPass;
56 var currentRenderData = this.Mesh.Draw;
67 var modelComponent = this.RenderModel.ModelInstance;
68 var hasMaterialParams = this.Mesh.Material != null && this.Mesh.Material.Parameters != null;
69 var hasModelComponentParams = modelComponent != null && modelComponent.Parameters != null;
70 if (hasMaterialParams)
72 if (hasModelComponentParams)
73 this.Effect.Apply(currentPass.Parameters, this.Mesh.Material.Parameters, modelComponent.Parameters, this.Mesh.Parameters,
true);
75 this.Effect.Apply(currentPass.Parameters, this.Mesh.Material.Parameters, this.Mesh.Parameters,
true);
77 else if (hasModelComponentParams)
78 this.Effect.Apply(currentPass.Parameters, modelComponent.Parameters, this.Mesh.Parameters,
true);
80 this.Effect.Apply(currentPass.Parameters, this.Mesh.Parameters,
true);
85 if (currentRenderData != null)
87 var graphicsDevice = context.GraphicsDevice;
89 graphicsDevice.SetVertexArrayObject(vertexArrayObject);
91 if (currentRenderData.IndexBuffer == null)
105 Utilities.Dispose(ref vertexArrayObject);
106 vertexArrayObject = VertexArrayObject.New(device, Effect.InputSignature, Mesh.Draw.IndexBuffer, Mesh.Draw.VertexBuffers);
113 parameterCollections.Add(Mesh.Material.Parameters);
116 var modelInstance = RenderModel.ModelInstance;
117 if (modelInstance != null && modelInstance.Parameters != null)
119 parameterCollections.Add(modelInstance.Parameters);
124 parameterCollections.Add(Mesh.Parameters);
A dynamic effect instance updated by DynamicEffectCompiler.
ParameterCollection Parameters
override void FillParameterCollections(IList< ParameterCollection > parameterCollections)
Fills the parameter collections used by this instance.
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
void Draw(RenderContext context)
Draw this effect mesh.
readonly RenderModel RenderModel
The model instance associated to this effect mesh.
RenderMesh(RenderModel renderModel, Mesh mesh)
Initializes a new instance of the RenderMesh class.
Thread-local storage context used during rendering.
Instantiation of a Model through a RenderPipeline.
SiliconStudio.Paradox.Graphics.PrimitiveType PrimitiveType
readonly Mesh Mesh
The mesh associated with this instance.