mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Fixed billboards, reintroduce ReflectVectorOptionally
This commit is contained in:
parent
3535eddf5d
commit
85469cb4d4
3 changed files with 11 additions and 3 deletions
|
@ -593,6 +593,14 @@ namespace TEN::Renderer
|
|||
return (_currentMirror != nullptr && room != _currentMirror->RealRoom);
|
||||
}
|
||||
|
||||
inline void ReflectVectorOptionally(Vector3& vector)
|
||||
{
|
||||
if (_currentMirror == nullptr)
|
||||
return;
|
||||
|
||||
vector = Vector3::Transform(vector, _currentMirror->ReflectionMatrix);
|
||||
}
|
||||
|
||||
inline void ReflectMatrixOptionally(Matrix& matrix)
|
||||
{
|
||||
if (_currentMirror == nullptr)
|
||||
|
|
|
@ -1654,8 +1654,8 @@ namespace TEN::Renderer
|
|||
{
|
||||
if (Camera.pos.RoomNumber == mirror.RealRoom && IsPointInRoom(light.Position, mirror.RealRoom))
|
||||
{
|
||||
light.Position = Vector3::Transform(light.Position, mirror.ReflectionMatrix);
|
||||
light.Direction = Vector3::Transform(light.Direction, mirror.ReflectionMatrix);
|
||||
ReflectVectorOptionally(light.Position);
|
||||
ReflectVectorOptionally(light.Direction);
|
||||
light.Hash = 0;
|
||||
|
||||
_dynamicLights[_dynamicLightList].push_back(light);
|
||||
|
|
|
@ -1288,6 +1288,7 @@ namespace TEN::Renderer
|
|||
auto scaleMatrix = Matrix::CreateScale(sprite->Width * sprite->Scale, sprite->Height * sprite->Scale, sprite->Scale);
|
||||
|
||||
Vector3 spritePosition = sprite->pos;
|
||||
ReflectVectorOptionally(spritePosition);
|
||||
|
||||
switch (sprite->Type)
|
||||
{
|
||||
|
@ -1324,7 +1325,6 @@ namespace TEN::Renderer
|
|||
break;
|
||||
}
|
||||
|
||||
ReflectMatrixOptionally(spriteMatrix);
|
||||
return spriteMatrix;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue