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
51 PatchCoord(Far::PatchTable::PatchHandle handleArg, float sArg, float tArg) :
52 handle(handleArg), s(sArg), t(tArg) { }
53
54 PatchCoord() : s(0), t(0) {
55 handle.arrayIndex = 0;
56 handle.patchIndex = 0;
57 handle.vertIndex = 0;
58 }
59
60 Far::PatchTable::PatchHandle handle;
61 float s, t;
62 };
63
64 struct PatchArray {
65 // 4-ints struct.
66 PatchArray(Far::PatchDescriptor desc_in, int numPatches_in,
67 int indexBase_in, int primitiveIdBase_in) :
68 desc(desc_in), numPatches(numPatches_in), indexBase(indexBase_in),
69 primitiveIdBase(primitiveIdBase_in) {}
70
71 Far::PatchDescriptor const &GetDescriptor() const {
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 }
87 Far::PatchDescriptor desc;
88 int numPatches;
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
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchCoord::PatchCoord
PatchCoord(Far::PatchTable::PatchHandle handleArg, float sArg, float tArg)
Constructor.
Definition: types.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchCoord::s
float s
Definition: types.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::PatchHandle::patchIndex
Index patchIndex
Definition: patchTable.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::GetPrimitiveIdBase
int GetPrimitiveIdBase() const
Definition: types.h:84
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchParam
Definition: types.h:93
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray
Definition: types.h:64
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchParamVector
std::vector< PatchParam > PatchParamVector
Definition: types.h:99
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchParam
Patch parameterization.
Definition: patchParam.h:152
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::GetDescriptor
Far::PatchDescriptor const & GetDescriptor() const
Definition: types.h:71
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::indexBase
int indexBase
Definition: types.h:89
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArrayVector
std::vector< PatchArray > PatchArrayVector
Definition: types.h:98
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::GetIndexBase
int GetIndexBase() const
Definition: types.h:81
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::PatchHandle::arrayIndex
Index arrayIndex
Definition: patchTable.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchCoord::handle
Far::PatchTable::PatchHandle handle
patch handle
Definition: types.h:60
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::PatchHandle
Handle that can be used as unique patch identifier within PatchTable.
Definition: patchTable.h:60
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchParam::sharpness
float sharpness
Definition: types.h:95
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable::PatchHandle::vertIndex
Index vertIndex
Definition: patchTable.h:67
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::GetNumPatches
int GetNumPatches() const
Definition: types.h:78
OpenSubdiv
Definition: error.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::numPatches
int numPatches
Definition: types.h:88
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchCoord::t
float t
parametric location on patch
Definition: types.h:61
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchCoord::PatchCoord
PatchCoord()
Definition: types.h:54
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::primitiveIdBase
int primitiveIdBase
Definition: types.h:90
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchCoord
Coordinates set on a patch table.
Definition: types.h:40
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::desc
Far::PatchDescriptor desc
Definition: types.h:87
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::GetPatchType
int GetPatchType() const
Definition: types.h:75
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArray::PatchArray
PatchArray(Far::PatchDescriptor desc_in, int numPatches_in, int indexBase_in, int primitiveIdBase_in)
Definition: types.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchDescriptor
Describes the type of a patch.
Definition: patchDescriptor.h:50