Fix spotlight direction on models with only a light pos vhot
This commit is contained in:
parent
1b13d92b99
commit
a5571c9f76
|
@ -51,12 +51,8 @@ public class Light
|
||||||
Matrix4x4 rotate,
|
Matrix4x4 rotate,
|
||||||
Matrix4x4 scale)
|
Matrix4x4 scale)
|
||||||
{
|
{
|
||||||
var transform = scale * rotate * translate;
|
Position = Vector3.Transform(Position, rotate) + Vector3.Transform(vhotLightPos, scale * rotate * translate);
|
||||||
vhotLightPos = Vector3.Transform(vhotLightPos, transform);
|
SpotlightDir = Vector3.Normalize(Vector3.Transform(vhotLightDir, scale * rotate));
|
||||||
vhotLightDir = Vector3.Transform(vhotLightDir, transform);
|
|
||||||
|
|
||||||
Position = Vector3.Transform(Position, rotate) + vhotLightPos;
|
|
||||||
SpotlightDir = Vector3.Normalize(vhotLightDir - vhotLightPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float StrengthAtPoint(Vector3 point, Plane plane)
|
public float StrengthAtPoint(Vector3 point, Plane plane)
|
||||||
|
|
|
@ -258,7 +258,7 @@ public class LightMapper
|
||||||
}
|
}
|
||||||
if (model.TryGetVhot(ModelFile.VhotId.LightDirection, out vhot))
|
if (model.TryGetVhot(ModelFile.VhotId.LightDirection, out vhot))
|
||||||
{
|
{
|
||||||
vhotLightDir = vhot.Position - model.Header.Center;
|
vhotLightDir = (vhot.Position - model.Header.Center) - vhotLightPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue