00001 #pragma warning ( disable : 4786 )
00002
00003 #include <assert.h>
00004 #include <math/math2.h>
00005 #include <math/vector4.h>
00006 #include <stdio.h>
00007 #include "utility.h"
00008 #include "VrmlRotation.h"
00009
00010
00011
00012
00013
00014
00015 void VrmlRotation ::Parse( char*& buffer )
00016 {
00017 EatWhite( buffer );
00018 if( buffer[ 0 ] == 'r' )
00019 {
00020 Keyword k = VrmlNode::GetKeyword( buffer );
00021 assert( k = VRML_Rotation );
00022 }
00023
00024 float x;
00025 float y;
00026 float z;
00027 float angleInRadians;
00028
00029
00030 int result;
00031 result = sscanf( buffer, "%f%f%f%f", &x, &y, &z, &angleInRadians );
00032
00033
00034 while( buffer[ 0 ] != '\n' )
00035 {
00036 buffer++;
00037 }
00038
00039
00040 double angleInDegrees = Rad2Deg( angleInRadians );
00041 this->m_Matrix = Matrix4x4::Identity();
00042 this->m_Matrix.Rotate( Vector4( x, y, z ), angleInDegrees );
00043
00044 EatWhite( buffer );
00045 if( buffer[ 0 ] == '}' )
00046 {
00047 buffer++;
00048 }
00049 }