Move TileSize definition to terrain info.

This commit is contained in:
Paul Chote
2025-03-29 19:15:56 +00:00
committed by Gustas Kažukauskas
parent 0f7b24a8c0
commit 25188e849e
24 changed files with 48 additions and 45 deletions

View File

@@ -141,7 +141,7 @@ namespace OpenRA.Mods.Cnc.Graphics
{
var map = wr.World.Map;
var groundPos = model.Pos - new WVec(0, 0, map.DistanceAboveTerrain(model.Pos).Length);
var groundZ = (float)map.Grid.TileSize.Height * (groundPos.Z - model.Pos.Z) / map.Grid.TileScale;
var groundZ = (float)map.Rules.TerrainInfo.TileSize.Height * (groundPos.Z - model.Pos.Z) / map.Grid.TileScale;
var pxOrigin = wr.Screen3DPosition(model.Pos);
// HACK: We don't have enough texture channels to pass the depth data to the shader
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Cnc.Graphics
// sloped towards the camera. Offset it by another half cell to avoid clipping.
var cell = map.CellContaining(model.Pos);
if (map.Ramp.Contains(cell) && map.Ramp[cell] == 7)
pxOrigin += new float3(0, 0, 0.5f * map.Grid.TileSize.Height);
pxOrigin += new float3(0, 0, 0.5f * map.Rules.TerrainInfo.TileSize.Height);
var shadowOrigin = pxOrigin - groundZ * new float2(renderProxy.ShadowDirection, 1);
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Cnc.Graphics
public void RenderDebugGeometry(WorldRenderer wr)
{
var groundPos = model.Pos - new WVec(0, 0, wr.World.Map.DistanceAboveTerrain(model.Pos).Length);
var groundZ = wr.World.Map.Grid.TileSize.Height * (groundPos.Z - model.Pos.Z) / 1024f;
var groundZ = wr.World.Map.Rules.TerrainInfo.TileSize.Height * (groundPos.Z - model.Pos.Z) / 1024f;
var pxOrigin = wr.Screen3DPosition(model.Pos);
var shadowOrigin = pxOrigin - groundZ * new float2(renderProxy.ShadowDirection, 1);