GFX.Drawable¶
Name | - | Description | Default | Type |
---|---|---|---|---|
<input> |
The drawable's transform | [Float4] |
||
<output> |
GFX.Drawable |
|||
Mesh |
The mesh to use for this drawable. | None |
&GFX.Mesh |
|
Material |
The material | None |
&GFX.Material |
|
Params |
Shader parameters for this drawable | None |
{GFX.Texture2D GFX.TextureCube [Float4] Float4 Float3 Float2 Float Int Int2 Int3 Int4 &(GFX.Texture2D GFX.TextureCube [Float4] Float4 Float3 Float2 Float Int Int2 Int3 Int4)} &{GFX.Texture2D GFX.TextureCube [Float4] Float4 Float3 Float2 Float Int Int2 Int3 Int4 &(GFX.Texture2D GFX.TextureCube [Float4] Float4 Float3 Float2 Float Int Int2 Int3 Int4)} |
|
Features |
Features to attach to this drawable | None |
[GFX.Feature] &[GFX.Feature] |
Drawable help text
Details¶
The Drawable shard defines an instance of a drawn object. It usually has a transform (in world space) and a mesh to draw.
Params¶
The Params
parameter contains a table of values that will be passed to the shader when this drawable is rendered.
Info
See GFX.Feature about where shader parameters are defined and used.
Constant/Dynamic¶
Shader parameters and the drawable transform can be set as either constant parameters or dynamic ones.
Constant parameters¶
Constant parameters are passed through the input table. They are read and stay the same until this function is called again.
{:Mesh .mesh :Transform .transform} (GFX.Drawable) >= .my-drawable
Dynamic parameters¶
Dynamic parameters are passed as parameters to the shard. You can set the same fields as you can when setting constant parameters, with the exception of the mesh. The variables are referenced by the Drawable
so that changes in their value will be reflect in the rendered result.
.. >= .dynamic-color
.. >= .dynamic-transform
{:Mesh .mesh} (Drawable :Transform .dynamic-transform :Params {:baseColor .dynamic-color}) >= .my-drawable
Intended usage¶
To avoid re-creating Drawables for objects with minor or no changes, you should set up Drawables from within a Setup block and pass their dynamic parameters to the shard.
; Only done once
(Setup
... = .const-transform
(Float4 1.0) >= .dynamic-color
{:Mesh .mesh :Transform .const-transform} (Drawable :Params {:baseColor .dynamic-color}) >= .my-drawable)
; Update color every time this wire runs
... > .dynamic-color