1 #pragma once 2 #include "maths.h" 3 4 struct vector_type4 5 { 6 float X; 7 float Y; 8 float Z; 9 float W; 10 }; 11 12 struct mat4_row_major 13 { 14 vector_type4 Row0; 15 vector_type4 Row1; 16 vector_type4 Row2; 17 vector_type4 Row3; 18 }; 19 20 21 class proj 22 { 23 public: 24 static void init(float* mat4x3, float d, float centerX, float centerY); 25 static void matrix_vector_multiply(mat4_row_major* mat, vector_type* vec, vector_type* dstVec); 26 static float z_distance(vector_type* vec); 27 static void xform_to_2d(vector_type* vec, int* dst); 28 static void recenter(float centerX, float centerY); 29 private: 30 static mat4_row_major matrix; 31 static float d_, centerx, centery; 32 }; 33