Repository navigation
Expand file tree
/
Copy pathvoxelmodel.cpp
More file actions
80 lines (64 loc) · 1.5 KB
/
Copy pathvoxelmodel.cpp
File metadata and controls
80 lines (64 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "voxelmodel.h"
CVoxelModel::CVoxelModel()
{
}
CVoxelModel::~CVoxelModel()
{
}
void * CVoxelChunck::GetVertexBufferPointer()
{
return &this->vbuffer[0];
}
int CVoxelChunck::GetPrimitiveCount()
{
return vbuffer.size();
}
void CVoxelChunck::InitDense(int levelsize)
{
int size = 1 << levelsize;
this->size = size;
vbuffer.resize(size*size*size, { 0,0,0,-1,0,0 });
//memset(&vbuffer[0], 0, size*size*size * sizeof(VoxelVertex));
}
void CVoxelChunck::InitSparse(int levelsize, int count)
{
int size = 1 << levelsize;
this->size = size;
vbuffer.clear();
vbuffer.reserve(count);
}
bool CVoxelChunck::OccoludeTest()
{
return false;
}
void CVoxelChunck::Init(int levelsize)
{
}
CVoxelChunck::CVoxelChunck()
{
this->attributes.clear();
this->attributes.push_back({ 0, 4, GL_FLOAT, GL_FALSE, sizeof(VoxelVertex), 0 });
this->attributes.push_back({ 1, 2, GL_FLOAT, GL_FALSE, sizeof(VoxelVertex), 4 * sizeof(int) });
this->PrimitiveSize = sizeof(VoxelVertex);
this->PrimitiveType = GL_POINTS;
}
void CDenseVoxelChunck::Init(int levelsize)
{
int size = 1 << levelsize;
this->size = size;
vbuffer.resize(size*size*size, { 0,0,0,-1,0,0 });
}
SparseVoxelChunck CDenseVoxelChunck::CreateSparse()
{
return SparseVoxelChunck();
}
void CSparseVoxelChunck::Init(int levelsize)
{
int size = 1 << levelsize;
this->size = size;
vbuffer.clear();
}
DenseVoxelChunck CSparseVoxelChunck::CreateDense()
{
return DenseVoxelChunck();
}