| OpenSubdiv

Loading...
Searching...
No Matches
glPatchTable.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_GL_PATCH_TABLE_H
26#define OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
27
28#include "../version.h"
29
30#include "../osd/nonCopyable.h"
31#include "../osd/opengl.h"
32#include "../osd/types.h"
33
34#include <vector>
35
36 namespace OpenSubdiv {
37 namespace OPENSUBDIV_VERSION {
38
39 namespace Far{
40 class PatchTable;
41};
42
43 namespace Osd {
44
45 class GLPatchTable : private NonCopyable<GLPatchTable> {
46 public:
47 typedef GLuint VertexBufferBinding;
48
49 ~GLPatchTable();
50
51 static GLPatchTable *Create(Far::PatchTable const *farPatchTable,
52 void *deviceContext = NULL);
53
55 PatchArrayVector const &GetPatchArrays() const {
56 return _patchArrays;
57 }
58
60 GLuint GetPatchIndexBuffer() const {
61 return _patchIndexBuffer;
62 }
63
65 GLuint GetPatchParamBuffer() const {
66 return _patchParamBuffer;
67 }
68
70 GLuint GetPatchIndexTextureBuffer() const {
71 return _patchIndexTexture;
72 }
73
75 GLuint GetPatchParamTextureBuffer() const {
76 return _patchParamTexture;
77 }
78
80 PatchArrayVector const &GetVaryingPatchArrays() const {
81 return _varyingPatchArrays;
82 }
83
85 GLuint GetVaryingPatchIndexBuffer() const {
86 return _varyingIndexBuffer;
87 }
88
90 GLuint GetVaryingPatchIndexTextureBuffer() const {
91 return _varyingIndexTexture;
92 }
93
95 int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
96
98 PatchArrayVector const &GetFVarPatchArrays(int fvarChannel = 0) const {
99 return _fvarPatchArrays[fvarChannel];
100 }
101
103 GLuint GetFVarPatchIndexBuffer(int fvarChannel = 0) const {
104 return _fvarIndexBuffers[fvarChannel];
105 }
106
108 GLuint GetFVarPatchIndexTextureBuffer(int fvarChannel = 0) const {
109 return _fvarIndexTextures[fvarChannel];
110 }
111
113 GLuint GetFVarPatchParamBuffer(int fvarChannel = 0) const {
114 return _fvarParamBuffers[fvarChannel];
115 }
116
118 GLuint GetFVarPatchParamTextureBuffer(int fvarChannel = 0) const {
119 return _fvarParamTextures[fvarChannel];
120 }
121
122 protected:
123 GLPatchTable();
124
125 // allocate buffers from patchTable
126 bool allocate(Far::PatchTable const *farPatchTable);
127
128 PatchArrayVector _patchArrays;
129
130 GLuint _patchIndexBuffer;
131 GLuint _patchParamBuffer;
132
133 GLuint _patchIndexTexture;
134 GLuint _patchParamTexture;
135
136 PatchArrayVector _varyingPatchArrays;
137 GLuint _varyingIndexBuffer;
138 GLuint _varyingIndexTexture;
139
140 std::vector<PatchArrayVector> _fvarPatchArrays;
141 std::vector<GLuint> _fvarIndexBuffers;
142 std::vector<GLuint> _fvarIndexTextures;
143
144 std::vector<GLuint> _fvarParamBuffers;
145 std::vector<GLuint> _fvarParamTextures;
146};
147
148
149} // end namespace Osd
150
151} // end namespace OPENSUBDIV_VERSION
152 using namespace OPENSUBDIV_VERSION;
153
154} // end namespace OpenSubdiv
155
156#endif // OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
opengl.h
nonCopyable.h
OpenSubdiv
Definition error.h:30
OpenSubdiv::OPENSUBDIV_VERSION::Osd::PatchArrayVector
std::vector< PatchArray > PatchArrayVector
Definition types.h:132
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition patchTable.h:55
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable
Definition glPatchTable.h:45
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::VertexBufferBinding
GLuint VertexBufferBinding
Definition glPatchTable.h:47
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_fvarIndexBuffers
std::vector< GLuint > _fvarIndexBuffers
Definition glPatchTable.h:141
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetPatchArrays
PatchArrayVector const & GetPatchArrays() const
Returns the patch arrays for vertex index buffer data.
Definition glPatchTable.h:55
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetFVarPatchIndexBuffer
GLuint GetFVarPatchIndexBuffer(int fvarChannel=0) const
Returns the GL index buffer containing face-varying control vertices.
Definition glPatchTable.h:103
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::~GLPatchTable
~GLPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_fvarParamBuffers
std::vector< GLuint > _fvarParamBuffers
Definition glPatchTable.h:144
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetPatchParamTextureBuffer
GLuint GetPatchParamTextureBuffer() const
Returns the GL texture buffer containing the patch parameter.
Definition glPatchTable.h:75
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_varyingIndexBuffer
GLuint _varyingIndexBuffer
Definition glPatchTable.h:137
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::allocate
bool allocate(Far::PatchTable const *farPatchTable)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::Create
static GLPatchTable * Create(Far::PatchTable const *farPatchTable, void *deviceContext=NULL)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_varyingIndexTexture
GLuint _varyingIndexTexture
Definition glPatchTable.h:138
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_fvarParamTextures
std::vector< GLuint > _fvarParamTextures
Definition glPatchTable.h:145
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_patchArrays
PatchArrayVector _patchArrays
Definition glPatchTable.h:128
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_patchIndexBuffer
GLuint _patchIndexBuffer
Definition glPatchTable.h:130
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetPatchParamBuffer
GLuint GetPatchParamBuffer() const
Returns the GL index buffer containing the patch parameter.
Definition glPatchTable.h:65
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetFVarPatchParamBuffer
GLuint GetFVarPatchParamBuffer(int fvarChannel=0) const
Returns the GL index buffer containing face-varying patch params.
Definition glPatchTable.h:113
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_patchParamTexture
GLuint _patchParamTexture
Definition glPatchTable.h:134
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GLPatchTable
GLPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetFVarPatchIndexTextureBuffer
GLuint GetFVarPatchIndexTextureBuffer(int fvarChannel=0) const
Returns the GL texture buffer containing face-varying control vertices.
Definition glPatchTable.h:108
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetFVarPatchParamTextureBuffer
GLuint GetFVarPatchParamTextureBuffer(int fvarChannel=0) const
Returns the GL texture buffer containing face-varying patch params.
Definition glPatchTable.h:118
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetPatchIndexBuffer
GLuint GetPatchIndexBuffer() const
Returns the GL index buffer containing the patch control vertices.
Definition glPatchTable.h:60
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetNumFVarChannels
int GetNumFVarChannels() const
Returns the number of face-varying channel buffers.
Definition glPatchTable.h:95
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetFVarPatchArrays
PatchArrayVector const & GetFVarPatchArrays(int fvarChannel=0) const
Returns the patch arrays for face-varying index buffer data.
Definition glPatchTable.h:98
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_fvarIndexTextures
std::vector< GLuint > _fvarIndexTextures
Definition glPatchTable.h:142
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_patchIndexTexture
GLuint _patchIndexTexture
Definition glPatchTable.h:133
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_fvarPatchArrays
std::vector< PatchArrayVector > _fvarPatchArrays
Definition glPatchTable.h:140
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetPatchIndexTextureBuffer
GLuint GetPatchIndexTextureBuffer() const
Returns the GL texture buffer containing the patch control vertices.
Definition glPatchTable.h:70
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetVaryingPatchIndexTextureBuffer
GLuint GetVaryingPatchIndexTextureBuffer() const
Returns the GL texture buffer containing the varying control vertices.
Definition glPatchTable.h:90
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_varyingPatchArrays
PatchArrayVector _varyingPatchArrays
Definition glPatchTable.h:136
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetVaryingPatchIndexBuffer
GLuint GetVaryingPatchIndexBuffer() const
Returns the GL index buffer containing the varying control vertices.
Definition glPatchTable.h:85
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::GetVaryingPatchArrays
PatchArrayVector const & GetVaryingPatchArrays() const
Returns the patch arrays for varying index buffer data.
Definition glPatchTable.h:80
OpenSubdiv::OPENSUBDIV_VERSION::Osd::GLPatchTable::_patchParamBuffer
GLuint _patchParamBuffer
Definition glPatchTable.h:131
OpenSubdiv::OPENSUBDIV_VERSION::Osd::NonCopyable
Definition nonCopyable.h:34
types.h