| 211 | |
| 212 | |
| 213 | void cLightingThread::LightChunk(cLightingChunkStay & a_Item) |
| 214 | { |
| 215 | cChunkDef::BlockNibbles BlockLight, SkyLight; |
| 216 | |
| 217 | ReadChunks(a_Item.m_ChunkX, a_Item.m_ChunkZ); |
| 218 | |
| 219 | PrepareBlockLight(); |
| 220 | CalcLight(m_BlockLight); |
| 221 | |
| 222 | PrepareSkyLight(); |
| 223 | |
| 224 | /* |
| 225 | // DEBUG: Save chunk data with highlighted seeds for visual inspection: |
| 226 | cFile f4; |
| 227 | if ( |
| 228 | f4.Open(Printf("Chunk_%d_%d_seeds.grab", a_Item.x, a_Item.z), cFile::fmWrite) |
| 229 | ) |
| 230 | { |
| 231 | for (int z = 0; z < cChunkDef::Width * 3; z++) |
| 232 | { |
| 233 | for (int y = cChunkDef::Height / 2; y >= 0; y--) |
| 234 | { |
| 235 | unsigned char Seeds [cChunkDef::Width * 3]; |
| 236 | memcpy(Seeds, m_BlockTypes + y * BlocksPerYLayer + z * cChunkDef::Width * 3, cChunkDef::Width * 3); |
| 237 | for (int x = 0; x < cChunkDef::Width * 3; x++) |
| 238 | { |
| 239 | if (m_IsSeed1[y * BlocksPerYLayer + z * cChunkDef::Width * 3 + x]) |
| 240 | { |
| 241 | Seeds[x] = E_BLOCK_DIAMOND_BLOCK; |
| 242 | } |
| 243 | } |
| 244 | f4.Write(Seeds, cChunkDef::Width * 3); |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | //*/ |
| 249 | |
| 250 | CalcLight(m_SkyLight); |
| 251 | |
| 252 | /* |
| 253 | // DEBUG: Save XY slices of the chunk data and lighting for visual inspection: |
| 254 | cFile f1, f2, f3; |
| 255 | if ( |
| 256 | f1.Open(Printf("Chunk_%d_%d_data.grab", a_Item.x, a_Item.z), cFile::fmWrite) && |
| 257 | f2.Open(Printf("Chunk_%d_%d_sky.grab", a_Item.x, a_Item.z), cFile::fmWrite) && |
| 258 | f3.Open(Printf("Chunk_%d_%d_glow.grab", a_Item.x, a_Item.z), cFile::fmWrite) |
| 259 | ) |
| 260 | { |
| 261 | for (int z = 0; z < cChunkDef::Width * 3; z++) |
| 262 | { |
| 263 | for (int y = cChunkDef::Height / 2; y >= 0; y--) |
| 264 | { |
| 265 | f1.Write(m_BlockTypes + y * BlocksPerYLayer + z * cChunkDef::Width * 3, cChunkDef::Width * 3); |
| 266 | unsigned char SkyLight [cChunkDef::Width * 3]; |
| 267 | unsigned char BlockLight[cChunkDef::Width * 3]; |
| 268 | for (int x = 0; x < cChunkDef::Width * 3; x++) |
| 269 | { |
| 270 | SkyLight[x] = m_SkyLight [y * BlocksPerYLayer + z * cChunkDef::Width * 3 + x] << 4; |
nothing calls this directly
no test coverage detected