usdrt::UsdRenderVar
Defined in usdrt/scenegraph/usd/usdRender/var.h
-
class UsdRenderVar : public usdrt::UsdTyped
A UsdRenderVar describes a custom data variable for a render to produce. The prim describes the source of the data, which can be a shader output or an LPE (Light Path Expression), and also allows encoding of (generally renderer-specific) parameters that configure the renderer for computing the variable.
For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdRenderTokens. So to set an attribute to the value “rightHanded”, use UsdRenderTokens->rightHanded as the value.
Note
The name of the RenderVar prim drives the name of the data variable that the renderer will produce.
Note
In the future, UsdRender may standardize RenderVar representation for well-known variables under the sourceType
intrinsic
, such as r, g, b, a, z, or id.Public Functions
-
inline explicit UsdRenderVar(const UsdPrim &prim = UsdPrim())
Construct a UsdRenderVar on UsdPrim
prim
. Equivalent to UsdRenderVar::Get(prim.GetStage(), prim.GetPath()) for a validprim
, but will not immediately throw an error for an invalidprim
.
-
inline explicit UsdRenderVar(const UsdSchemaBase &schemaObj)
Construct a UsdRenderVar on the prim held by
schemaObj
. Should be preferred over UsdRenderVar(schemaObj.GetPrim()), as it preserves SchemaBase state.
-
inline virtual ~UsdRenderVar()
Destructor.
-
inline UsdAttribute GetDataTypeAttr() const
The type of this channel, as a USD attribute type.
Declaration
uniform token dataType = "color3f"
C++ Type
Usd Type
SdfValueTypeNames->Token
Variability
SdfVariabilityUniform
-
inline UsdAttribute CreateDataTypeAttr() const
See GetDataTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
inline UsdAttribute GetSourceNameAttr() const
The renderer should look for an output of this name as the computed value for the RenderVar.
Declaration
uniform string sourceName = ""
C++ Type
std::string
Usd Type
SdfValueTypeNames->String
Variability
SdfVariabilityUniform
-
inline UsdAttribute CreateSourceNameAttr() const
See GetSourceNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
inline UsdAttribute GetSourceTypeAttr() const
Indicates the type of the source.
“raw”: The name should be passed directly to the renderer. This is the default behavior.
”primvar”: This source represents the name of a primvar. Some renderers may use this to ensure that the primvar is provided; other renderers may require that a suitable material network be provided, in which case this is simply an advisory setting.
”lpe”: Specifies a Light Path Expression in the OSL Light Path Expressions language as the source for this RenderVar. Some renderers may use extensions to that syntax, which will necessarily be non-portable.
”intrinsic”: This setting is currently unimplemented, but represents a future namespace for UsdRender to provide portable baseline RenderVars, such as camera depth, that may have varying implementations for each renderer.
Declaration
uniform token sourceType = "raw"
C++ Type
Usd Type
SdfValueTypeNames->Token
Variability
SdfVariabilityUniform
Allowed Values
raw, primvar, lpe, intrinsic
-
inline UsdAttribute CreateSourceTypeAttr() const
See GetSourceTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author
defaultValue
as the attribute’s default, sparsely (when it makes sense to do so) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
inline explicit operator bool() const
Check if this schema object is compatible with it’s held prim and that the prim is valid.
A typed schema object is compatible if the held prim’s type is or is a subtype of the schema’s type. Based on
prim.IsA()
.An API schema object is compatible if the API is of type SingleApplyAPI or UsdSchemaType::MultipleApplyAPI, and the schema has been applied to the prim. Based on
prim.HasAPI
.This method invokes polymorphic behaviour.
See also
- Returns
True if the help prim is valid, and the schema object is compatible with its held prim.
Public Static Functions
-
static inline UsdRenderVar Define(const UsdStageRefPtr &stage, const SdfPath &path)
Attempt to ensure a UsdPrim adhering to this schema at
path
is defined (according to UsdPrim::IsDefined()) on this stage.
Public Static Attributes
-
static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped
Compile time constant representing what kind of schema this class is.
See also
Protected Functions
-
inline virtual bool _IsCompatible() const
Helper for subclasses to do specific compatibility checking with the given prim. Subclassess may override
_isCompatible
to for example check type compatibility or value compatibility on the prim.Overrides exist for UsdTyped and UsdAPISchemaBase.
This check is called when clients invoke the bool operator.
- Returns
True if the schema object is compatible with its held prim.
-
inline explicit UsdRenderVar(const UsdPrim &prim = UsdPrim())