Reverse-engineered reimplementation of 3D Pinball for Windows - Space Cadet from k4zmu2a/SpaceCadetPinball (MIT), upstream cb9b7b8, vendored rather than submoduled so local patches are just edits. - CMakeLists: stop hard-setting CMAKE_OSX_ARCHITECTURES so the documented -D override works; brew's SDL2 is arm64-only and universal linking failed. - gitignore original .DAT/.MID assets, which are not ours to redistribute. - CLAUDE.md: build line, upstream deviation, and where game data goes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
826 B
C++
37 lines
826 B
C++
#pragma once
|
|
#include "maths.h"
|
|
|
|
struct vector_type4
|
|
{
|
|
float X;
|
|
float Y;
|
|
float Z;
|
|
float W;
|
|
};
|
|
|
|
struct mat4_row_major
|
|
{
|
|
vector_type4 Row0;
|
|
vector_type4 Row1;
|
|
vector_type4 Row2;
|
|
vector_type4 Row3;
|
|
};
|
|
|
|
|
|
class proj
|
|
{
|
|
public:
|
|
static void init(float* mat4x3, float d, float centerX, float centerY, float zMin, float zScaler);
|
|
static vector3 matrix_vector_multiply(const mat4_row_major& mat, const vector3& vec);
|
|
static float z_distance(const vector3& vec);
|
|
static vector2i xform_to_2d(const vector3& vec);
|
|
static vector2i xform_to_2d(const vector2& vec);
|
|
static vector3 ReverseXForm(const vector2i& vec);
|
|
static void recenter(float centerX, float centerY);
|
|
static uint16_t NormalizeDepth(float depth);
|
|
private:
|
|
static mat4_row_major matrix;
|
|
static float d_, centerx, centery;
|
|
static float zscaler, zmin, zmax;
|
|
};
|