00001 #pragma warning ( disable : 4786 ) 00002 00003 #include <assert.h> 00004 #include <math/vector4.h> 00005 #include "utility.h" 00006 #include "VrmlAppearance.h" 00007 00008 //============================================================================= 00009 // Constructor 00010 // 00011 // Description: Constructor 00012 //============================================================================= 00013 VrmlAppearance::VrmlAppearance() 00014 : 00015 m_Material( NULL ) 00016 { 00017 } 00018 00019 //============================================================================= 00020 // Parse 00021 // 00022 // Description: Parses the rotation node from the file 00023 //============================================================================= 00024 void VrmlAppearance::Parse( char*& buffer ) 00025 { 00026 EatWhite( buffer ); 00027 while( buffer[ 0 ] != '}' ) 00028 { 00029 Keyword keyword = VrmlNode::GetKeyword( buffer ); 00030 switch( keyword ) 00031 { 00032 case VRML_MaterialLower: 00033 { 00034 Keyword keyword = VrmlNode::GetKeyword( buffer ); 00035 EatWhite( buffer ); 00036 buffer++; 00037 VrmlNode* node = VrmlNode::ParseNode( keyword, buffer ); 00038 this->m_Material = node; 00039 break; 00040 } 00041 case VRML_Texture: 00042 { 00043 EatWhite( buffer ); 00044 buffer = strchr( buffer, '}' ); 00045 buffer++; 00046 break; 00047 } 00048 default: 00049 { 00050 assert( false ); 00051 } 00052 } 00053 EatWhite( buffer ); 00054 } 00055 buffer++; 00056 } 00057 00058 //============================================================================= 00059 // Render 00060 // 00061 // Description: renders the object to the stack 00062 //============================================================================= 00063 void VrmlAppearance::Render( VrmlStack& stack ) const 00064 { 00065 this->m_Material->Render( stack ); 00066 } 00067 00068 //============================================================================= 00069 // RenderOpenGl 00070 // 00071 // Description: renders the object to OpenGl stack 00072 //============================================================================= 00073 void VrmlAppearance::RenderOpenGl( VrmlStack& stack ) const 00074 { 00075 this->m_Material->RenderOpenGl( stack ); 00076 } 00077 00078 //============================================================================= 00079 // RenderToIGS 00080 // 00081 // Description: Renders the object to the IGS subsystem 00082 //============================================================================= 00083 IGS_Object* VrmlAppearance::RenderToIGS( VrmlStack& stack ) const 00084 { 00085 return this->m_Material->RenderToIGS( stack ); 00086 }