@@ -390,7 +390,6 @@ void VoxelManipulator::unspreadLight(enum LightBank bank, v3s16 p, u8 oldlight,
390
390
}
391
391
}
392
392
393
- #if 1
394
393
/*
395
394
Goes recursively through the neighbours of the node.
396
395
@@ -421,115 +420,6 @@ void VoxelManipulator::unspreadLight(enum LightBank bank,
421
420
unspreadLight (bank, j->first , j->second , light_sources, nodemgr);
422
421
}
423
422
}
424
- #endif
425
-
426
- #if 0
427
- /*
428
- Goes recursively through the neighbours of the node.
429
-
430
- Alters only transparent nodes.
431
-
432
- If the lighting of the neighbour is lower than the lighting of
433
- the node was (before changing it to 0 at the step before), the
434
- lighting of the neighbour is set to 0 and then the same stuff
435
- repeats for the neighbour.
436
-
437
- The ending nodes of the routine are stored in light_sources.
438
- This is useful when a light is removed. In such case, this
439
- routine can be called for the light node and then again for
440
- light_sources to re-light the area without the removed light.
441
-
442
- values of from_nodes are lighting values.
443
- */
444
- void VoxelManipulator::unspreadLight(enum LightBank bank,
445
- core::map<v3s16, u8> & from_nodes,
446
- core::map<v3s16, bool> & light_sources)
447
- {
448
- v3s16 dirs[6] = {
449
- v3s16(0,0,1), // back
450
- v3s16(0,1,0), // top
451
- v3s16(1,0,0), // right
452
- v3s16(0,0,-1), // front
453
- v3s16(0,-1,0), // bottom
454
- v3s16(-1,0,0), // left
455
- };
456
-
457
- if(from_nodes.size() == 0)
458
- return;
459
-
460
- core::map<v3s16, u8> unlighted_nodes;
461
- core::map<v3s16, u8>::Iterator j;
462
- j = from_nodes.getIterator();
463
-
464
- for(; j.atEnd() == false; j++)
465
- {
466
- v3s16 pos = j.getNode()->getKey();
467
-
468
- addArea(VoxelArea(pos - v3s16(1,1,1), pos + v3s16(1,1,1)));
469
-
470
- //MapNode &n = m_data[m_area.index(pos)];
471
-
472
- u8 oldlight = j.getNode()->getValue();
473
-
474
- // Loop through 6 neighbors
475
- for(u16 i=0; i<6; i++)
476
- {
477
- // Get the position of the neighbor node
478
- v3s16 n2pos = pos + dirs[i];
479
-
480
- u32 n2i = m_area.index(n2pos);
481
-
482
- if(m_flags[n2i] & VOXELFLAG_NO_DATA)
483
- continue;
484
-
485
- MapNode &n2 = m_data[n2i];
486
-
487
- /*
488
- If the neighbor is dimmer than what was specified
489
- as oldlight (the light of the previous node)
490
- */
491
- if(n2.getLight(bank, nodemgr) < oldlight)
492
- {
493
- /*
494
- And the neighbor is transparent and it has some light
495
- */
496
- if(nodemgr->get(n2).light_propagates && n2.getLight(bank, nodemgr) != 0)
497
- {
498
- /*
499
- Set light to 0 and add to queue
500
- */
501
-
502
- u8 current_light = n2.getLight(bank, nodemgr);
503
- n2.setLight(bank, 0);
504
-
505
- unlighted_nodes.insert(n2pos, current_light);
506
-
507
- /*
508
- Remove from light_sources if it is there
509
- NOTE: This doesn't happen nearly at all
510
- */
511
- /*if(light_sources.find(n2pos))
512
- {
513
- std::cout<<"Removed from light_sources"<<std::endl;
514
- light_sources.remove(n2pos);
515
- }*/
516
- }
517
- }
518
- else{
519
- light_sources.insert(n2pos, true);
520
- }
521
- }
522
- }
523
-
524
- /*dstream<<"unspreadLight(): Changed block "
525
- <<blockchangecount<<" times"
526
- <<" for "<<from_nodes.size()<<" nodes"
527
- <<std::endl;*/
528
-
529
- if(unlighted_nodes.size() > 0)
530
- unspreadLight(bank, unlighted_nodes, light_sources);
531
- }
532
- #endif
533
423
534
424
void VoxelManipulator::spreadLight (enum LightBank bank, v3s16 p,
535
425
INodeDefManager *nodemgr)
@@ -594,36 +484,9 @@ void VoxelManipulator::spreadLight(enum LightBank bank, v3s16 p,
594
484
}
595
485
}
596
486
597
- #if 0
598
- /*
599
- Lights neighbors of from_nodes, collects all them and then
600
- goes on recursively.
601
-
602
- NOTE: This is faster on small areas but will overflow the
603
- stack on large areas. Thus it is not used.
604
- */
605
- void VoxelManipulator::spreadLight(enum LightBank bank,
606
- core::map<v3s16, bool> & from_nodes)
607
- {
608
- if(from_nodes.size() == 0)
609
- return;
610
-
611
- core::map<v3s16, bool> lighted_nodes;
612
- core::map<v3s16, bool>::Iterator j;
613
- j = from_nodes.getIterator();
614
-
615
- for(; j.atEnd() == false; j++)
616
- {
617
- v3s16 pos = j.getNode()->getKey();
618
-
619
- spreadLight(bank, pos);
620
- }
621
- }
622
- #endif
623
487
624
488
const MapNode VoxelManipulator::ContentIgnoreNode = MapNode(CONTENT_IGNORE);
625
489
626
- #if 1
627
490
/*
628
491
Lights neighbors of from_nodes, collects all them and then
629
492
goes on recursively.
@@ -716,6 +579,5 @@ void VoxelManipulator::spreadLight(enum LightBank bank,
716
579
if (!lighted_nodes.empty ())
717
580
spreadLight (bank, lighted_nodes, nodemgr);
718
581
}
719
- #endif
720
582
721
583
// END
0 commit comments