00001 #include <assert.h> 00002 #include <stdio.h> 00003 #include "utility.h" 00004 #include "VrmlGroup.h" 00005 00006 //============================================================================= 00007 // Destructor 00008 // 00009 // Description: Destructor 00010 //============================================================================= 00011 VrmlGroup::~VrmlGroup() 00012 { 00013 } 00014 00015 //============================================================================= 00016 // Parse 00017 // 00018 // Description: parses this node from a buffer 00019 //============================================================================= 00020 void VrmlGroup::Parse( char*& buffer ) 00021 { 00022 while( *buffer != '}' ) 00023 { 00024 Keyword keyword = VrmlNode::GetKeyword( buffer ); 00025 if( keyword == VRML_BboxCenter ) 00026 { 00027 this->m_BboxCenter.Parse( buffer ); 00028 this->m_BboxCenter.SetType( VrmlKeywordBboxCenter ); //IAN IMPROVE: these should automatically set thier name 00029 } 00030 else if( keyword == VRML_BboxSize ) 00031 { 00032 this->m_BboxSize.Parse( buffer ); 00033 this->m_BboxSize.SetType( VrmlKeywordBboxSize ); //IAN IMPROVE: these should automatically set thier name 00034 } 00035 else if( keyword == VRML_Children ) 00036 { 00037 EatWhite( buffer ); 00038 buffer++; 00039 this->m_Children.Parse( buffer ); 00040 } 00041 else 00042 { 00043 printf( "VrmlGroup::Parse - Unknown keyword\n" ); 00044 } 00045 EatWhite( buffer ); 00046 } 00047 //advance past trailing '}' 00048 EatWhite( buffer ); 00049 buffer++; 00050 } 00051 00052 //============================================================================= 00053 // Render 00054 // 00055 // Description: renders this VrmlObject via the VRML renderer 00056 //============================================================================= 00057 void VrmlGroup::Render( VrmlStack& stack ) const 00058 { 00059 this->m_BboxCenter.Render( stack ); 00060 this->m_BboxSize.Render( stack ); 00061 this->m_Children.Render( stack ); 00062 } 00063 00064 //============================================================================= 00065 // RenderToIGS 00066 // 00067 // Description: renders this VrmlObject to the IGS subsystem 00068 //============================================================================= 00069 void VrmlGroup::RenderOpenGl( VrmlStack& stack ) const 00070 { 00071 this->m_BboxCenter.RenderOpenGl( stack ); 00072 this->m_BboxSize.RenderOpenGl( stack ); 00073 this->m_Children.RenderOpenGl( stack ); 00074 } 00075 00076 //============================================================================= 00077 // RenderToIGS 00078 // 00079 // Description: renders this VrmlObject to the IGS subsystem 00080 //============================================================================= 00081 IGS_Object* VrmlGroup::RenderToIGS( VrmlStack& stack ) const 00082 { 00083 this->m_BboxCenter.RenderToIGS( stack ); //this won't return anything 00084 this->m_BboxSize.RenderToIGS( stack ); //this won't return anything either 00085 IGS_Object* object = this->m_Children.RenderToIGS( stack ); 00086 return object; 00087 }