25 #ifndef OSD_CPU_SMOOTHNORMAL_CONTEXT_H
26 #define OSD_CPU_SMOOTHNORMAL_CONTEXT_H
28 #include "../version.h"
30 #include "../osd/nonCopyable.h"
31 #include "../osd/vertexDescriptor.h"
32 #include "../osd/vertex.h"
34 #include "../far/patchTables.h"
36 namespace OpenSubdiv {
37 namespace OPENSUBDIV_VERSION {
70 template<
class VERTEX_BUFFER>
71 void Bind(VERTEX_BUFFER * in,
int iOfs,
72 VERTEX_BUFFER * out,
int oOfs) {
74 assert( ((iOfs+3)<=in->GetNumElements()) and
75 ((oOfs+3)<=out->GetNumElements()) and
76 out->GetNumVertices()>=in->GetNumVertices());
78 _iBuffer = in ? in->BindCpuBuffer() : 0;
79 _oBuffer = out ? out->BindCpuBuffer() : 0;
84 _numVertices = out->GetNumVertices();
90 _iBuffer = _oBuffer = 0;
141 _resetMemory = resetMemory;
170 using namespace OPENSUBDIV_VERSION;
174 #endif // OSD_CPU_SMOOTHNORMAL_CONTEXT_H
static CpuSmoothNormalContext * Create(Far::PatchTables const *patchTables, bool resetMemory=false)
void Unbind()
Unbinds any previously bound vertex and varying data buffers.
CpuSmoothNormalContext(Far::PatchTables const *patchTables, bool resetMemory)
Container for patch vertex indices tables.
const std::vector< unsigned int > & GetControlVertices() const
The ordered array of control vertex indices for all the patches.
int GetNumVertices() const
Returns the number of vertices in output vertex buffer.
Describes vertex elements in interleaved data buffers.
void Reset()
Resets the descriptor to default.
float const * GetCurrentInputVertexBuffer() const
Returns a pointer to the data of the input buffer.
const Far::PatchTables::PatchArrayVector & GetPatchArrayVector() const
Returns the vector of patch arrays.
VertexBufferDescriptor const & GetInputVertexDescriptor() const
Returns an VertexDescriptor for the input vertex data.
bool GetResetMemory() const
float * GetCurrentOutputVertexBuffer()
Returns a pointer to the data of the output buffer.
void SetResetMemory(bool resetMemory)
std::vector< unsigned int > PTable
std::vector< PatchArray > PatchArrayVector
void Bind(VERTEX_BUFFER *in, int iOfs, VERTEX_BUFFER *out, int oOfs)
VertexBufferDescriptor const & GetOutputVertexDescriptor() const