All pastes #87376 Raw Edit

Rud

public cpp v1 · immutable
·published 2006-07-13 22:12 UTC
rendered paste body
void CMatrix::Update3DSCameraMatrix(Vector3D pos, Vector3D tar, Vector3D up, float grader){	CMatrix r; // roll	Vector3D x, y, z;	Vector3D negpos;	//kamera posisjonen	negpos=pos;	negpos.Negate();	z=pos - tar;	z.Normalize();	x=up^z;	up=z^x;	x.Normalize();	y.Normalize();	Matrix[0]=x.x;	Matrix[4]=x.y;	Matrix[8]=x.z;	Matrix[12]=0;	Matrix[1]=up.x;	Matrix[5]=up.y;	Matrix[9]=up.z;	Matrix[13]=0;	Matrix[2]=z.x;	Matrix[6]=z.y;	Matrix[10]=z.z;	Matrix[14]=0;	Matrix[3]=0;	Matrix[7]=0;	Matrix[11]=0;	Matrix[15]=1;	r.LoadIdentity();	r.CreateRotationMatrix(Vector3D(0,0, grader/180.0f*M_PI));	MultiplyMatrix(r);	PreTranspose(&negpos);}