Loading...
Searching...
No Matches
distanceHeuristic.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef USDLOD_GENERATED_DISTANCEHEURISTIC_H
8#define USDLOD_GENERATED_DISTANCEHEURISTIC_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdLod/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
18
21
22
23#include "pxr/base/vt/value.h"
24
25#include "pxr/base/gf/vec3d.h"
26#include "pxr/base/gf/vec3f.h"
28
29#include "pxr/base/tf/token.h"
30#include "pxr/base/tf/type.h"
31
32PXR_NAMESPACE_OPEN_SCOPE
33
34class SdfAssetPath;
35
36// -------------------------------------------------------------------------- //
37// LODDISTANCEHEURISTIC //
38// -------------------------------------------------------------------------- //
39
62{
63public:
68
73 explicit UsdLodDistanceHeuristic(const UsdPrim& prim=UsdPrim())
74 : UsdLodHeuristic(prim)
75 {
76 }
77
81 explicit UsdLodDistanceHeuristic(const UsdSchemaBase& schemaObj)
82 : UsdLodHeuristic(schemaObj)
83 {
84 }
85
87 USDLOD_API
89
93 USDLOD_API
94 static const TfTokenVector &
95 GetSchemaAttributeNames(bool includeInherited=true);
96
106 USDLOD_API
108 Get(const UsdStagePtr &stage, const SdfPath &path);
109
132 USDLOD_API
134 Define(const UsdStagePtr &stage, const SdfPath &path);
135
136protected:
140 USDLOD_API
142
143private:
144 // needs to invoke _GetStaticTfType.
145 friend class UsdSchemaRegistry;
146 USDLOD_API
147 static const TfType &_GetStaticTfType();
148
149 static bool _IsTypedSchema();
150
151 // override SchemaBase virtuals.
152 USDLOD_API
153 const TfType &_GetTfType() const override;
154
155public:
156 // --------------------------------------------------------------------- //
157 // CENTER
158 // --------------------------------------------------------------------- //
170 USDLOD_API
172
178 USDLOD_API
179 UsdAttribute CreateCenterAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
180
181public:
182 // --------------------------------------------------------------------- //
183 // THRESHOLDS
184 // --------------------------------------------------------------------- //
201 USDLOD_API
203
209 USDLOD_API
210 UsdAttribute CreateThresholdsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
211
212public:
213 // --------------------------------------------------------------------- //
214 // BLENDTHRESHOLDS
215 // --------------------------------------------------------------------- //
249 USDLOD_API
251
257 USDLOD_API
258 UsdAttribute CreateBlendThresholdsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
259
260public:
261 // --------------------------------------------------------------------- //
262 // BOUNDINGVOLUME
263 // --------------------------------------------------------------------- //
270 USDLOD_API
272
275 USDLOD_API
277
278public:
279 // ===================================================================== //
280 // Feel free to add custom code below this line, it will be preserved by
281 // the code generator.
282 //
283 // Just remember to:
284 // - Close the class declaration with };
285 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
286 // - Close the include guard with #endif
287 // ===================================================================== //
288 // --(BEGIN CUSTOM CODE)--
289
295 USDLOD_API
297 UsdTimeCode time = UsdTimeCode::Default()) const;
298
310 USDLOD_API
312 const GfVec3d& viewpoint,
313 const GfMatrix4d& transform,
314 UsdTimeCode time = UsdTimeCode::Default()) const
315 {
317 .ComputeDistance(viewpoint, transform);
318 }
319
337 USDLOD_API
339 const GfVec3d& viewpoint,
340 const GfMatrix4d& transform,
341 double prevDistance,
342 double hysteresis,
343 UsdTimeCode time = UsdTimeCode::Default()) const
344 {
346 .ComputeDistance(viewpoint, transform, prevDistance, hysteresis);
347 }
348
378 USDLOD_API
380 double distance,
381 UsdTimeCode time = UsdTimeCode::Default()) const
382 {
384 .ComputeLOD(distance);
385 }
386
392 USDLOD_API
394 const GfVec3d& viewpoint,
395 const GfMatrix4d& transform,
396 UsdTimeCode time = UsdTimeCode::Default()) const
397 {
399 .ComputeLOD(viewpoint, transform);
400 }
401
403
415 USDLOD_API
417 const GfVec3d& viewpoint,
418 const GfMatrix4d& transform,
419 double prevDistance,
420 double hysteresis,
421 double* distanceOut,
422 UsdTimeCode time = UsdTimeCode::Default()) const
423 {
425 .ComputeLOD(viewpoint, transform, prevDistance, hysteresis,
426 distanceOut);
427 }
428};
429
430PXR_NAMESPACE_CLOSE_SCOPE
431
432#endif
Stores a 4x4 matrix of double elements.
Definition matrix4d.h:71
Basic type for a vector of 3 double components.
Definition vec3d.h:46
Contains an asset path and optional evaluated and resolved paths.
Definition assetPath.h:79
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
TfType represents a dynamic runtime type.
Definition type.h:48
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition attribute.h:183
This LOD heuristic selects LOD children on the basis of distance from the view point to the LOD root.
UsdLodDistanceHeuristic(const UsdSchemaBase &schemaObj)
Construct a UsdLodDistanceHeuristic on the prim held by schemaObj .
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.
virtual USDLOD_API ~UsdLodDistanceHeuristic()
Destructor.
USDLOD_API UsdAttribute GetThresholdsAttr() const
This defines the distance thresholds for LOD transitions in ascending order.
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 o...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
USDLOD_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDLOD_API UsdRelationship GetBoundingVolumeRel() const
Optional relationship to a Boundable prim that defines the bounding volume for this LOD Root,...
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 UsdRelationship CreateBoundingVolumeRel() const
See GetBoundingVolumeRel(), and also Create vs Get Property Methods for when to use Get vs Create.
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 o...
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::IsDefin...
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 cl...
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, 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 o...
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 UsdAttribute GetCenterAttr() const
The center point of this LOD Root in local coordinates.
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.
UsdLodDistanceHeuristic(const UsdPrim &prim=UsdPrim())
Construct a UsdLodDistanceHeuristic on UsdPrim prim .
USDLOD_API UsdLodDistanceHeuristicQuery CreateDistanceHeuristicQuery(UsdTimeCode time=UsdTimeCode::Default()) const
Return a UsdLodDistanceHeuristicQuery that matches the current attribute values of this UsdLodDistanc...
USDLOD_API double ComputeDistance(const GfVec3d &viewpoint, const GfMatrix4d &transform, UsdTimeCode time=UsdTimeCode::Default()) const
Calculate a distance given a viewpoint and a transform.
This class implements the internals of an LOD distance heuristic, but without any dependencies on USD...
USDLOD_API double ComputeDistance(const GfVec3d &viewpoint, const GfMatrix4d &transform) const
Compute a distance given a viewpoint and a transform.
USDLOD_API float ComputeLOD(double distance) const
Compute an LOD index given a distance.
Base class for LOD Heuristics.
Definition heuristic.h:53
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition prim.h:117
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
The base class for all schema types in Usd.
Definition schemaBase.h:39
Singleton registry that provides access to schema type information and the prim definitions for regis...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition timeCode.h:72
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition timeCode.h:113
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition value.h:90
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition common.h:112
@ ConcreteTyped
Represents a concrete typed schema.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition token.h:440