A DrawParameters object is a collection of state used by the renderer to render an object. Its purpose is to provide an efficient way to draw large number of objects. They are rendered with GraphicsDevice.drawArray().
A Renderable generates a collection of these that are processed by the renderers, ordering them by pass.
They are created using GraphicsDevice.createDrawParameters().
Summary
Sets an element of the array of TechniqueParameters objects.
These are applied in order when an object is rendered. They are applied after any global techniqueParameters the renderers set for each technique.
Syntax
drawParameters.setTechniqueParameters(index, techniqueParameters);
Summary
Sets an element of the array of VertexBuffers objects.
There should be an equal number of Semantics and VertexBuffers.
Syntax
drawParameters.setVertexBuffer(index, vertexBuffer);
drawParameters.setSemantics(index, semantics);
Summary
Sets an element of the array of Semantics objects.
There should be an equal number of Semantics and VertexBuffers.
Syntax
drawParameters.setVertexBuffer(index, vertexBuffer);
drawParameters.setSemantics(index, semantics);
Summary
Sets an element of the array of offsets. The offsets are the index in the appropriate VertexBuffer that the index calls are relevant to.
These are 0 by default.
Syntax
drawParameters.setVertexBuffer(index, vertexBuffer);
drawParameters.setSemantics(index, semantics);
drawParameters.setOffset(index, offset);
Summary
Gets an element of the array of TechniqueParameters objects.
Syntax
var techniqueParameters = drawParameters.getTechniqueParameters(index);
Returns a TechniqueParameters object, which may be null.
Summary
Gets an element of the array of VertexBuffers objects.
Syntax
var vertexBuffer = drawParameters.getVertexBuffer(index);
Returns a VertexBuffers object, which may be null.
Summary
Gets an element of the array of Semantics objects.
Syntax
var semantics = drawParameters.getSemantics(index);
Returns a Semantics object, which may be null.
Summary
Gets an element of the array of offsets.
Syntax
var offset = drawParameters.getOffset(index);
Returns a number.
Summary
The Technique object to render with.
Syntax
drawParameters.technique = shader.getTechnique(techniqueName);
Summary
The kind of Primitive.
Syntax
drawParameters.primitive = graphicsDevice.PRIMITIVE_TRIANGLES;
Summary
Use for drawing indexed primitives with an IndexBuffer. If this is set then count must also be specified.
See count and firstIndex for non-indexed primitives.
Syntax
drawParameters.indexBuffer = indexBuffer;
drawParameters.numIndices = numIndices;
Summary
If the indexBuffer is set then this is the number of indices to draw.
If the indexBuffer is not set then this is the number of vertices to draw.
Syntax
drawParameters.indexBuffer = indexBuffer;
drawParameters.count = numIndices;
or
drawParameters.count = numVertices;
drawParameters.firstIndex = firstIndex;
Summary
If the indexBuffer is set then this is the offset in the IndexBuffer of the first index to be used.
If the indexBuffer is not set then this is the index in the VertexBuffer of first vertex to use.
It defaults to 0.
Syntax
drawParameters.count = numVertices;
drawParameters.firstIndex = firstIndex;
Summary
A number used to sort arrays of DrawParameters by. Typically for transparent passes this would be distance and for opaque passes a value designed for efficiency, e.g. grouping objects with the same technique together.
It defaults to 0.
Syntax
drawParameters.sortKey = object.distance;
Summary
An object for custom use. When using the JSLib renderers this object has the passIndex attached to it.
Syntax
drawParameters.userData.passIndex = renderer.passIndex.transparent;