Decompile fn_02107 (RenderProjection::Project)
Batch #1624 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_02107 RenderProjection::Project: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
e5364d02f8
commit
8386270904
2 changed files with 19 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include "Render/Primitives/LightmappedPrimitive.h"
|
||||
#include "Render/Primitives/RenderPrimitive.h"
|
||||
#include "Render/Projection/RenderProjection.h"
|
||||
|
||||
|
|
@ -21,3 +22,19 @@ void RenderProjection::Project(const float* position, const float* matrix, Rende
|
|||
output.z = depth;
|
||||
output.y = y + centerY;
|
||||
}
|
||||
|
||||
// OFFSET: 0x0055D750
|
||||
// FUNCTION: fn_02107
|
||||
void RenderProjection::Project(const float* position, const float* matrix, LightmappedVertex& output) const {
|
||||
const float inverseDepth = 1.0f / (((matrix[5] * position[1] + matrix[2] * position[0]) + matrix[8] * position[2]) + matrix[11]);
|
||||
output.rhw = inverseDepth;
|
||||
|
||||
const float depth = ((1.0f / inverseDepth - 10.0f) * 1.0067114f) * inverseDepth;
|
||||
const float x = ((((matrix[3] * position[1] + position[0] * matrix[0]) + matrix[6] * position[2]) + matrix[9]) * inverseDepth) * this->scaleX;
|
||||
output.x = x + static_cast<float>(this->centerX);
|
||||
|
||||
const float centerY = static_cast<float>(this->centerY);
|
||||
const float y = ((((matrix[4] * position[1] + matrix[1] * position[0]) + matrix[7] * position[2]) + matrix[10]) * inverseDepth) * this->scaleY;
|
||||
output.z = depth;
|
||||
output.y = y + centerY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef RAGNAROK_SOURCE_RENDER_PROJECTION_RENDERPROJECTION_H
|
||||
#define RAGNAROK_SOURCE_RENDER_PROJECTION_RENDERPROJECTION_H
|
||||
|
||||
struct LightmappedVertex;
|
||||
struct RenderVertex;
|
||||
|
||||
struct RenderProjection {
|
||||
|
|
@ -10,6 +11,7 @@ struct RenderProjection {
|
|||
const int& centerY;
|
||||
|
||||
void Project(const float* position, const float* matrix, RenderVertex& output) const;
|
||||
void Project(const float* position, const float* matrix, LightmappedVertex& output) const;
|
||||
void Ray(int x, int y, const float* origin, const float* matrix, float* output) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue