FnUsdAbstractionLib 0.6.0
|
#include <ShaderDesc.h>
Public Member Functions | |
ShaderDescGroup (const std::string &_target_renderer=std::string()) | |
size_t | size () const |
void | reserve (size_t n) |
bool | addShaderDesc (ShaderDesc *shader) |
bool | addShaderDesc (ShaderDesc *shader, const std::string &prim_name) |
void | setOutput (ShaderDesc *shader) |
Assign the primary output shader (sub type doesn't matter - ie surface, volume, light, etc) | |
void | setDisplacementOutput (ShaderDesc *shader) |
void | deleteShaders () |
ShaderDesc * | getShaderNode (const std::string &shader_node_name) const |
Return the shader matching the name, or null if not in group. | |
fdk::Hash | getTopologyHash () |
Computes and returns the topology hash for the shader group. | |
Public Attributes | |
std::string | target_renderer |
If not empty (ie universalRenderContext) the shaders are associated with a named renderer. | |
std::string | material_base_name |
Base name for the material (may not be the final MaterialPrim name) | |
Path | material_prim_path |
Prim path of MaterialPrim owner. | |
ShaderDescPtrMap | shaders |
Map of ShaderDesc pointers keyed by shader material-relative names. | |
ShaderDesc * | output |
The output shader for the group. | |
ShaderDesc * | displacement_output |
The output displacement shader for the group (may be the same as surface output) | |
fdk::Hash | topology_hash |
Does the shader graph need to be rebuilt? | |
fdk::Hash | property_hash |
Do the shaders need parameter updating? | |
A list of ShaderDesc pointers usually organized into a shader graph. The group's output shader(s) are also noted as well as the name (if any) of a renderer to target.
Added ShaderDesc allocations are owned by this class and deleted in the destructor.
bool usg::ShaderDescGroup::addShaderDesc | ( | ShaderDesc * | shader | ) |
Add a ShaderDesc to the group, taking ownership of the allocation.
Important - this requires that the ShaderDesc already have a unique name assigned as getMaterialRelativeName() is called on the ShaderDesc to map the storage of the pointer. If the name is not assigned or is not unique then the ShaderDesc will NOT be added to the group and false returned.
The ShaderDesc pointer will be deleted when the group is destroyed.
Returns true is ShaderDesc was added to group.
bool usg::ShaderDescGroup::addShaderDesc | ( | ShaderDesc * | shader, |
const std::string & | prim_name | ||
) |
Add a ShaderDesc to the group, taking ownership of the allocation and setting the shader's name at the same time. If the name is empty or is not unique then the ShaderDesc will NOT be added to the group and false returned.
The ShaderDesc pointer will be deleted when the group is destroyed.
Returns true is ShaderDesc was added to group.
|
inline |
Assign the primary displacement output shader.
void usg::ShaderDescGroup::deleteShaders | ( | ) |
Delete the ShaderDesc pointers and empty the group. Leaves the material_prim_path and target_renderer intact.
©2025 The Foundry Visionmongers, Ltd. All Rights Reserved. |