types.h
Go to the documentation of this file.
1 //
2 // Copyright 2015 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 
25 #ifndef OPENSUBDIV3_OSD_TYPES_H
26 #define OPENSUBDIV3_OSD_TYPES_H
27 
28 #include "../version.h"
29 #include "../far/patchTable.h"
30 
31 namespace OpenSubdiv {
32 namespace OPENSUBDIV_VERSION {
33 
34 namespace Osd {
35 
40 struct PatchCoord {
41  // 5-ints struct.
42 
52  handle(handle), s(s), t(t) { }
53 
54  PatchCoord() : s(0), t(0) {
55  handle.arrayIndex = 0;
56  handle.patchIndex = 0;
57  handle.vertIndex = 0;
58  }
59 
61  float s, t;
62 };
63 
64 struct PatchArray {
65  // 4-ints struct.
67  int indexBase, int primitiveIdBase) :
68  desc(desc), numPatches(numPatches), indexBase(indexBase),
69  primitiveIdBase(primitiveIdBase) {}
70 
72  return desc;
73  }
74 
75  int GetPatchType() const {
76  return desc.GetType();
77  }
78  int GetNumPatches() const {
79  return numPatches;
80  }
81  int GetIndexBase() const {
82  return indexBase;
83  }
84  int GetPrimitiveIdBase() const {
85  return primitiveIdBase;
86  }
89  int indexBase; // an offset within the index buffer
90  int primitiveIdBase; // an offset within the patch param buffer
91 };
92 
93 struct PatchParam : public Far::PatchParam {
94  // int3 struct.
95  float sharpness;
96 };
97 
98 typedef std::vector<PatchArray> PatchArrayVector;
99 typedef std::vector<PatchParam> PatchParamVector;
100 
101 } // end namespace Osd
102 
103 } // end namespace OPENSUBDIV_VERSION
104 using namespace OPENSUBDIV_VERSION;
105 
106 } // end namespace OpenSubdiv
107 
108 
109 #endif // OPENSUBDIV3_OSD_TYPES_H
Local patch parameterization descriptor.
Definition: patchParam.h:64
Far::PatchDescriptor const & GetDescriptor() const
Definition: types.h:71
std::vector< PatchArray > PatchArrayVector
Definition: types.h:98
Coordinates set on a patch table.
Definition: types.h:40
Far::PatchTable::PatchHandle handle
patch handle
Definition: types.h:60
std::vector< PatchParam > PatchParamVector
Definition: types.h:99
PatchCoord(Far::PatchTable::PatchHandle handle, float s, float t)
Constructor.
Definition: types.h:51
Type GetType() const
Returns the type of the patch.
PatchArray(Far::PatchDescriptor desc, int numPatches, int indexBase, int primitiveIdBase)
Definition: types.h:66
Handle that can be used as unique patch identifier within PatchTable.
Definition: patchTable.h:61
float t
parametric location on patch
Definition: types.h:61