mesh.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 USDGEOM_GENERATED_MESH_H
8 #define USDGEOM_GENERATED_MESH_H
9 
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdGeom/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "pxr/usd/usdGeom/tokens.h"
18 
19 #include "pxr/usd/usd/timeCode.h"
20 
21 #include "pxr/base/vt/value.h"
22 
23 #include "pxr/base/gf/vec3d.h"
24 #include "pxr/base/gf/vec3f.h"
25 #include "pxr/base/gf/matrix4d.h"
26 
27 #include "pxr/base/tf/token.h"
28 #include "pxr/base/tf/type.h"
29 
30 PXR_NAMESPACE_OPEN_SCOPE
31 
32 class SdfAssetPath;
33 
34 // -------------------------------------------------------------------------- //
35 // MESH //
36 // -------------------------------------------------------------------------- //
37 
117 {
118 public:
123 
128  explicit UsdGeomMesh(const UsdPrim& prim=UsdPrim())
129  : UsdGeomPointBased(prim)
130  {
131  }
132 
136  explicit UsdGeomMesh(const UsdSchemaBase& schemaObj)
137  : UsdGeomPointBased(schemaObj)
138  {
139  }
140 
142  USDGEOM_API
143  virtual ~UsdGeomMesh();
144 
148  USDGEOM_API
149  static const TfTokenVector &
150  GetSchemaAttributeNames(bool includeInherited=true);
151 
161  USDGEOM_API
162  static UsdGeomMesh
163  Get(const UsdStagePtr &stage, const SdfPath &path);
164 
187  USDGEOM_API
188  static UsdGeomMesh
189  Define(const UsdStagePtr &stage, const SdfPath &path);
190 
191 protected:
195  USDGEOM_API
196  UsdSchemaKind _GetSchemaKind() const override;
197 
198 private:
199  // needs to invoke _GetStaticTfType.
200  friend class UsdSchemaRegistry;
201  USDGEOM_API
202  static const TfType &_GetStaticTfType();
203 
204  static bool _IsTypedSchema();
205 
206  // override SchemaBase virtuals.
207  USDGEOM_API
208  const TfType &_GetTfType() const override;
209 
210 public:
211  // --------------------------------------------------------------------- //
212  // FACEVERTEXINDICES
213  // --------------------------------------------------------------------- //
223  USDGEOM_API
225 
231  USDGEOM_API
232  UsdAttribute CreateFaceVertexIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
233 
234 public:
235  // --------------------------------------------------------------------- //
236  // FACEVERTEXCOUNTS
237  // --------------------------------------------------------------------- //
249  USDGEOM_API
251 
257  USDGEOM_API
258  UsdAttribute CreateFaceVertexCountsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
259 
260 public:
261  // --------------------------------------------------------------------- //
262  // SUBDIVISIONSCHEME
263  // --------------------------------------------------------------------- //
290  USDGEOM_API
292 
298  USDGEOM_API
299  UsdAttribute CreateSubdivisionSchemeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
300 
301 public:
302  // --------------------------------------------------------------------- //
303  // INTERPOLATEBOUNDARY
304  // --------------------------------------------------------------------- //
326  USDGEOM_API
328 
334  USDGEOM_API
335  UsdAttribute CreateInterpolateBoundaryAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
336 
337 public:
338  // --------------------------------------------------------------------- //
339  // FACEVARYINGLINEARINTERPOLATION
340  // --------------------------------------------------------------------- //
370  USDGEOM_API
372 
378  USDGEOM_API
379  UsdAttribute CreateFaceVaryingLinearInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
380 
381 public:
382  // --------------------------------------------------------------------- //
383  // TRIANGLESUBDIVISIONRULE
384  // --------------------------------------------------------------------- //
398  USDGEOM_API
400 
406  USDGEOM_API
407  UsdAttribute CreateTriangleSubdivisionRuleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
408 
409 public:
410  // --------------------------------------------------------------------- //
411  // HOLEINDICES
412  // --------------------------------------------------------------------- //
422  USDGEOM_API
424 
430  USDGEOM_API
431  UsdAttribute CreateHoleIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
432 
433 public:
434  // --------------------------------------------------------------------- //
435  // CORNERINDICES
436  // --------------------------------------------------------------------- //
446  USDGEOM_API
448 
454  USDGEOM_API
455  UsdAttribute CreateCornerIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
456 
457 public:
458  // --------------------------------------------------------------------- //
459  // CORNERSHARPNESSES
460  // --------------------------------------------------------------------- //
471  USDGEOM_API
473 
479  USDGEOM_API
480  UsdAttribute CreateCornerSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
481 
482 public:
483  // --------------------------------------------------------------------- //
484  // CREASEINDICES
485  // --------------------------------------------------------------------- //
495  USDGEOM_API
497 
503  USDGEOM_API
504  UsdAttribute CreateCreaseIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
505 
506 public:
507  // --------------------------------------------------------------------- //
508  // CREASELENGTHS
509  // --------------------------------------------------------------------- //
522  USDGEOM_API
524 
530  USDGEOM_API
531  UsdAttribute CreateCreaseLengthsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
532 
533 public:
534  // --------------------------------------------------------------------- //
535  // CREASESHARPNESSES
536  // --------------------------------------------------------------------- //
552  USDGEOM_API
554 
560  USDGEOM_API
561  UsdAttribute CreateCreaseSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
562 
563 public:
564  // ===================================================================== //
565  // Feel free to add custom code below this line, it will be preserved by
566  // the code generator.
567  //
568  // Just remember to:
569  // - Close the class declaration with };
570  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
571  // - Close the include guard with #endif
572  // ===================================================================== //
573  // --(BEGIN CUSTOM CODE)--
574 
582  USDGEOM_API
583  static bool ValidateTopology(const VtIntArray& faceVertexIndices,
584  const VtIntArray& faceVertexCounts,
585  size_t numPoints,
586  std::string* reason=nullptr);
587 
588 public:
589 
595  USDGEOM_API
596  static bool IsSharpnessInfinite(const float sharpness);
597 
601  USDGEOM_API
602  static const float SHARPNESS_INFINITE;
603 
609  USDGEOM_API
610  size_t GetFaceCount(UsdTimeCode timeCode = UsdTimeCode::Default()) const;
611 
612 };
613 
614 PXR_NAMESPACE_CLOSE_SCOPE
615 
616 #endif
static USDGEOM_API UsdGeomMesh Define(const UsdStagePtr &stage, const SdfPath &path)
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefin...
USDGEOM_API UsdAttribute CreateFaceVaryingLinearInterpolationAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetFaceVaryingLinearInterpolationAttr(), and also Create vs Get Property Methods for when to use ...
static USDGEOM_API UsdGeomMesh Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomMesh holding the prim adhering to this schema at path on stage.
Base class for all UsdGeomGprims that possess points, providing common attributes such as normals and...
Definition: pointBased.h:41
USDGEOM_API UsdAttribute CreateFaceVertexCountsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetFaceVertexCountsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute GetHoleIndicesAttr() const
The indices of all faces that should be treated as holes, i.e.
static USDGEOM_API const float SHARPNESS_INFINITE
As an element of a 'creaseSharpness' or 'cornerSharpness' array, indicates that the crease or corner ...
Definition: mesh.h:602
USDGEOM_API UsdAttribute CreateCreaseLengthsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetCreaseLengthsAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute GetCreaseIndicesAttr() const
The indices of points grouped into sets of successive pairs that identify edges to be creased.
USDGEOM_API UsdAttribute GetCornerSharpnessesAttr() const
The sharpness values associated with a corresponding set of points specified in cornerIndices (so the...
USDGEOM_API UsdAttribute GetFaceVertexCountsAttr() const
Provides the number of vertices in each face of the mesh, which is also the number of consecutive ind...
USDGEOM_API UsdAttribute CreateHoleIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetHoleIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute GetFaceVaryingLinearInterpolationAttr() const
Specifies how elements of a primvar of interpolation type "faceVarying" are interpolated for subdivis...
USDGEOM_API UsdAttribute CreateSubdivisionSchemeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetSubdivisionSchemeAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
UsdGeomMesh(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomMesh on UsdPrim prim .
Definition: mesh.h:128
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:183
USDGEOM_API UsdAttribute CreateCornerIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetCornerIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
USDGEOM_API UsdAttribute CreateFaceVertexIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetFaceVertexIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:73
USDGEOM_API UsdAttribute GetCreaseLengthsAttr() const
The length of this array specifies the number of creases (sets of adjacent sharpened edges) on the me...
Represents a concrete typed schema.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:489
USDGEOM_API UsdAttribute CreateInterpolateBoundaryAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetInterpolateBoundaryAttr(), and also Create vs Get Property Methods for when to use Get vs Crea...
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
virtual USDGEOM_API ~UsdGeomMesh()
Destructor.
USDGEOM_API UsdAttribute GetTriangleSubdivisionRuleAttr() const
Specifies an option to the subdivision rules for the Catmull-Clark scheme to try and improve undesira...
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:78
static USDGEOM_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...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:114
USDGEOM_API UsdAttribute GetCornerIndicesAttr() const
The indices of points for which a corresponding sharpness value is specified in cornerSharpnesses (so...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: mesh.h:122
USDGEOM_API UsdAttribute CreateCornerSharpnessesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetCornerSharpnessesAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
TfType represents a dynamic runtime type.
Definition: type.h:47
USDGEOM_API UsdAttribute CreateTriangleSubdivisionRuleAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetTriangleSubdivisionRuleAttr(), and also Create vs Get Property Methods for when to use Get vs ...
Singleton registry that provides access to schema type information and the prim definitions for regis...
USDGEOM_API size_t GetFaceCount(UsdTimeCode timeCode=UsdTimeCode::Default()) const
Returns the number of faces as defined by the size of the faceVertexCounts array at timeCode.
static USDGEOM_API bool IsSharpnessInfinite(const float sharpness)
Returns whether or not sharpness is considered infinite.
USDGEOM_API UsdAttribute CreateCreaseSharpnessesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetCreaseSharpnessesAttr(), and also Create vs Get Property Methods for when to use Get vs Create...
USDGEOM_API UsdAttribute GetInterpolateBoundaryAttr() const
Specifies how subdivision is applied for faces adjacent to boundary edges and boundary points.
USDGEOM_API UsdAttribute GetFaceVertexIndicesAttr() const
Flat list of the index (into the points attribute) of each vertex of each face in the mesh.
USDGEOM_API UsdAttribute GetCreaseSharpnessesAttr() const
The per-crease or per-edge sharpness values for all creases.
Encodes a mesh with optional subdivision properties and features.
Definition: mesh.h:116
static USDGEOM_API bool ValidateTopology(const VtIntArray &faceVertexIndices, const VtIntArray &faceVertexCounts, size_t numPoints, std::string *reason=nullptr)
Validate the topology of a mesh.
The base class for all schema types in Usd.
Definition: schemaBase.h:39
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:89
USDGEOM_API UsdAttribute CreateCreaseIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetCreaseIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
USDGEOM_API UsdAttribute GetSubdivisionSchemeAttr() const
The subdivision scheme to be applied to the surface.
UsdGeomMesh(const UsdSchemaBase &schemaObj)
Construct a UsdGeomMesh on the prim held by schemaObj .
Definition: mesh.h:136