Rendered attribute buffers. More...
Public Member Functions | |
ShaderAttributes (Primitive pMode, int count) | |
RenderBuffers constructor. | |
ShaderAttributes (Primitive pMode) | |
RenderBuffers constructor. | |
BufferObject | GetAttribute (string binding) |
Get a shader attribute. | |
void | InterleaveAttributes () |
void | PackAttributes () |
override void | Render (RenderContext ctx, ShaderProgram sProgram) |
Render vertices attributes. | |
void | ResetAttribute (string binding) |
Remove a shader attribute. | |
void | ResetAttributes () |
Remove all shader attributes. | |
void | SetAttribute (string binding, BufferObject attr) |
Set a shader attribute. | |
void | SetIndices (ElementBufferObject< uint > ibo, int offset) |
Setup attribute indices. | |
void | SetIndices (ElementBufferObject< uint > ibo) |
Setup attribute indices. | |
void | SetIndicesRestart (bool enable, uint index) |
Setup an element index used for restarting primitive rendering. | |
Properties | |
override IEnumerable< string > | Bindings [get] |
Current attributes bindings. | |
Primitive | DrawMode [get, set] |
Attributes drawing mode. | |
ElementBufferObject< uint > | Indices [get] |
Element indices attribute. | |
int | Instances [get, set] |
Generated primitive instances. | |
int | ItemsCount [get, set] |
Buffer attributes count. |
Rendered attribute buffers.
This class is dedicated to supply data to ShaderProgram instances, and execute ShaderProgram instances based on the input set.
Derm.Render.ShaderAttributes.ShaderAttributes | ( | Primitive | pMode | ) |
RenderBuffers constructor.
pMode | A Primitive indicating vertices attributes layout, and the resulting primitive from rendering. |
By default, the vertices count is 0, and the offset is 0.
Derm.Render.ShaderAttributes.ShaderAttributes | ( | Primitive | pMode, | |
int | count | |||
) |
RenderBuffers constructor.
pMode | A Primitive indicating vertices attributes layout, and the resulting primitive from rendering. | |
count | A System.Int32 indicating the number of vertices attributes used in rendering. |
By default, the offset is 0.
BufferObject Derm.Render.ShaderAttributes.GetAttribute | ( | string | binding | ) |
Get a shader attribute.
binding |
void Derm.Render.ShaderAttributes.InterleaveAttributes | ( | ) |
void Derm.Render.ShaderAttributes.PackAttributes | ( | ) |
override void Derm.Render.ShaderAttributes.Render | ( | RenderContext | ctx, | |
ShaderProgram | sProgram | |||
) | [virtual] |
Render vertices attributes.
ctx | A RenderContext used for rendering. |
This routine draw active vertices attribute with the currently bound shader program. The number of vertices drawn is set by RenderBuffers.ItemsCount, and the resulting primitive is set by RenderBuffers.DrawMode.
Optionally vertices attribute can be specified using an indices buffer, which redirects attributes using an additional index. The indices are taken to the currently bound ElementBufferObject<uint>, only if the property RenderBuffers.WithIndices is true.
Optionally the drawing command can be instanced more times, by setting the property RenderBuffers.Instances a value greater than zero. Each drawing command instance will have set an incremental value of the shader built-in variable gl_instanceID.
Optionally an offset could be applied when drawing vertex attributes. To reduce memory fragmentation caused by usage of many (and relatively small) buffer objects, implementations could choose to "pack" multiple buffer objects (having a common state) into a single (larger) buffer object; when rendering, drawing commands could specify the offset to access to vertex attributes. In the case drawing is executed using indices, the offset is applied to indices during rendering, without altering the original indices buffer contents.
Implements Derm.Render.BaseShaderAttributes.
void Derm.Render.ShaderAttributes.ResetAttribute | ( | string | binding | ) |
Remove a shader attribute.
binding |
void Derm.Render.ShaderAttributes.ResetAttributes | ( | ) |
Remove all shader attributes.
void Derm.Render.ShaderAttributes.SetAttribute | ( | string | binding, | |
BufferObject | attr | |||
) |
Set a shader attribute.
attr | A BufferObject holding the attribute data. |
Uses attr for defining attribute named
binding | . |
void Derm.Render.ShaderAttributes.SetIndices | ( | ElementBufferObject< uint > | ibo, | |
int | offset | |||
) |
Setup attribute indices.
ibo | An ElementBufferObject<uint> used for rendering. | |
offset | An System.Int32 used as offset for accessing to the indices buffer object. |
void Derm.Render.ShaderAttributes.SetIndices | ( | ElementBufferObject< uint > | ibo | ) |
Setup attribute indices.
ibo | An ElementBufferObject<uint> used for rendering. |
void Derm.Render.ShaderAttributes.SetIndicesRestart | ( | bool | enable, | |
uint | index | |||
) |
Setup an element index used for restarting primitive rendering.
enable | A System.Boolean indicating whether primitive restarting is enabled or not. | |
index | A System.UInt32 indicating the element index value used for restarting a primitive. Usually this value is set to 0xFFFFFFFF, but it can be any arbitrary value. |
override IEnumerable<string> Derm.Render.ShaderAttributes.Bindings [get] |
Current attributes bindings.
Reimplemented from Derm.Render.BaseShaderAttributes.
Primitive Derm.Render.ShaderAttributes.DrawMode [get, set, protected] |
Attributes drawing mode.
ElementBufferObject<uint> Derm.Render.ShaderAttributes.Indices [get] |
Element indices attribute.
int Derm.Render.ShaderAttributes.Instances [get, set, protected] |
Generated primitive instances.
int Derm.Render.ShaderAttributes.ItemsCount [get, set, protected] |
Buffer attributes count.
This property specify how many vertex attributes are executed on a shader program. If this property is 0, no attributes are executed. It cannot be negative.