All pastes #954182 Raw Edit

Stuff

public cpp v1 · immutable
#954182 ·published 2008-03-23 18:56 UTC
rendered paste body
class CMatrix{public:	float m_matrix[16];				CMatrix(){Identity();};			__inline CMatrix& operator = (CMatrix& Matrix)	{		for (int i=0; i<16; i++)			m_matrix[i] = Matrix.m_matrix[i];		return *this;	};	float __inline operator[](int i) {	return m_matrix[i];  };	void Multiply(CMatrix *matrix);	void SetTranslation(CVector pos);	void SetInvTranslation(CVector pos);		void __inline Scale(float x, float y, float z)	{		m_matrix[0] = x;   		m_matrix[5] = y;		m_matrix[10] = z;  	};	void __inline Identity()	{		for (int i=0; i<16; i++)			m_matrix[i] = 0.0;		m_matrix[0] = m_matrix[5] = m_matrix[10] = m_matrix[15] = 1;	};	void RotateDegrees(double dAngleX, double dAngleY, double dAngleZ);	void RotateRadians(double dAngleX, double dAngleY, double dAngleZ);	void RotateInvDegrees(double dAngleX, double dAngleY, double dAngleZ);	void RotateInvRadians(double dAngleX, double dAngleY, double dAngleZ);	void __inline InverseTranslateVect(float *pVect)	{		pVect[0] = pVect[0]-m_matrix[12];		pVect[1] = pVect[1]-m_matrix[13];		pVect[2] = pVect[2]-m_matrix[14];	};	void __inline InverseRotateVect(float *pVect)	{		float vec[3];		vec[0] = pVect[0]*m_matrix[0]+pVect[1]*m_matrix[1]+pVect[2]*m_matrix[2];		vec[1] = pVect[0]*m_matrix[4]+pVect[1]*m_matrix[5]+pVect[2]*m_matrix[6];		vec[2] = pVect[0]*m_matrix[8]+pVect[1]*m_matrix[9]+pVect[2]*m_matrix[10];		for (int i=0; i<3; i++)			pVect[i] = vec[i];	};};