Material

Material is a re-usable Asset that provides a structure that will tell the GPU how to draw triangles. It combines two key components that will be passed down to the rendering pipeline. First, a Shader that is the program that the GPU will be execution. Second are the sampler slots; in other words, textures or cube maps that will be set and send along so the GPU can use their content within the Shader program.

The Shader program can also feed to the Material uniform Variable that can be preset manually offline or dynamically modified at runtime.

Materials are the main component to use when you want the GPU to draw or execute (compute shader). They can be used to draw a single primitive (triangle list), post-processing effects or simply to run general computing programs on your graphics processor.

See Also

Static Variables


Name Description
asset Reference to the global Navigation associated to your project where the active Material is stored.
handler Manage scripting functionalities of the active Material.
shader GPU programs that dictates how the Material should draw.
slot_count Current amount of sampler slots the Material contains.
shader Total amount of uniforms Variable that are currently maintained by the Material.

Variables


Name Description
redraw Specify that the Material should execute another pass.

Functions


Name Description
SetShader Assign a Shader to the active Material.
AddSamplerSlot Add a new sampler slot to handle either a Texture or Cubemap.
EnableSamplerSlot Enable or disable an existing sampler slot.
SetTexture Connect an existing Texture to a specific sampler slot.
SetCubemap Connect an existing Cubemap to a specific sampler slot.
GetSampler Retrieve the active Sampler of a specific slot.
GetSamplerSlotIndex Retrieve the slot index used by a specific Sampler.
SetSamplerSlotIndex Move a specific Sampler to another slot index.
RemoveSamplerSlot Remove a specific slot using its index as key.
SwapSamplerSlots Swap the location of two sampler slots.
GetVariable Retrieve an existing Variable connected to the Material using its name as key.
GetVariableAt Retrieve a Variable using its index as key.
GetVariableBool Retrieve the value of an existing boolean Variable.
SetVariableBool Set the value of an existing boolean Variable.
GetVariableInt Retrieve the value of an existing integer Variable.
SetVariableInt Set the value of an existing integer Variable.
GetVariableFloat Retrieve the value of an existing float Variable.
SetVariableFloat Set the value of an existing float Variable.
GetVariableVec2 Retrieve the value of an existing vec2 Variable.
SetVariableVec2 Set the value of an existing vec2 Variable.
GetVariableVec3 Retrieve the value of an existing vec3 Variable.
SetVariableVec3 Set the value of an existing vec3 Variable.
GetVariableVec4 Retrieve the value of an existing vec4 Variable.
SetVariableVec4 Set the value of an existing vec4 Variable.
SyncVariables Re-synchronize the active Material Variable.

Events


Callbacks Description
OnDraw Triggered before the Material is about to send data to the GPU.
OnDisplay Happen right after the Material have sent data to the GPU.




NRG - API 2022.4.384543 - Fri Nov 4 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA