OpenSubdiv: opensubdiv/osd/cpuVertexBuffer.h Source File

| 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
25 class CpuVertexBuffer {
26public:
28 static CpuVertexBuffer * Create(int numElements, int numVertices,
29 void *deviceContext = NULL);
30
32 ~CpuVertexBuffer();
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
OpenSubdiv
Definition limits.h:15
OpenSubdiv::OPENSUBDIV_VERSION
Definition limits.h:16
OpenSubdiv::OPENSUBDIV_VERSION::Osd
Definition bufferDescriptor.h:17
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::GetNumElements
int GetNumElements() const
Returns how many elements defined in this vertex buffer.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::Create
static CpuVertexBuffer * Create(int numElements, int numVertices, void *deviceContext=NULL)
Creator. Returns NULL if error.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::UpdateData
void UpdateData(const float *src, int startVertex, int numVertices, void *deviceContext=NULL)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::GetNumVertices
int GetNumVertices() const
Returns how many vertices allocated in this vertex buffer.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::~CpuVertexBuffer
~CpuVertexBuffer()
Destructor.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::BindCpuBuffer
float * BindCpuBuffer()
Returns the address of CPU buffer.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CpuVertexBuffer::CpuVertexBuffer
CpuVertexBuffer(int numElements, int numVertices)
Constructor.