Merge branch 'MontyTRC89:develop' into develop

This commit is contained in:
davidmarr 2024-12-13 20:23:25 +01:00 committed by GitHub
commit 34beccfccc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 10 deletions

View file

@ -489,6 +489,7 @@ static void SetPlayerOptics(ItemInfo* item)
player.Control.Look.IsUsingLasersight = true;
player.Inventory.IsBusy = true;
Camera.DisableInterpolation = true;
BinocularOldCamera = Camera.oldType;
return;
}
@ -506,6 +507,7 @@ static void SetPlayerOptics(ItemInfo* item)
player.Control.Look.IsUsingLasersight = false;
player.Inventory.IsBusy = false;
Camera.DisableInterpolation = true;
Camera.type = BinocularOldCamera;
Camera.bounce = 0;
AlterFOV(LastFOV);

View file

@ -958,6 +958,7 @@ void BinocularCamera(ItemInfo* item)
player.Inventory.IsBusy = false;
Camera.type = BinocularOldCamera;
Camera.DisableInterpolation = true;
Camera.target = LastTarget;
AlterFOV(LastFOV);
return;

View file

@ -235,11 +235,25 @@ int FloorInfo::GetSurfaceHeight(const Vector3i& pos, bool isFloor) const
if (!bridgeSurfaceHeight.has_value())
continue;
// Use bridge midpoint to decide whether to return bridge height or room height, in case probe point
// is located within the bridge. Without it, dynamic bridges may fail while Lara is standing on them.
int thickness = bridge.GetCeilingBorder(bridgeItem) - bridge.GetFloorBorder(bridgeItem);
int midpoint = bridgeItem.Pose.Position.y + thickness / 2;
// Decide whether to override midpoint with surface height, if bridge type is tilt.
// It is needed to prevent submerging into tilted bridges, as their surface height does not correspond
// to their height function.
if (bridgeItem.ObjectNumber >= GAME_OBJECT_ID::ID_BRIDGE_TILT1 &&
bridgeItem.ObjectNumber <= GAME_OBJECT_ID::ID_BRIDGE_TILT4)
{
midpoint = *bridgeSurfaceHeight;
}
// 2.2) Track closest floor or ceiling height.
if (isFloor)
{
// Test if bridge floor height is closer.
if (*bridgeCeilingHeight >= pos.y && // Bridge midpoint is below position.
if (midpoint >= pos.y && // Bridge midpoint is below position.
*bridgeSurfaceHeight < floorHeight && // Bridge floor height is above current closest floor height.
*bridgeSurfaceHeight >= ceilingHeight) // Bridge ceiling height is below sector ceiling height.
{
@ -249,7 +263,7 @@ int FloorInfo::GetSurfaceHeight(const Vector3i& pos, bool isFloor) const
else
{
// Test if bridge ceiling height is closer.
if (*bridgeFloorHeight <= pos.y && // Bridge midpoint is above position.
if (midpoint <= pos.y && // Bridge midpoint is above position.
*bridgeSurfaceHeight > ceilingHeight && // Bridge ceiling height is below current closest ceiling height.
*bridgeSurfaceHeight <= floorHeight) // Bridge floor height is above sector floor height.
{

View file

@ -2175,6 +2175,7 @@ namespace TEN::Gui
(player.Control.IsLow && !IsHeld(In::Crouch))) &&
!UseSpotCam && !TrackCameraInit)
{
Camera.DisableInterpolation = true;
player.Control.Look.OpticRange = ANGLE(0.7f);
player.Control.Look.IsUsingBinoculars = true;
player.Inventory.OldBusy = true;

View file

@ -1387,6 +1387,8 @@ namespace TEN::Renderer
SetCullMode(CullMode::None);
_primitiveBatch->Begin();
for (auto& deb : DebrisFragments)
{
if (deb.active)
@ -1403,34 +1405,34 @@ namespace TEN::Renderer
BindTexture(TextureRegister::ColorMap, &std::get<0>(_moveablesTextures[deb.mesh.tex]), SamplerStateRegister::LinearClamp);
}
_stStatic.World = Matrix::Lerp(deb.PrevTransform, deb.Transform, GetInterpolationFactor());
_stStatic.World = Matrix::Identity;
_stStatic.Color = deb.color;
_stStatic.AmbientLight = _rooms[deb.roomNumber].AmbientLight;
_stStatic.LightMode = (int)deb.lightMode;
_cbStatic.UpdateData(_stStatic, _context.Get());
auto matrix = Matrix::Lerp(deb.PrevTransform, deb.Transform, GetInterpolationFactor());
Vertex vtx0;
vtx0.Position = deb.mesh.Positions[0];
vtx0.Position = Vector3::Transform(deb.mesh.Positions[0], matrix);
vtx0.UV = deb.mesh.TextureCoordinates[0];
vtx0.Normal = deb.mesh.Normals[0];
vtx0.Color = deb.mesh.Colors[0];
Vertex vtx1;
vtx1.Position = deb.mesh.Positions[1];
vtx1.Position = Vector3::Transform(deb.mesh.Positions[1], matrix);
vtx1.UV = deb.mesh.TextureCoordinates[1];
vtx1.Normal = deb.mesh.Normals[1];
vtx1.Color = deb.mesh.Colors[1];
Vertex vtx2;
vtx2.Position = deb.mesh.Positions[2];
vtx2.Position = Vector3::Transform(deb.mesh.Positions[2], matrix);
vtx2.UV = deb.mesh.TextureCoordinates[2];
vtx2.Normal = deb.mesh.Normals[2];
vtx2.Color = deb.mesh.Colors[2];
_primitiveBatch->Begin();
_primitiveBatch->DrawTriangle(vtx0, vtx1, vtx2);
_primitiveBatch->End();
_numDebrisDrawCalls++;
_numDrawCalls++;
@ -1438,6 +1440,8 @@ namespace TEN::Renderer
}
}
_primitiveBatch->End();
// TODO: temporary fix, we need to remove every use of SpriteBatch and PrimitiveBatch because
// they mess up render states cache.

View file

@ -122,10 +122,8 @@ float3 DoShadow(float3 worldPos, float3 normal, float3 lighting, float bias)
float x, y;
// Perform PCF filtering on a 4 x 4 texel neighborhood.
[unroll]
for (y = -1.5; y <= 1.5; y += 1.0)
{
[unroll]
for (x = -1.5; x <= 1.5; x += 1.0)
{
sum += ShadowMap.SampleCmpLevelZero(ShadowMapSampler, float3(lightClipSpace.xy + TexOffset(x, y), i), lightClipSpace.z);