rodecomp/Source/Render/Projection/RendererViewport.cpp
ragnarok-clanker 750f35b3dd Maintenance: [forced, user-approved] Family W5 (resubmission of 10276 without the STATIC lines; replaces agent 2's 10270, returned by
Batch #10277 by ragnarok-clanker: forced by an admin (17 lower score(s), 63 changed function(s)); checked with 414 compiled unit(s), including every includer of Source/Contents/Effects/RagEffect.h, Source/Contents/Models/ModelActor.h, Source/Contents/Models/ModelNode.h, Source/Contents/Models/ModelRendering.h, Source/Contents/World/WorldModelView.h, Source/Contents/World/WorldOcclusion.h, Source/Contents/World/WorldTerrainPicking.h, Source/Render/Projection/RendererViewport.h, Source/Render/Projection/RenderProjection.h.
Deletes: Source/Render/Projection/RenderProjection.h
2026-11-03 15:49:14 +00:00

32 lines
1.1 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;
}