![]() |
|
This LOD heuristic selects LOD children on the basis of distance from the view point to the LOD root. More...
#include <distanceHeuristic.h>
Inheritance diagram for UsdLodDistanceHeuristic:Public Member Functions | |
| UsdLodDistanceHeuristic (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdLodDistanceHeuristic on UsdPrim prim . | |
| UsdLodDistanceHeuristic (const UsdSchemaBase &schemaObj) | |
Construct a UsdLodDistanceHeuristic on the prim held by schemaObj . | |
| virtual USDLOD_API | ~UsdLodDistanceHeuristic () |
| Destructor. | |
| USDLOD_API UsdAttribute | GetCenterAttr () const |
| The center point of this LOD Root in local coordinates. | |
| USDLOD_API UsdAttribute | CreateCenterAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
| See GetCenterAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
| USDLOD_API UsdAttribute | GetThresholdsAttr () const |
| This defines the distance thresholds for LOD transitions in ascending order. | |
| USDLOD_API UsdAttribute | CreateThresholdsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
| See GetThresholdsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
| USDLOD_API UsdAttribute | GetBlendThresholdsAttr () const |
| This defines distance thresholds for LOD transitions in ascending order. | |
| USDLOD_API UsdAttribute | CreateBlendThresholdsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
| See GetBlendThresholdsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
| USDLOD_API UsdRelationship | GetBoundingVolumeRel () const |
| Optional relationship to a Boundable prim that defines the bounding volume for this LOD Root, the prim's extent will be used for distance calculation if it is valid (not empty). | |
| USDLOD_API UsdRelationship | CreateBoundingVolumeRel () const |
| See GetBoundingVolumeRel(), and also Create vs Get Property Methods for when to use Get vs Create. | |
| USDLOD_API UsdLodDistanceHeuristicQuery | CreateDistanceHeuristicQuery (UsdTimeCode time=UsdTimeCode::Default()) const |
| Return a UsdLodDistanceHeuristicQuery that matches the current attribute values of this UsdLodDistanceHeuristic. | |
| USDLOD_API double | ComputeDistance (const GfVec3d &viewpoint, const GfMatrix4d &transform, UsdTimeCode time=UsdTimeCode::Default()) const |
Calculate a distance given a viewpoint and a transform. | |
| USDLOD_API double | ComputeDistance (const GfVec3d &viewpoint, const GfMatrix4d &transform, double prevDistance, double hysteresis, UsdTimeCode time=UsdTimeCode::Default()) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calculate a distance given a viewpoint and a transform with hysteresis. | |
| USDLOD_API float | ComputeLOD (double distance, UsdTimeCode time=UsdTimeCode::Default()) const |
Calculate an LOD index given a distance. | |
| USDLOD_API float | ComputeLOD (const GfVec3d &viewpoint, const GfMatrix4d &transform, UsdTimeCode time=UsdTimeCode::Default()) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Compute an LOD index given a viewpoint and a transform. | |
| USDLOD_API float | ComputeLOD (const GfVec3d &viewpoint, const GfMatrix4d &transform, double prevDistance, double hysteresis, double *distanceOut, UsdTimeCode time=UsdTimeCode::Default()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Public Member Functions inherited from UsdLodHeuristic | |
| UsdLodHeuristic (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdLodHeuristic on UsdPrim prim . | |
| UsdLodHeuristic (const UsdSchemaBase &schemaObj) | |
Construct a UsdLodHeuristic on the prim held by schemaObj . | |
| virtual USDLOD_API | ~UsdLodHeuristic () |
| Destructor. | |
| USDLOD_API UsdAttribute | GetLodDomainAttr () const |
| The "domain" of this heuristic. | |
| USDLOD_API UsdAttribute | CreateLodDomainAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const |
| See GetLodDomainAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | |
Public Member Functions inherited from UsdTyped | |
| UsdTyped (const UsdPrim &prim=UsdPrim()) | |
Construct a UsdTyped on UsdPrim prim . | |
| UsdTyped (const UsdSchemaBase &schemaObj) | |
Construct a UsdTyped on the prim held by schemaObj . | |
| virtual USD_API | ~UsdTyped () |
| Destructor. | |
Public Member Functions inherited from UsdSchemaBase | |
| bool | IsConcrete () const |
| Returns whether or not this class corresponds to a concrete instantiable prim type in scene description. | |
| bool | IsTyped () const |
| Returns whether or not this class inherits from UsdTyped. | |
| bool | IsAPISchema () const |
| Returns whether this is an API schema or not. | |
| bool | IsAppliedAPISchema () const |
| Returns whether this is an applied API schema or not. | |
| bool | IsMultipleApplyAPISchema () const |
| Returns whether this is an applied API schema or not. | |
| UsdSchemaKind | GetSchemaKind () const |
| Returns the kind of schema this class is. | |
| USD_API | UsdSchemaBase (const UsdPrim &prim=UsdPrim()) |
Construct and store prim as the held prim. | |
| USD_API | UsdSchemaBase (const UsdSchemaBase &otherSchema) |
Construct and store for the same prim held by otherSchema. | |
| virtual USD_API | ~UsdSchemaBase () |
| Destructor. | |
| UsdPrim | GetPrim () const |
| Return this schema object's held prim. | |
| SdfPath | GetPath () const |
| Shorthand for GetPrim()->GetPath(). | |
| USD_API const UsdPrimDefinition * | GetSchemaClassPrimDefinition () const |
| Return the prim definition associated with this schema instance if one exists, otherwise return null. | |
| USD_API | operator bool () const |
| Return true if this schema object is compatible with its held prim, false otherwise. | |
Static Public Member Functions | |
| static USDLOD_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
| Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. | |
| static USDLOD_API UsdLodDistanceHeuristic | Get (const UsdStagePtr &stage, const SdfPath &path) |
Return a UsdLodDistanceHeuristic holding the prim adhering to this schema at path on stage. | |
| static USDLOD_API UsdLodDistanceHeuristic | Define (const UsdStagePtr &stage, const SdfPath &path) |
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined()) on this stage. | |
Static Public Member Functions inherited from UsdLodHeuristic | |
| static USDLOD_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
| Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. | |
| static USDLOD_API UsdLodHeuristic | Get (const UsdStagePtr &stage, const SdfPath &path) |
Return a UsdLodHeuristic holding the prim adhering to this schema at path on stage. | |
Static Public Member Functions inherited from UsdTyped | |
| static USD_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
| Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. | |
| static USD_API UsdTyped | Get (const UsdStagePtr &stage, const SdfPath &path) |
Return a UsdTyped holding the prim adhering to this schema at path on stage. | |
Static Public Member Functions inherited from UsdSchemaBase | |
| static const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Attributes | |
| static const UsdSchemaKind | schemaKind = UsdSchemaKind::ConcreteTyped |
| Compile time constant representing what kind of schema this class is. | |
Static Public Attributes inherited from UsdLodHeuristic | |
| static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractTyped |
| Compile time constant representing what kind of schema this class is. | |
Static Public Attributes inherited from UsdTyped | |
| static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
| Compile time constant representing what kind of schema this class is. | |
Static Public Attributes inherited from UsdSchemaBase | |
| static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
| Compile time constant representing what kind of schema this class is. | |
Protected Member Functions | |
| USDLOD_API UsdSchemaKind | _GetSchemaKind () const override |
| Returns the kind of schema this class belongs to. | |
Protected Member Functions inherited from UsdLodHeuristic | |
| USDLOD_API UsdSchemaKind | _GetSchemaKind () const override |
| Returns the kind of schema this class belongs to. | |
Protected Member Functions inherited from UsdTyped | |
| USD_API UsdSchemaKind | _GetSchemaKind () const override |
| Returns the kind of schema this class belongs to. | |
| USD_API bool | _IsCompatible () const override |
| Subclasses may override _IsCompatible to do specific compatibility checking with the given prim, such as type compatibility or value compatibility. | |
Protected Member Functions inherited from UsdSchemaBase | |
| virtual UsdSchemaKind | _GetSchemaType () const |
| const TfType & | _GetType () const |
| USD_API UsdAttribute | _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const |
Friends | |
| class | UsdSchemaRegistry |
This LOD heuristic selects LOD children on the basis of distance from the view point to the LOD root.
The LOD child selected is determined by the comparing the computed distance with the values in thresholds and blendThresholds. Providing values in blendThresholds can allow the renderer to blend between different LOD children which can be useful to avoid flickering between two LODs. Alternatively, hysteresis can be employed to avoid changing the LOD when the distance changes by a small amount.
The center and boundingVolume properties describe geometric information for the Root prim that informs the distance calculation. If boundingVolume is authored and has a valid extent, the distance to the nearest point on the extent box is used; otherwise the distance to the center is used. Both center and boundingVolume coordinates are assumed to be in the local coordinate system of the LOD root. (Note that this heuristic prim may have a completely different coordinate system than that of the root.)
Definition at line 61 of file distanceHeuristic.h.
|
inlineexplicit |
Construct a UsdLodDistanceHeuristic on UsdPrim prim .
Equivalent to UsdLodDistanceHeuristic::Get(prim.GetStage(), prim.GetPath()) for a valid prim, but will not immediately throw an error for an invalid prim
Definition at line 73 of file distanceHeuristic.h.
|
inlineexplicit |
Construct a UsdLodDistanceHeuristic on the prim held by schemaObj .
Should be preferred over UsdLodDistanceHeuristic(schemaObj.GetPrim()), as it preserves SchemaBase state.
Definition at line 81 of file distanceHeuristic.h.
|
virtual |
Destructor.
|
overrideprotectedvirtual |
Returns the kind of schema this class belongs to.
Reimplemented from UsdSchemaBase.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calculate a distance given a viewpoint and a transform with hysteresis.
The arguments prevDistance and hysteresis should contain the most recently calculated distance and a hysteresis threshold respectively. If the actual distance is within hysteresis distance of prevDistance then prevDistance is returned. If the actual distance is outside the hysteresis window then the returned value lags behind the actual value by hysteresis. Specifically, if the actual distance is greater than prevDistance + hysteresis then the calculated distance - hysteresis is returned and if it is less than prevDistance - hysteresis then the calculated distance + hysteresis is returned. This helps prevent flickering between LOD levels when the computed size is very close to a threshold value.
Definition at line 338 of file distanceHeuristic.h.
|
inline |
Calculate a distance given a viewpoint and a transform.
The matrix transform should convert from the root's local coordinate space to viewpoint's coordinate space. Typically, viewpoint will be specified in world coordinates and transform will convert from the root's object coordinates to world coordinates.
If transform is close to singular then any extent is ignored and the distance is calculated from viewpoint to center.
Definition at line 311 of file distanceHeuristic.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Compute an LOD index given a viewpoint, a transform, a prevDistance, and a hysteresis value.
Compute the distance given the input arguments, then compute the LOD index from that distance. The computed distance is stored in the double pointed to by distanceOut.
The computed distance will be stored in distanceOut so it can be used in the next call to ComputeLOD with hysteresis.
Definition at line 416 of file distanceHeuristic.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Compute an LOD index given a viewpoint and a transform.
Compute the distance given viewpoint and transform, then compute the LOD index from that distance.
Definition at line 393 of file distanceHeuristic.h.
|
inline |
Calculate an LOD index given a distance.
Compare the distance against the values in thresholds to determine an LOD index. If blendThresholds has values and distance is between a thresholds value and its corresponding blendThresholds value, then the returned value will be non-integral. If the renderer can blend between 2 LOD item children then it should use the returned index as follows:
If blendThresholds is not set then only integer valued results will ever be returned.
Definition at line 379 of file distanceHeuristic.h.
| USDLOD_API UsdAttribute CreateBlendThresholdsAttr | ( | VtValue const & | defaultValue = VtValue(), |
| bool | writeSparsely = false ) const |
See GetBlendThresholdsAttr(), 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) if writeSparsely is true - the default for writeSparsely is false.
| USDLOD_API UsdRelationship CreateBoundingVolumeRel | ( | ) | const |
See GetBoundingVolumeRel(), and also Create vs Get Property Methods for when to use Get vs Create.
| USDLOD_API UsdAttribute CreateCenterAttr | ( | VtValue const & | defaultValue = VtValue(), |
| bool | writeSparsely = false ) const |
See GetCenterAttr(), 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) if writeSparsely is true - the default for writeSparsely is false.
| USDLOD_API UsdLodDistanceHeuristicQuery CreateDistanceHeuristicQuery | ( | UsdTimeCode | time = UsdTimeCode::Default() | ) | const |
Return a UsdLodDistanceHeuristicQuery that matches the current attribute values of this UsdLodDistanceHeuristic.
The UsdLodDistanceHeuristicQuery can be used to perform LOD calculations in a renderer without referencing back to the original USD data.
| USDLOD_API UsdAttribute CreateThresholdsAttr | ( | VtValue const & | defaultValue = VtValue(), |
| bool | writeSparsely = false ) const |
See GetThresholdsAttr(), 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) if writeSparsely is true - the default for writeSparsely is false.
|
static |
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined()) on this stage.
If a prim adhering to this schema at path is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema's prim type name for the prim at path at the current EditTarget. Author SdfPrimSpec s with specifier == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors.
The given path must be an absolute prim path that does not contain any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget's namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget.
|
static |
Return a UsdLodDistanceHeuristic holding the prim adhering to this schema at path on stage.
If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:
| USDLOD_API UsdAttribute GetBlendThresholdsAttr | ( | ) | const |
This defines distance thresholds for LOD transitions in ascending order.
If the blend threshold values are defined, then the calculation can return a result between two levels of detail that can be used to blend or combine multiple LOD items.
For example if:
then:
The blend amount should be computed linearly between the corresponding thresholds and blendThresholds values. See thresholds for additional information. Note that blendThresholds values are clamped internally to the current and next thresholds values, ensuring that blending never occurs between more than 2 LOD children. Missing blendThresholds values result in no blending, just a discontinuous jump from one LOD child to the next.
| Declaration | uniform float[] blendThresholds = [] |
| C++ Type | VtArray<float> |
| Usd Type | SdfValueTypeNames->FloatArray |
| Variability | SdfVariabilityUniform |
| USDLOD_API UsdRelationship GetBoundingVolumeRel | ( | ) | const |
Optional relationship to a Boundable prim that defines the bounding volume for this LOD Root, the prim's extent will be used for distance calculation if it is valid (not empty).
The distance will be calculated from the viewpoint to the nearest point on the extent box.
| USDLOD_API UsdAttribute GetCenterAttr | ( | ) | const |
|
static |
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended methods of the schemas involved.
| USDLOD_API UsdAttribute GetThresholdsAttr | ( | ) | const |
This defines the distance thresholds for LOD transitions in ascending order.
For example, [10.0, 50.0, 100.0] means:
| Declaration | uniform float[] thresholds = [] |
| C++ Type | VtArray<float> |
| Usd Type | SdfValueTypeNames->FloatArray |
| Variability | SdfVariabilityUniform |
|
friend |
Definition at line 145 of file distanceHeuristic.h.
|
static |
Compile time constant representing what kind of schema this class is.
Definition at line 67 of file distanceHeuristic.h.