Original Post
#pragma once#include "math.h"#include "vector.h"namespace bnr {namespace math {////////////////////////////////////////////////////////////////////////// struct Matrix { void zero (); void copy (const Matrix& m); void identity (); void perspective(f32 fovy, f32 aspect, f32 zn, f32 zf); void add (const Matrix& m); void subtract (const Matrix& m); void multiply (const Matrix& m); void divide (const Matrix& m); void scale (const Vector& v); void scale (f32 x, f32 y, f32 z); void translate (const Vector& v); void translate (f32 x, f32 y, f32 z); void rotate (f32 x, f32 y, f32 z, f32 a); void rotateX (f32 a); void rotateY (f32 a); void rotateZ (f32 a); __declspec(align(16)) union { struct { f32 _11, _12, _13, _14, _21, _22, _23, _24, _31, _32, _33, _34, _41, _42, _43, _44; }; f32 m[4][4]; __m128 m128[4]; }; }; ////////////////////////////////////////////////////////////////////////// inline void Matrix::zero() { memset(this->m, 0, 64); } inline void Matrix::copy(const Matrix& m) { memcpy(this->m, m.m, 64); }... hundreds of lines of other functions...}}#pragma once#include "math.h"#include "matrix.h"namespace bnr {namespace math {////////////////////////////////////////////////////////////////////////// struct Vector { Vector() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) { }; Vector(f32 xp, f32 yp, f32 zp) : x(xp), y(yp), z(zp), w(1.0f) { }; Vector(f32 xp, f32 yp, f32 zp, f32 wp) : x(xp), y(yp), z(zp), w(wp) { }; void multiply (const Matrix& m); void multiply (const Vector& v, const Matrix& m); __declspec(align(16)) union { struct{ f32 x, y, z, w; }; f32 v[4]; __m128 v128; }; }; ////////////////////////////////////////////////////////////////////////// inline void Vector::multiply(const Matrix& m) { this->multiply(*this, m); } inline void Vector::multiply(const Vector& v, const Matrix& m) { __m128 vx = _mm_shuffle_ps(v.v128, v.v128, 0x00); //broadcasts __m128 vy = _mm_shuffle_ps(v.v128, v.v128, 0x55); __m128 vz = _mm_shuffle_ps(v.v128, v.v128, 0xAA); __m128 vw = _mm_shuffle_ps(v.v128, v.v128, 0xFF); vx = _mm_mul_ps(vx, m.m128[0]); vy = _mm_mul_ps(vy, m.m128[1]); vz = _mm_mul_ps(vz, m.m128[2]); vw = _mm_mul_ps(vw, m.m128[3]); vx = _mm_add_ps(vx, vy); vx = _mm_add_ps(vx, vz); this->v128 = _mm_add_ps(vx, vw); }//////////////////////////////////////////////////////////////////////////}}first error points here:
void multiply (const Matrix& m);error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
syntax error : missing ',' before '&'
and 20 other repeating errors for every instance of Matrix within the header. I don't get it, what am I missing?