Loading...
Searching...
No Matches
screenSizeHeuristic.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_SCREENSIZEHEURISTIC_H
8#define USDLOD_GENERATED_SCREENSIZEHEURISTIC_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// LODSCREENSIZEHEURISTIC //
38// -------------------------------------------------------------------------- //
39
67{
68public:
73
79 : UsdLodHeuristic(prim)
80 {
81 }
82
86 explicit UsdLodScreenSizeHeuristic(const UsdSchemaBase& schemaObj)
87 : UsdLodHeuristic(schemaObj)
88 {
89 }
90
92 USDLOD_API
94
98 USDLOD_API
99 static const TfTokenVector &
100 GetSchemaAttributeNames(bool includeInherited=true);
101
111 USDLOD_API
113 Get(const UsdStagePtr &stage, const SdfPath &path);
114
137 USDLOD_API
139 Define(const UsdStagePtr &stage, const SdfPath &path);
140
141protected:
145 USDLOD_API
147
148private:
149 // needs to invoke _GetStaticTfType.
150 friend class UsdSchemaRegistry;
151 USDLOD_API
152 static const TfType &_GetStaticTfType();
153
154 static bool _IsTypedSchema();
155
156 // override SchemaBase virtuals.
157 USDLOD_API
158 const TfType &_GetTfType() const override;
159
160public:
161 // --------------------------------------------------------------------- //
162 // EXTENT
163 // --------------------------------------------------------------------- //
176 USDLOD_API
178
184 USDLOD_API
185 UsdAttribute CreateExtentAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
186
187public:
188 // --------------------------------------------------------------------- //
189 // PROJECTIONMETHOD
190 // --------------------------------------------------------------------- //
204 USDLOD_API
206
212 USDLOD_API
213 UsdAttribute CreateProjectionMethodAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
214
215public:
216 // --------------------------------------------------------------------- //
217 // THRESHOLDS
218 // --------------------------------------------------------------------- //
237 USDLOD_API
239
245 USDLOD_API
246 UsdAttribute CreateThresholdsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
247
248public:
249 // --------------------------------------------------------------------- //
250 // BLENDTHRESHOLDS
251 // --------------------------------------------------------------------- //
280 USDLOD_API
282
288 USDLOD_API
289 UsdAttribute CreateBlendThresholdsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
290
291public:
292 // --------------------------------------------------------------------- //
293 // BOUNDINGVOLUME
294 // --------------------------------------------------------------------- //
300 USDLOD_API
302
305 USDLOD_API
307
308public:
309 // ===================================================================== //
310 // Feel free to add custom code below this line, it will be preserved by
311 // the code generator.
312 //
313 // Just remember to:
314 // - Close the class declaration with };
315 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
316 // - Close the include guard with #endif
317 // ===================================================================== //
318 // --(BEGIN CUSTOM CODE)--
319
326 USDLOD_API
328 UsdTimeCode time = UsdTimeCode::Default()) const;
329
347 USDLOD_API
349 const GfFrustum& frustum,
350 const GfMatrix4d& transform,
351 UsdTimeCode time = UsdTimeCode::Default()) const
352 {
354 .ComputeScreenSize(frustum, transform);
355 }
356
367 USDLOD_API
369 const GfFrustum& frustum,
370 const GfMatrix4d& transform,
371 double prevSize,
372 double hysteresis,
373 UsdTimeCode time = UsdTimeCode::Default()) const
374 {
376 .ComputeScreenSize(frustum, transform, prevSize, hysteresis);
377 }
378
406 USDLOD_API
408 double size,
409 UsdTimeCode time = UsdTimeCode::Default()) const
410 {
412 .ComputeLOD(size);
413 }
414
419 USDLOD_API
421 const GfFrustum& frustum,
422 const GfMatrix4d& transform,
423 UsdTimeCode time = UsdTimeCode::Default()) const
424 {
426 .ComputeLOD(frustum, transform);
427 }
428
442 USDLOD_API
444 const GfFrustum& frustum,
445 const GfMatrix4d& transform,
446 double prevSize,
447 double hysteresis,
448 double* screenSizeOut,
449 UsdTimeCode time = UsdTimeCode::Default()) const
450 {
452 .ComputeLOD(frustum, transform, prevSize, hysteresis,
453 screenSizeOut);
454 }
455
456};
457
458PXR_NAMESPACE_CLOSE_SCOPE
459
460#endif
Basic type: View frustum.
Definition frustum.h:71
Stores a 4x4 matrix of double elements.
Definition matrix4d.h:71
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
Base class for LOD Heuristics.
Definition heuristic.h:53
This LOD heuristic selects LOD children on the basis of the fraction of the viewplane would be covere...
UsdLodScreenSizeHeuristic(const UsdSchemaBase &schemaObj)
Construct a UsdLodScreenSizeHeuristic 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.
static USDLOD_API UsdLodScreenSizeHeuristic Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdLodScreenSizeHeuristic holding the prim adhering to this schema at path on stage.
USDLOD_API UsdAttribute GetThresholdsAttr() const
The screen size thresholds for LOD transitions in descending order as a fraction of the viewport size...
virtual USDLOD_API ~UsdLodScreenSizeHeuristic()
Destructor.
USDLOD_API float ComputeLOD(const GfFrustum &frustum, 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 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 CreateProjectionMethodAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetProjectionMethodAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USDLOD_API UsdLodScreenSizeHeuristic Define(const UsdStagePtr &stage, const SdfPath &path)
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefin...
USDLOD_API UsdRelationship CreateBoundingVolumeRel() const
See GetBoundingVolumeRel(), and also Create vs Get Property Methods for when to use Get vs Create.
USDLOD_API double ComputeScreenSize(const GfFrustum &frustum, const GfMatrix4d &transform, double prevSize, double hysteresis, UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDLOD_API float ComputeLOD(const GfFrustum &frustum, const GfMatrix4d &transform, double prevSize, double hysteresis, double *screenSizeOut, UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDLOD_API UsdAttribute GetProjectionMethodAttr() const
Defines how screen size is calculated.
USDLOD_API UsdLodScreenSizeHeuristicQuery CreateScreenSizeHeuristicQuery(UsdTimeCode time=UsdTimeCode::Default()) const
Return a UsdLodScreenSizeHeuristicQuery that matches the current attribute values of this UsdLodScree...
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 UsdAttribute GetBlendThresholdsAttr() const
This defines screen size thresholds for LOD transitions in descending 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.
UsdLodScreenSizeHeuristic(const UsdPrim &prim=UsdPrim())
Construct a UsdLodScreenSizeHeuristic on UsdPrim prim .
USDLOD_API UsdAttribute CreateExtentAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetExtentAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDLOD_API UsdAttribute GetExtentAttr() const
The extent of this LOD Root in local coordinates.
USDLOD_API double ComputeScreenSize(const GfFrustum &frustum, const GfMatrix4d &transform, UsdTimeCode time=UsdTimeCode::Default()) const
Calculate the screen size given a frustum and a transform.
USDLOD_API float ComputeLOD(double size, UsdTimeCode time=UsdTimeCode::Default()) const
Calculate an LOD index given a screen size.
This class implements the internals of an LOD screenSize heuristic, but without any dependencies on U...
USDLOD_API float ComputeLOD(double size) const
Calculate an LOD index given a screen size.
USDLOD_API double ComputeScreenSize(const GfFrustum &frustum, const GfMatrix4d &transform) const
Calculate the screen size given a frustum and a transform.
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