/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGAppearance_HH_ #define _MGAppearance_HH_ #include #include "mg/MGCL.h" #include "mg/Group.h" #include "mgGL/RenderAttr.h" // //Define MGAppearance Class. class MGOfstream; class MGIfstream; class MGGLAttrib; class MGLight; /** @addtogroup DisplayHandling * @{ */ ///A container class to hold MGGLAttrib objects. ///MGAppearance acts just like as std::auto_ptr. ///That is, MGAppearance holds newed object pointers of MGGLAttrib, ///and when copy constructor or assignment operator is invoked, ///the pointer ownership is transfered to the new MGAppearance object. ///A list of newed MGGLAttrib object pointer will be stored in parent MGGroup. ///No two same leaf type MGGLAttrib objects are included in this list. class MG_DLL_DECLR MGAppearance: public MGAttrib{ public: typedef MGGroup::iterator iterator; typedef MGGroup::const_iterator const_iterator; MGAppearance():m_no_display(false){;}; MGAppearance& operator=(const MGGel& gel2); MGAppearance& operator=(const MGAppearance& gel2); ///comparison bool operator<(const MGAppearance& gel2)const; bool operator<(const MGGel& gel2)const; ////////Member Function//////// std::ostream& out( std::ostream& ostrm )const; MGAttrib* back(){return static_cast(m_glattribs.back());}; const MGAttrib* back()const{return static_cast(m_glattribs.back());}; iterator begin(){return m_glattribs.begin();}; const_iterator begin()const{return m_glattribs.begin();}; void clear(){m_glattribs.clear();}; bool empty()const{return m_glattribs.empty();}; iterator end(){return m_glattribs.end();}; const_iterator end()const{return m_glattribs.end();}; MGAttrib* front(){return static_cast(m_glattribs.front());}; const MGAttrib* front()const{return static_cast(m_glattribs.front());}; void pop_back(){m_glattribs.pop_back();}; void pop_front(){m_glattribs.pop_front();}; int size()const{return m_glattribs.size();}; ///Add a light. light must be a newed object, and the ownership will be ///transfered to this object. ///Function's return value is the number of lights after added. int add_light(MGLight* light); ///Test if this MGAppearance can be removed or not. bool can_be_removed()const; ///Generate copied gel of this gel. ///Returned is a newed object. User must delete the object. MGAppearance* clone()const; ///draw GLAttributes process. void drawAttrib( mgVBO& vbo,///