All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mesh.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef USDGEOM_GENERATED_MESH_H
25 #define USDGEOM_GENERATED_MESH_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdGeom/api.h"
31 #include "pxr/usd/usdGeom/pointBased.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdGeom/tokens.h"
35 
36 #include "pxr/usd/usd/timeCode.h"
37 
38 #include "pxr/base/vt/value.h"
39 
40 #include "pxr/base/gf/vec3d.h"
41 #include "pxr/base/gf/vec3f.h"
42 #include "pxr/base/gf/matrix4d.h"
43 
44 #include "pxr/base/tf/token.h"
45 #include "pxr/base/tf/type.h"
46 
47 PXR_NAMESPACE_OPEN_SCOPE
48 
49 class SdfAssetPath;
50 
51 // -------------------------------------------------------------------------- //
52 // MESH //
53 // -------------------------------------------------------------------------- //
54 
87 {
88 public:
93 
98  explicit UsdGeomMesh(const UsdPrim& prim=UsdPrim())
99  : UsdGeomPointBased(prim)
100  {
101  }
102 
106  explicit UsdGeomMesh(const UsdSchemaBase& schemaObj)
107  : UsdGeomPointBased(schemaObj)
108  {
109  }
110 
112  USDGEOM_API
113  virtual ~UsdGeomMesh();
114 
118  USDGEOM_API
119  static const TfTokenVector &
120  GetSchemaAttributeNames(bool includeInherited=true);
121 
131  USDGEOM_API
132  static UsdGeomMesh
133  Get(const UsdStagePtr &stage, const SdfPath &path);
134 
157  USDGEOM_API
158  static UsdGeomMesh
159  Define(const UsdStagePtr &stage, const SdfPath &path);
160 
161 protected:
165  USDGEOM_API
166  UsdSchemaType _GetSchemaType() const override;
167 
168 private:
169  // needs to invoke _GetStaticTfType.
170  friend class UsdSchemaRegistry;
171  USDGEOM_API
172  static const TfType &_GetStaticTfType();
173 
174  static bool _IsTypedSchema();
175 
176  // override SchemaBase virtuals.
177  USDGEOM_API
178  const TfType &_GetTfType() const override;
179 
180 public:
181  // --------------------------------------------------------------------- //
182  // FACEVERTEXINDICES
183  // --------------------------------------------------------------------- //
193  USDGEOM_API
195 
201  USDGEOM_API
202  UsdAttribute CreateFaceVertexIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
203 
204 public:
205  // --------------------------------------------------------------------- //
206  // FACEVERTEXCOUNTS
207  // --------------------------------------------------------------------- //
219  USDGEOM_API
221 
227  USDGEOM_API
228  UsdAttribute CreateFaceVertexCountsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
229 
230 public:
231  // --------------------------------------------------------------------- //
232  // SUBDIVISIONSCHEME
233  // --------------------------------------------------------------------- //
251  USDGEOM_API
253 
259  USDGEOM_API
260  UsdAttribute CreateSubdivisionSchemeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
261 
262 public:
263  // --------------------------------------------------------------------- //
264  // INTERPOLATEBOUNDARY
265  // --------------------------------------------------------------------- //
276  USDGEOM_API
278 
284  USDGEOM_API
285  UsdAttribute CreateInterpolateBoundaryAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
286 
287 public:
288  // --------------------------------------------------------------------- //
289  // FACEVARYINGLINEARINTERPOLATION
290  // --------------------------------------------------------------------- //
306  USDGEOM_API
308 
314  USDGEOM_API
315  UsdAttribute CreateFaceVaryingLinearInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
316 
317 public:
318  // --------------------------------------------------------------------- //
319  // TRIANGLESUBDIVISIONRULE
320  // --------------------------------------------------------------------- //
333  USDGEOM_API
335 
341  USDGEOM_API
342  UsdAttribute CreateTriangleSubdivisionRuleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
343 
344 public:
345  // --------------------------------------------------------------------- //
346  // HOLEINDICES
347  // --------------------------------------------------------------------- //
356  USDGEOM_API
358 
364  USDGEOM_API
365  UsdAttribute CreateHoleIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
366 
367 public:
368  // --------------------------------------------------------------------- //
369  // CORNERINDICES
370  // --------------------------------------------------------------------- //
378  USDGEOM_API
380 
386  USDGEOM_API
387  UsdAttribute CreateCornerIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
388 
389 public:
390  // --------------------------------------------------------------------- //
391  // CORNERSHARPNESSES
392  // --------------------------------------------------------------------- //
403  USDGEOM_API
405 
411  USDGEOM_API
412  UsdAttribute CreateCornerSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
413 
414 public:
415  // --------------------------------------------------------------------- //
416  // CREASEINDICES
417  // --------------------------------------------------------------------- //
427  USDGEOM_API
429 
435  USDGEOM_API
436  UsdAttribute CreateCreaseIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
437 
438 public:
439  // --------------------------------------------------------------------- //
440  // CREASELENGTHS
441  // --------------------------------------------------------------------- //
453  USDGEOM_API
455 
461  USDGEOM_API
462  UsdAttribute CreateCreaseLengthsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
463 
464 public:
465  // --------------------------------------------------------------------- //
466  // CREASESHARPNESSES
467  // --------------------------------------------------------------------- //
483  USDGEOM_API
485 
491  USDGEOM_API
492  UsdAttribute CreateCreaseSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
493 
494 public:
495  // ===================================================================== //
496  // Feel free to add custom code below this line, it will be preserved by
497  // the code generator.
498  //
499  // Just remember to:
500  // - Close the class declaration with };
501  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
502  // - Close the include guard with #endif
503  // ===================================================================== //
504  // --(BEGIN CUSTOM CODE)--
505 
513  USDGEOM_API
514  static bool ValidateTopology(const VtIntArray& faceVertexIndices,
515  const VtIntArray& faceVertexCounts,
516  size_t numPoints,
517  std::string* reason=nullptr);
518 
519 public:
523  USDGEOM_API
524  static const float SHARPNESS_INFINITE;
525 };
526 
527 PXR_NAMESPACE_CLOSE_SCOPE
528 
529 #endif
USDGEOM_API UsdAttribute GetInterpolateBoundaryAttr() const
Specifies how interpolation boundary face edges are interpolated.
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:58
USDGEOM_API UsdAttribute GetHoleIndicesAttr() const
The face indices (indexing into the 'faceVertexCounts' attribute) of all faces that should be made in...
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...
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:524
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...
USDGEOM_API UsdAttribute GetSubdivisionSchemeAttr() const
The subdivision scheme to be applied to the surface.
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...
UsdGeomMesh(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomMesh on UsdPrim prim .
Definition: mesh.h:98
USDGEOM_API UsdSchemaType _GetSchemaType() const override
Returns the type of schema this class belongs to.
USDGEOM_API UsdAttribute GetFaceVaryingLinearInterpolationAttr() const
Specifies how face varying data is interpolated.
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
Represents a concrete typed schema.
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 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...
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 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 UsdAttribute GetCreaseSharpnessesAttr() const
The per-crease or per-edge sharpness for all creases (Usd.Mesh.SHARPNESS_INFINITE for a perfectly sha...
UsdSchemaType
An enum representing which type of schema a given schema class belongs to.
Definition: common.h:127
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:131
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:433
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
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 GetCreaseLengthsAttr() const
The length of this array specifies the number of creases on the surface.
USDGEOM_API UsdAttribute GetCornerSharpnessesAttr() const
The sharpness values for corners: each corner gets a single sharpness value (Usd.Mesh.SHARPNESS_INFINITE for a perfectly sharp corner), so the size of this array must match that of &#39;cornerIndices&#39;.
virtual USDGEOM_API ~UsdGeomMesh()
Destructor.
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 ...
Contains an asset path and an optional resolved path.
Definition: assetPath.h:43
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...
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...
static const UsdSchemaType schemaType
Compile time constant representing what kind of schema this class is.
Definition: mesh.h:92
TfType represents a dynamic runtime type.
Definition: type.h:70
Singleton registry that provides access to prim and property definition information for registered Us...
USDGEOM_API UsdAttribute GetTriangleSubdivisionRuleAttr() const
Specifies what weights are used during triangle subdivision for the Catmull-Clark scheme...
USDGEOM_API UsdAttribute GetCreaseIndicesAttr() const
The indices of all vertices forming creased edges.
Encodes a mesh surface whose definition and feature-set will converge with that of OpenSubdiv...
Definition: mesh.h:86
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:56
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...
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...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182
USDGEOM_API UsdAttribute GetCornerIndicesAttr() const
The vertex indices of all vertices that are sharp corners.
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...
UsdGeomMesh(const UsdSchemaBase &schemaObj)
Construct a UsdGeomMesh on the prim held by schemaObj .
Definition: mesh.h:106