OpenSubdiv
Loading...
Searching...
No Matches
cpuVertexBuffer.h
Go to the documentation of this file.
1//
2// Copyright 2013 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://opensubdiv.org/license.
6//
7
8#ifndef OPENSUBDIV3_OSD_CPU_VERTEX_BUFFER_H
9#define OPENSUBDIV3_OSD_CPU_VERTEX_BUFFER_H
10
11#include "../version.h"
12
13#include <cstddef>
14
15namespace OpenSubdiv {
16namespace OPENSUBDIV_VERSION {
17
18namespace Osd {
19
26public:
28 static CpuVertexBuffer * Create(int numElements, int numVertices,
29 void *deviceContext = NULL);
30
33
36 void UpdateData(const float *src, int startVertex, int numVertices,
37 void *deviceContext = NULL);
38
40 int GetNumElements() const;
41
43 int GetNumVertices() const;
44
46 float * BindCpuBuffer();
47
48protected:
50 CpuVertexBuffer(int numElements, int numVertices);
51
52private:
53 int _numElements;
54 int _numVertices;
55 float *_cpuBuffer;
56};
57
58
59} // end namespace Osd
60
61} // end namespace OPENSUBDIV_VERSION
62using namespace OPENSUBDIV_VERSION;
63
64} // end namespace OpenSubdiv
65
66#endif // OPENSUBDIV3_OSD_CPU_VERTEX_BUFFER_H
Concrete vertex buffer class for CPU subdivision.
int GetNumElements() const
Returns how many elements defined in this vertex buffer.
static CpuVertexBuffer * Create(int numElements, int numVertices, void *deviceContext=NULL)
Creator. Returns NULL if error.
void UpdateData(const float *src, int startVertex, int numVertices, void *deviceContext=NULL)
int GetNumVertices() const
Returns how many vertices allocated in this vertex buffer.
float * BindCpuBuffer()
Returns the address of CPU buffer.
CpuVertexBuffer(int numElements, int numVertices)
Constructor.