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  // --------------------------------------------------------------------- //
192  USDGEOM_API
194 
200  USDGEOM_API
201  UsdAttribute CreateFaceVertexIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
202 
203 public:
204  // --------------------------------------------------------------------- //
205  // FACEVERTEXCOUNTS
206  // --------------------------------------------------------------------- //
217  USDGEOM_API
219 
225  USDGEOM_API
226  UsdAttribute CreateFaceVertexCountsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
227 
228 public:
229  // --------------------------------------------------------------------- //
230  // SUBDIVISIONSCHEME
231  // --------------------------------------------------------------------- //
247  USDGEOM_API
249 
255  USDGEOM_API
256  UsdAttribute CreateSubdivisionSchemeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
257 
258 public:
259  // --------------------------------------------------------------------- //
260  // INTERPOLATEBOUNDARY
261  // --------------------------------------------------------------------- //
271  USDGEOM_API
273 
279  USDGEOM_API
280  UsdAttribute CreateInterpolateBoundaryAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
281 
282 public:
283  // --------------------------------------------------------------------- //
284  // FACEVARYINGLINEARINTERPOLATION
285  // --------------------------------------------------------------------- //
300  USDGEOM_API
302 
308  USDGEOM_API
309  UsdAttribute CreateFaceVaryingLinearInterpolationAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
310 
311 public:
312  // --------------------------------------------------------------------- //
313  // TRIANGLESUBDIVISIONRULE
314  // --------------------------------------------------------------------- //
326  USDGEOM_API
328 
334  USDGEOM_API
335  UsdAttribute CreateTriangleSubdivisionRuleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
336 
337 public:
338  // --------------------------------------------------------------------- //
339  // HOLEINDICES
340  // --------------------------------------------------------------------- //
348  USDGEOM_API
350 
356  USDGEOM_API
357  UsdAttribute CreateHoleIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
358 
359 public:
360  // --------------------------------------------------------------------- //
361  // CORNERINDICES
362  // --------------------------------------------------------------------- //
369  USDGEOM_API
371 
377  USDGEOM_API
378  UsdAttribute CreateCornerIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
379 
380 public:
381  // --------------------------------------------------------------------- //
382  // CORNERSHARPNESSES
383  // --------------------------------------------------------------------- //
393  USDGEOM_API
395 
401  USDGEOM_API
402  UsdAttribute CreateCornerSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
403 
404 public:
405  // --------------------------------------------------------------------- //
406  // CREASEINDICES
407  // --------------------------------------------------------------------- //
416  USDGEOM_API
418 
424  USDGEOM_API
425  UsdAttribute CreateCreaseIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
426 
427 public:
428  // --------------------------------------------------------------------- //
429  // CREASELENGTHS
430  // --------------------------------------------------------------------- //
441  USDGEOM_API
443 
449  USDGEOM_API
450  UsdAttribute CreateCreaseLengthsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
451 
452 public:
453  // --------------------------------------------------------------------- //
454  // CREASESHARPNESSES
455  // --------------------------------------------------------------------- //
470  USDGEOM_API
472 
478  USDGEOM_API
479  UsdAttribute CreateCreaseSharpnessesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
480 
481 public:
482  // ===================================================================== //
483  // Feel free to add custom code below this line, it will be preserved by
484  // the code generator.
485  //
486  // Just remember to:
487  // - Close the class declaration with };
488  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
489  // - Close the include guard with #endif
490  // ===================================================================== //
491  // --(BEGIN CUSTOM CODE)--
492 
500  USDGEOM_API
501  static bool ValidateTopology(const VtIntArray& faceVertexIndices,
502  const VtIntArray& faceVertexCounts,
503  size_t numPoints,
504  std::string* reason=nullptr);
505 
506 public:
510  USDGEOM_API
511  static const float SHARPNESS_INFINITE;
512 };
513 
514 PXR_NAMESPACE_CLOSE_SCOPE
515 
516 #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:511
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:149
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:438
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