mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-14 00:54:05 +02:00
fix #128
This commit is contained in:
@@ -234,29 +234,26 @@ struct MuzzleFlash : Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void update() {
|
virtual void update() {
|
||||||
|
timer += Core::deltaTime;
|
||||||
if (timer < MUZZLE_FLASH_TIME) {
|
if (timer < MUZZLE_FLASH_TIME) {
|
||||||
timer += Core::deltaTime;
|
float intensity = clamp((MUZZLE_FLASH_TIME - timer) * 20.0f, EPS, 1.0f);
|
||||||
|
|
||||||
if (timer < MUZZLE_FLASH_TIME) {
|
vec4 lightPos = vec4(owner->getJoint(joint).pos, 0);
|
||||||
float intensity = clamp((MUZZLE_FLASH_TIME - timer) * 20.0f, EPS, 1.0f);
|
vec4 lightColor = FLASH_LIGHT_COLOR * vec4(intensity, intensity, intensity, 1.0f / sqrtf(intensity));
|
||||||
|
if (lightIndex > -1) {
|
||||||
vec4 lightPos = vec4(owner->getJoint(joint).pos, 0);
|
ASSERT(lightIndex + 1 < MAX_LIGHTS);
|
||||||
vec4 lightColor = FLASH_LIGHT_COLOR * vec4(intensity, intensity, intensity, 1.0f / sqrtf(intensity));
|
Core::lightPos[lightIndex] = lightPos;
|
||||||
if (lightIndex > -1) {
|
Core::lightColor[lightIndex] = lightColor;
|
||||||
ASSERT(lightIndex + 1 < MAX_LIGHTS);
|
} else
|
||||||
Core::lightPos[lightIndex] = lightPos;
|
getRoom().addDynLight(owner->entity, lightPos, lightColor, true);
|
||||||
Core::lightColor[lightIndex] = lightColor;
|
} else {
|
||||||
} else
|
if (lightIndex > -1) {
|
||||||
getRoom().addDynLight(owner->entity, lightPos, lightColor, true);
|
ASSERT(lightIndex < MAX_LIGHTS);
|
||||||
} else {
|
Core::lightPos[lightIndex] = vec4(0);
|
||||||
if (lightIndex > -1) {
|
Core::lightColor[lightIndex] = vec4(0, 0, 0, 1);
|
||||||
ASSERT(lightIndex < MAX_LIGHTS);
|
} else
|
||||||
Core::lightPos[lightIndex] = vec4(0);
|
getRoom().removeDynLight(owner->entity);
|
||||||
Core::lightColor[lightIndex] = vec4(0, 0, 0, 1);
|
game->removeEntity(this);
|
||||||
} else
|
|
||||||
getRoom().removeDynLight(owner->entity);
|
|
||||||
game->removeEntity(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user