All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cpuEvalLimitContext.h
Go to the documentation of this file.
1 //
2 // Copyright 2013 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 OSD_CPU_EVAL_LIMIT_CONTEXT_H
26 #define OSD_CPU_EVAL_LIMIT_CONTEXT_H
27 
28 #include "../version.h"
29 
30 #include "../osd/evalLimitContext.h"
31 #include "../osd/vertexDescriptor.h"
32 #include "../far/patchTables.h"
33 #include "../far/patchMap.h"
34 
35 #include <map>
36 #include <stdio.h>
37 
38 namespace OpenSubdiv {
39 namespace OPENSUBDIV_VERSION {
40 
41 namespace Osd {
42 
44 public:
45 
55  static CpuEvalLimitContext * Create(Far::PatchTables const &patchTables,
56  bool requireFVarData=false);
57 
58  virtual ~CpuEvalLimitContext();
59 
60 
63  return _patchArrays;
64  }
65 
67  const std::vector<Far::PatchParam::BitField> & GetPatchBitFields() const {
68  return _patchBitFields;
69  }
70 
72  const std::vector<unsigned int> & GetControlVertices() const {
73  return _patches;
74  }
75 
78  return _vertexValenceTable;
79  }
80 
83  return _quadOffsetTable;
84  }
85 
87  std::vector<float> const & GetFVarData() const {
88  return _fvarData;
89  }
90 
92  int GetFVarWidth() const {
93  return _fvarwidth;
94  }
95 
97  Far::PatchMap const & GetPatchMap() const {
98  return *_patchMap;
99  }
100 
102  int GetMaxValence() const {
103  return _maxValence;
104  }
105 
106 protected:
107  explicit CpuEvalLimitContext(Far::PatchTables const & patchTables, bool requireFVarData);
108 
109 private:
110 
111  // Topology data for a mesh
112  Far::PatchTables::PatchArrayVector _patchArrays; // patch descriptor for each patch in the mesh
113  Far::PatchTables::PTable _patches; // patch control vertices
114  std::vector<Far::PatchParam::BitField> _patchBitFields; // per-patch parametric info
115 
116  Far::PatchTables::VertexValenceTable _vertexValenceTable; // extra Gregory patch data buffers
117  Far::PatchTables::QuadOffsetTable _quadOffsetTable;
118 
119  std::vector<float> _fvarData;
120 
121  Far::PatchMap * _patchMap; // map of the sub-patches given a face index
122 
123  int _maxValence,
124  _fvarwidth;
125 };
126 
127 
128 } // end namespace Osd
129 
130 } // end namespace OPENSUBDIV_VERSION
131 using namespace OPENSUBDIV_VERSION;
132 
133 } // end namespace OpenSubdiv
134 
135 #endif /* OSD_CPU_EVAL_LIMIT_CONTEXT_H */
136 
Far::PatchTables::QuadOffsetTable const & GetQuadOffsetTable() const
Returns the Quad-Offsets buffer used for Gregory patch computations.
Container for patch vertex indices tables.
Definition: patchTables.h:49
static CpuEvalLimitContext * Create(Far::PatchTables const &patchTables, bool requireFVarData=false)
Factory Returns an EvalLimitContext from the given far patch tables. Note : the patchtables is expect...
int GetFVarWidth() const
Returns the number of floats in a datum of the face-varying data table.
std::vector< unsigned int > QuadOffsetTable
Definition: patchTables.h:54
Far::PatchTables::VertexValenceTable const & GetVertexValenceTable() const
Returns the vertex-valence buffer used for Gregory patch computations.
CpuEvalLimitContext(Far::PatchTables const &patchTables, bool requireFVarData)
std::vector< float > const & GetFVarData() const
Returns the face-varying data patch table.
const std::vector< unsigned int > & GetControlVertices() const
The ordered array of control vertex indices for all the patches.
int GetMaxValence() const
Returns the highest valence of the vertices in the buffers.
An quadtree-based map connecting coarse faces to their sub-patches.
Definition: patchMap.h:49
Far::PatchMap const & GetPatchMap() const
Returns a map that can connect a faceId to a list of children patches.
const std::vector< Far::PatchParam::BitField > & GetPatchBitFields() const
Returns the vector of per-patch parametric data.
const Far::PatchTables::PatchArrayVector & GetPatchArrayVector() const
Returns the vector of patch arrays.