- bugfix for displaying units with light sources in view of the camera
This commit is contained in:
parent
bd31395f86
commit
d4cff9786a
|
@ -138,7 +138,7 @@ const Vec4f Renderer::defAmbientColor= Vec4f(1.f * ambFactor, 1.f * ambFactor, 1
|
||||||
const Vec4f Renderer::defColor= Vec4f(1.f, 1.f, 1.f, 1.f);
|
const Vec4f Renderer::defColor= Vec4f(1.f, 1.f, 1.f, 1.f);
|
||||||
|
|
||||||
//const float Renderer::maxLightDist= 100.f;
|
//const float Renderer::maxLightDist= 100.f;
|
||||||
const float Renderer::maxLightDist= 1000.f;
|
const float Renderer::maxLightDist= 100.f;
|
||||||
|
|
||||||
bool Renderer::rendererEnded = true;
|
bool Renderer::rendererEnded = true;
|
||||||
|
|
||||||
|
@ -644,12 +644,13 @@ void Renderer::setupLighting() {
|
||||||
|
|
||||||
//unit lights (not projectiles)
|
//unit lights (not projectiles)
|
||||||
if(timeFlow->isTotalNight()) {
|
if(timeFlow->isTotalNight()) {
|
||||||
for(int i=0; i<world->getFactionCount() && lightCount<maxLights; ++i){
|
for(int i = 0; i < world->getFactionCount() && lightCount < maxLights; ++i) {
|
||||||
for(int j=0; j<world->getFaction(i)->getUnitCount() && lightCount<maxLights; ++j){
|
for(int j = 0; j < world->getFaction(i)->getUnitCount() && lightCount < maxLights; ++j) {
|
||||||
Unit *unit= world->getFaction(i)->getUnit(j);
|
Unit *unit= world->getFaction(i)->getUnit(j);
|
||||||
if(world->toRenderUnit(unit) &&
|
if(world->toRenderUnit(unit) &&
|
||||||
unit->getCurrVector().dist(gameCamera->getPos())<maxLightDist &&
|
unit->getCurrVector().dist(gameCamera->getPos()) < maxLightDist &&
|
||||||
unit->getType()->getLight() && unit->isOperative()){
|
unit->getType()->getLight() && unit->isOperative()){
|
||||||
|
//printf("$$$ Show light # %d / %d for Unit [%d - %s]\n",lightCount,maxLights,unit->getId(),unit->getFullName().c_str());
|
||||||
|
|
||||||
Vec4f pos= Vec4f(unit->getCurrVector());
|
Vec4f pos= Vec4f(unit->getCurrVector());
|
||||||
pos.y+=4.f;
|
pos.y+=4.f;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user