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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// LightingThread.cpp
// Implements the cLightingThread class representing the thread that processes requests for lighting
#include "Globals.h"
#include "LightingThread.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cLightingThread:
cLightingThread::cLightingThread(void) :
super("cLightingThread")
{
}
cLightingThread::~cLightingThread()
{
Stop();
}
void cLightingThread::Stop(void)
{
{
cCSLock Lock(m_CS);
for (cLightingBufferQueue::iterator itr = m_Queue.begin(); itr != m_Queue.end(); ++itr)
{
delete *itr;
} // for itr - m_Queue[]
}
m_ShouldTerminate = true;
m_Event.Set();
Wait();
}
void cLightingThread::QueueLighting(cWorld * a_World, int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ)
{
// TODO
}
void cLightingThread::Execute(void)
{
// TODO
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cLightingThread::cLightingBuffer:
cLightingThread::cLightingBuffer::cLightingBuffer(int a_MinX, int a_MaxX, int a_MinY, int a_MaxY, int a_MinZ, int a_MaxZ) :
m_MinX(a_MinX),
m_MaxX(a_MaxX),
m_MinY(a_MinY),
m_MaxY(a_MaxY),
m_MinZ(a_MinZ),
m_MaxZ(a_MaxZ)
{
// TODO: initialize strides
}
void cLightingThread::cLightingBuffer::GetFromWorld(cWorld * a_World)
{
// TODO: Set m_BlockData, m_SkyLight and m_BlockLight from the world's chunks
}
void cLightingThread::cLightingBuffer::SetToWorld (cWorld * a_World)
{
// TODO: Set world's chunks from m_BlockData, m_SkyLight and m_BlockLight
}
void cLightingThread::cLightingBuffer::Process(void)
{
// TODO: Does the actual lighting on this buffer
}
|