forked from cnlohr/noeuclid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.h
85 lines (62 loc) · 1.94 KB
/
Map.h
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
81
82
83
84
85
//Copyright 2011 <>< Charles Lohr - File may be licensed under the MIT/x11 license or the new BSD license. You choose.
#ifndef _MAP_H
#define _MAP_H
#include <stdio.h>
#include <math.h>
#include <list>
#include "Common.h"
#include "OGLParts.h"
//MAP Contains "GLTextureData"
using namespace std;
class RTHelper;
struct CellUpdate {
Vec3i p; Vec3i s;
};
class Map {
public:
Map(RTHelper * p, bool fakemode);
~Map();
void FakeIt();
void DefaultIt();
void RecalculateAccelerationStructure(int ix, int iy, int iz, int sx, int sy, int sz);
void Draw();
list<CellUpdate> ListUpdates;
void TackChange(Vec3i p) {
ListUpdates.push_back({p, {1,1,1}});
}
void TackMultiChange(Vec3i p, Vec3i s) {
ListUpdates.push_back({p, s});
}
inline RGBA & TexCell(unsigned i, Vec3i p) {
p.x = ((unsigned long) p.x) % GLH_SIZEX;
p.y = ((unsigned long) p.y) % GLH_SIZEY;
p.z = ((unsigned long) p.z) % GLH_SIZEZ;
return GLTextureData[i][p.x p.y * GLH_SIZEX p.z * GLH_SIZEX * GLH_SIZEY];
}
bool m_bTriggerFullRecalculate;
bool m_bReloadFullTexture;
private:
void UpdateCellSpecific(Vec3i p, Vec3i s);
void SetCellInternal(Vec3i p, byte thiscell, byte color);
//Comp 0("GeoTex"):
//Red Channel: Block Type < not ????
//Green Channel: Metadata / Cell Type? Or something like that?
//Blue Channel: "Density" of block according to addtex (use this to render)
//Alpha Channel: Actual Cell to Draw
//Comp 1("AddTex"): [possible hit?, jumpx, jumpy, jumpz]
//Comp 2("MovTex"): [x] [y] [z] [w] (Universe-warping)
RGBA * GLTextureData[3];
unsigned int i3DTex[3];
bool doSubtrace;
RTHelper * parent;
public:
void ChangeSubtrace(bool bSubtrace) {
doSubtrace = bSubtrace;
m_bTriggerFullRecalculate = true;
}
bool GetSubtrace() {
return doSubtrace;
}
void UpdateSphereTexture();
};
#endif