Fix no light source being defined in ModelWidget
This commit is contained in:
@@ -106,6 +106,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
float[] cachedLightDiffuseColor = new float[] { 0, 0, 0 };
|
float[] cachedLightDiffuseColor = new float[] { 0, 0, 0 };
|
||||||
int cachedLightPitch;
|
int cachedLightPitch;
|
||||||
int cachedLightYaw;
|
int cachedLightYaw;
|
||||||
|
WRot cachedLightSource;
|
||||||
WAngle cachedCameraAngle;
|
WAngle cachedCameraAngle;
|
||||||
PaletteReference paletteReference;
|
PaletteReference paletteReference;
|
||||||
PaletteReference paletteReferencePlayer;
|
PaletteReference paletteReferencePlayer;
|
||||||
@@ -175,11 +176,12 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
if (rotation != cachedRotation)
|
if (rotation != cachedRotation)
|
||||||
cachedRotation = rotation;
|
cachedRotation = rotation;
|
||||||
|
|
||||||
if (lightPitch != cachedLightPitch)
|
if (lightPitch != cachedLightPitch || lightYaw != cachedLightYaw)
|
||||||
|
{
|
||||||
cachedLightPitch = lightPitch;
|
cachedLightPitch = lightPitch;
|
||||||
|
|
||||||
if (lightYaw != cachedLightYaw)
|
|
||||||
cachedLightYaw = lightYaw;
|
cachedLightYaw = lightYaw;
|
||||||
|
cachedLightSource = new WRot(WAngle.Zero, new WAngle(256 - lightPitch), new WAngle(lightYaw));
|
||||||
|
}
|
||||||
|
|
||||||
if (cachedLightAmbientColor[0] != lightAmbientColor[0] || cachedLightAmbientColor[1] != lightAmbientColor[1] || cachedLightAmbientColor[2] != lightAmbientColor[2])
|
if (cachedLightAmbientColor[0] != lightAmbientColor[0] || cachedLightAmbientColor[1] != lightAmbientColor[1] || cachedLightAmbientColor[2] != lightAmbientColor[2])
|
||||||
cachedLightAmbientColor = lightAmbientColor;
|
cachedLightAmbientColor = lightAmbientColor;
|
||||||
@@ -209,7 +211,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
var modelRenderable = new UIModelRenderable(
|
var modelRenderable = new UIModelRenderable(
|
||||||
renderer,
|
renderer,
|
||||||
animations, WPos.Zero, origin, 0, camera, scale,
|
animations, WPos.Zero, origin, 0, camera, scale,
|
||||||
WRot.None, cachedLightAmbientColor, cachedLightDiffuseColor,
|
cachedLightSource, cachedLightAmbientColor, cachedLightDiffuseColor,
|
||||||
paletteReferencePlayer, paletteReferenceNormals, paletteReferenceShadow);
|
paletteReferencePlayer, paletteReferenceNormals, paletteReferenceShadow);
|
||||||
|
|
||||||
renderable = modelRenderable.PrepareRender(WorldRenderer);
|
renderable = modelRenderable.PrepareRender(WorldRenderer);
|
||||||
|
|||||||
Reference in New Issue
Block a user