rodecomp/Source/Render/Projection/RendererViewport.cpp
ragnarok-clanker d4568519de Maintenance: [forced, user-approved] R7b+R7c (resubmit of returned 10244, rebased on 947ce989): remove the invented FogConfiguration,
Batch #10247 by ragnarok-clanker: forced by an admin (3 lower score(s), 26 changed function(s)); checked with 330 compiled unit(s), including every includer of Source/Render/DX7/RendererFogDX7.h, Source/Render/DX9/DeviceOwnerDX9.h, Source/Render/DX9/RenderSystemDX9.h, Source/Render/DX9/RendererDX9.h, Source/Render/DX9/RendererDX9Operations.h, Source/Render/DX9/RendererFogDX9.h, Source/Render/DX9/RendererPresentation.h, Source/Render/DeviceContext/DCSurface.h, Source/Render/Projection/RendererViewport.h, Source/Render/RenderAdapter.h, Source/Render/SpriteGeometry.h, Source/Render/TextureQuad.h, Source/Render/FogConfiguration.h.
Deletes: Source/Render/FogConfiguration.h
2026-11-03 12:07:29 +00:00

37 lines
1.2 KiB
C++

#include "Render/SpriteGeometry.h"
#include "Render/Projection/RendererViewport.h"
#include <bit>
#include <cmath>
// OFFSET: 0x0055F6A0
// FUNCTION: fn_02118
void RendererViewport::SetSize(int columns, int rows) {
this->height = rows;
this->centerX = columns / 2;
this->width = columns;
this->centerY = rows / 2;
const float aspect = static_cast<float>(rows) / static_cast<float>(columns);
this->aspect = aspect;
const float narrow = static_cast<float>(std::tan(0.13089966773986816));
this->scaleY = static_cast<float>(rows / 2) / narrow;
const float wide = static_cast<float>(std::tan(1.4398963451385498));
this->clipCenterY = rows / 2;
this->clipCenterX = columns / 2;
this->vertical = wide;
this->horizontal = wide * aspect;
this->scaleX = (static_cast<float>(columns / 2) / narrow) * aspect;
this->uiScaleX = static_cast<float>(columns) / 640.0f;
const float height = (static_cast<float>(rows) * 1.34f) / 768.0f;
this->uiScaleY = static_cast<float>(rows) / 730.0f;
g_heightScale = height;
g_tangent = g_projectionScale / this->uiScaleY;
g_cotangent = g_projectionScale / this->uiScaleY;
}
// INLINED
RenderProjection RendererViewport::Projection() const {
return {this->scaleX, this->scaleY, this->centerX, this->centerY};
}