module charge.math.matrix
Math

Source file for Matrix4x4d.

Code Map

//! Source file for Matrix4x4d.
module charge.math.matrix;


//! Fov angles to make a up projection matrix, angle semantics matches
//! those of OpenXR.
struct Fovf
{
public:
	angleLeft: f32;
	angleRight: f32;
	angleUp: f32;
	angleDown: f32;


public:
	fn setToFovyAspect(fovy: f64, aspect: f64) { }
}

//! Matrix 3x3!f32, used for normal transforms.
struct Matrix3x3f
{
public:
	a: f32[9];


public:
	fn setToIdentity() { }
	fn setTo(mat: Matrix3x3d) { }
	fn setToAndTranspose(mat: Matrix3x3d) { }
	fn ptr() f32* { }
}

//! Matrix 4x4!f32, used to upload to OpenGL shaders.
struct Matrix4x4f
{
public:
	a: f32[16];


public:
	fn setToIdentity() { }
	fn setFrom(mat: Matrix4x4d) { }
	fn setToAndTranspose(mat: Matrix4x4d) { }
	fn setToMultiply(l: Matrix4x4d, r: Matrix4x4d) { }
	fn setToMultiplyAndTranspose(l: Matrix4x4d, r: Matrix4x4d) { }
	fn ptr() f32* { }
}

//! Matrix 3x3!f64, used mostly to create normal matrices.
struct Matrix3x3d
{
public:
	union Union
	{
	public:
		m: f64[3][3];
		vecs: Vector3d[3];
		a: f64[9];
	}


public:
	u: Union;


public:
	fn setToIdentity() { }
	fn setTo(mat: Matrix4x4d) { }
	fn setToInverse(mat: Matrix4x4d) { }
	fn inverseThis() { }
	fn toString() string { }
}

//! Matrix 4x4!f64, common handy matrix.
struct Matrix4x4d
{
public:
	union Union
	{
	public:
		m: f64[4][4];
		a: f64[16];
	}


public:
	u: Union;


public:
	fn setToIdentity() { }
	//! Set this matrix to a model matrix from the given position and rotation.
	fn setToModel(p: Point3f, q: Quatf) { }
	//! Set this matrix to a model matrix from the given position, rotation and
	//! scales, the variable rotPoint defines where in model scape the rotation
	//! and scale is centered.
	fn setToModel(p: Point3f, q: Quatf, s: Vector3f, rotPoint: Point3f) { }
	//! Set this matrix to a model matrix from the given position, rotation and
	//! scales.
	fn setToModel(p: Point3f, q: Quatf, s: Vector3f) { }
	fn setToOrtho(left: f64, right: f64, bottom: f64, top: f64, nearval: f64, farval: f64) { }
	//! Sets the matrix to a lookAt matrix looking at eye + rot * forward.
	fn setToLookFrom(eye: Point3f, rot: Quatf) { }
	//! Sets the matrix to the same as gluPerspective does.
	fn setToPerspective(fovy: f64, aspect: f64, near: f64, far: f64) { }
	//! Set from a set of fov angles.
	fn setToFrustum(fov: Fovf, near: f64, far: f64) { }
	//! Set to a projection matrix using fov angles, angle semantics matches
	//! those of OpenXR.
	fn setToFrustum(angleLeft: f64, angleRight: f64, angleDown: f64, angleUp: f64, near: f64, far: f64) { }
	//! Transforms a vector using only the lowest 3x3 part of the matrix, aka a
	//! normal transformation, no perspective divide.
	fn opMul(vector: Vector3f) Vector3f { }
	fn opMul(point: Point3f) Point3f { }
	fn opDiv(point: Point3f) Point3f { }
	fn setToMultiply(l: Matrix4x4d, r: Matrix4x4d) { }
	fn transpose() { }
	fn inverse() { }
	fn ptr() f64* { }
}
struct Fovf

Fov angles to make a up projection matrix, angle semantics matches those of OpenXR.

struct Matrix3x3f

Matrix 3x3!f32, used for normal transforms.

struct Matrix4x4f

Matrix 4x4!f32, used to upload to OpenGL shaders.

struct Matrix3x3d

Matrix 3x3!f64, used mostly to create normal matrices.

struct Matrix4x4d

Matrix 4x4!f64, common handy matrix.

fn setToModel(p: Point3f, q: Quatf)

Set this matrix to a model matrix from the given position and rotation.

fn setToModel(p: Point3f, q: Quatf, s: Vector3f, rotPoint: Point3f)

Set this matrix to a model matrix from the given position, rotation and scales, the variable rotPoint defines where in model scape the rotation and scale is centered.

fn setToModel(p: Point3f, q: Quatf, s: Vector3f)

Set this matrix to a model matrix from the given position, rotation and scales.

fn setToLookFrom(eye: Point3f, rot: Quatf)

Sets the matrix to a lookAt matrix looking at eye + rot * forward.

Similar to gluLookAt.

fn setToPerspective(fovy: f64, aspect: f64, near: f64, far: f64)

Sets the matrix to the same as gluPerspective does.

fn setToFrustum(fov: Fovf, near: f64, far: f64)

Set from a set of fov angles.

fn setToFrustum(angleLeft: f64, angleRight: f64, angleDown: f64, angleUp: f64, near: f64, far: f64)

Set to a projection matrix using fov angles, angle semantics matches those of OpenXR.

fn opMul(vector: Vector3f) Vector3f

Transforms a vector using only the lowest 3x3 part of the matrix, aka a normal transformation, no perspective divide.