From: <axl...@us...> - 2009-05-16 03:46:33
|
Revision: 255 http://hgengine.svn.sourceforge.net/hgengine/?rev=255&view=rev Author: axlecrusher Date: 2009-05-16 03:46:27 +0000 (Sat, 16 May 2009) Log Message: ----------- vector multiplication Modified Paths: -------------- Mercury2/src/MercuryVertex.cpp Mercury2/src/MercuryVertex.h Mercury2/src/Viewport.cpp Modified: Mercury2/src/MercuryVertex.cpp =================================================================== --- Mercury2/src/MercuryVertex.cpp 2009-05-16 03:13:09 UTC (rev 254) +++ Mercury2/src/MercuryVertex.cpp 2009-05-16 03:46:27 UTC (rev 255) @@ -4,25 +4,26 @@ MercuryVertex::MercuryVertex() { - (*this)[0] = (*this)[1] = (*this)[2] = 0; + (*this)[0] = (*this)[1] = (*this)[2] = (*this)[3] = 0; } -MercuryVertex::MercuryVertex( float ix, float iy, float iz ) +MercuryVertex::MercuryVertex( float ix, float iy, float iz, float iw ) { (*this)[0] = ix; (*this)[1] = iy; (*this)[2] = iz; + (*this)[3] = iw; } - +/* MercuryVertex::MercuryVertex( const float * in ) { - for (unsigned int i = 0; i < 3; ++i) + for (unsigned int i = 0; i < 4; ++i) (*this)[i] = in[i]; } - +*/ MercuryVertex::MercuryVertex( const MercuryVertex& v) { - for (unsigned int i = 0; i < 3; ++i) + for (unsigned int i = 0; i < 4; ++i) (*this)[i] = v[i]; } @@ -106,7 +107,7 @@ void MercuryVertex::Print() const { - printf("%f %f %f\n", (*this)[0], (*this)[1], (*this)[2]); + printf("Vertex: %f %f %f %f\n", (*this)[0], (*this)[1], (*this)[2], (*this)[3]); } Modified: Mercury2/src/MercuryVertex.h =================================================================== --- Mercury2/src/MercuryVertex.h 2009-05-16 03:13:09 UTC (rev 254) +++ Mercury2/src/MercuryVertex.h 2009-05-16 03:46:27 UTC (rev 255) @@ -13,8 +13,8 @@ { public: MercuryVertex(); - MercuryVertex( float ix, float iy, float iz ); - MercuryVertex( const float * in ); + MercuryVertex( float ix, float iy, float iz, float iw = 0 ); +// MercuryVertex( const float * in ); MercuryVertex( const MercuryVertex& v); ///Direct conversion to float* Modified: Mercury2/src/Viewport.cpp =================================================================== --- Mercury2/src/Viewport.cpp 2009-05-16 03:13:09 UTC (rev 254) +++ Mercury2/src/Viewport.cpp 2009-05-16 03:46:27 UTC (rev 255) @@ -30,13 +30,12 @@ glMatrixMode(GL_MODELVIEW); VIEWMATRIX = matrix; - EYE[0] = matrix[0][3]; - EYE[1] = matrix[1][3]; - EYE[2] = matrix[2][3]; + EYE[0] = matrix[0][3]; // same as float* [3] + EYE[1] = matrix[1][3]; // same as float* [7] + EYE[2] = matrix[2][3]; // same as float* [11] EYE *= -1; - MercuryVector l(0,0,1); -// l += EYE; + MercuryVector l(0,0,1,1); LOOKAT = (matrix * l).Normalize(); // LOOKAT.Print(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |