glPatchTable.h
Go to the documentation of this file.
//
// Copyright 2015 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
#define OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
#include "../version.h"
#include "../osd/nonCopyable.h"
#include "../osd/opengl.h"
#include "../osd/types.h"
#include <vector>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Far{
class PatchTable;
};
namespace Osd {
class GLPatchTable : private NonCopyable<GLPatchTable> {
public:
typedef GLuint VertexBufferBinding;
~GLPatchTable();
static GLPatchTable *Create(Far::PatchTable const *farPatchTable,
void *deviceContext = NULL);
PatchArrayVector const &GetPatchArrays() const {
return _patchArrays;
}
GLuint GetPatchIndexBuffer() const {
return _patchIndexBuffer;
}
GLuint GetPatchParamBuffer() const {
return _patchParamBuffer;
}
GLuint GetPatchIndexTextureBuffer() const {
return _patchIndexTexture;
}
GLuint GetPatchParamTextureBuffer() const {
return _patchParamTexture;
}
PatchArrayVector const &GetVaryingPatchArrays() const {
return _varyingPatchArrays;
}
GLuint GetVaryingPatchIndexBuffer() const {
return _varyingIndexBuffer;
}
GLuint GetVaryingPatchIndexTextureBuffer() const {
return _varyingIndexTexture;
}
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
PatchArrayVector const &GetFVarPatchArrays(int fvarChannel = 0) const {
return _fvarPatchArrays[fvarChannel];
}
GLuint GetFVarPatchIndexBuffer(int fvarChannel = 0) const {
return _fvarIndexBuffers[fvarChannel];
}
GLuint GetFVarPatchIndexTextureBuffer(int fvarChannel = 0) const {
return _fvarIndexTextures[fvarChannel];
}
GLuint GetFVarPatchParamBuffer(int fvarChannel = 0) const {
return _fvarParamBuffers[fvarChannel];
}
GLuint GetFVarPatchParamTextureBuffer(int fvarChannel = 0) const {
return _fvarParamTextures[fvarChannel];
}
protected:
GLPatchTable();
// allocate buffers from patchTable
bool allocate(Far::PatchTable const *farPatchTable);
PatchArrayVector _patchArrays;
GLuint _patchIndexBuffer;
GLuint _patchParamBuffer;
GLuint _patchIndexTexture;
GLuint _patchParamTexture;
PatchArrayVector _varyingPatchArrays;
GLuint _varyingIndexBuffer;
GLuint _varyingIndexTexture;
std::vector<PatchArrayVector> _fvarPatchArrays;
std::vector<GLuint> _fvarIndexBuffers;
std::vector<GLuint> _fvarIndexTextures;
std::vector<GLuint> _fvarParamBuffers;
std::vector<GLuint> _fvarParamTextures;
};
} // end namespace Osd
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif // OPENSUBDIV3_OSD_GL_PATCH_TABLE_H
OpenSubdiv
Definition: limits.h:32
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