OSGMaterialChunk.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGMATERIALCHUNK_H_
00040 #define _OSGMATERIALCHUNK_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include "OSGMaterialChunkBase.h"
00046 
00047 OSG_BEGIN_NAMESPACE
00048 
00053 class OSG_SYSTEM_DLLMAPPING MaterialChunk : public MaterialChunkBase
00054 {
00055     /*==========================  PUBLIC  =================================*/
00056 
00057   public:
00058 
00059     /*---------------------------------------------------------------------*/
00063     virtual const StateChunkClass *getClass(void) const;
00064 
00066     /*---------------------------------------------------------------------*/
00070     static       UInt32           getStaticClassId(void);
00071     static const StateChunkClass *getStaticClass  (void);
00072 
00074     /*---------------------------------------------------------------------*/
00078     virtual UInt16 getChunkId(void);
00079 
00081     /*---------------------------------------------------------------------*/
00085     virtual void changed(ConstFieldMaskArg whichField,
00086                          UInt32            origin,
00087                          BitVector         details);
00088 
00090     /*---------------------------------------------------------------------*/
00094     virtual void dump(      UInt32    uiIndent = 0,
00095                       const BitVector bvFlags  = 0) const;
00096 
00098     /*---------------------------------------------------------------------*/
00102     virtual void activate     (DrawEnv    *action, 
00103                                UInt32      index = 0);
00104 
00105     virtual void changeFrom   (DrawEnv    *action, 
00106                                StateChunk *old,
00107                                UInt32      index = 0);
00108 
00109     virtual void deactivate   (DrawEnv     *action, 
00110                                UInt32      index = 0);
00111 
00112     virtual bool isTransparent(void                     ) const;
00113 
00115     /*---------------------------------------------------------------------*/
00119     virtual Real32  switchCost(StateChunk *chunk);
00120 
00121     virtual bool operator <  (const StateChunk &other) const;
00122 
00123     virtual bool operator == (const StateChunk &other) const;
00124     virtual bool operator != (const StateChunk &other) const;
00125 
00127     /*=========================  PROTECTED  ===============================*/
00128 
00129   protected:
00130 
00131     UInt16 _uiChunkId;
00132 
00133     /*---------------------------------------------------------------------*/
00137     void onCreate      (const MaterialChunk *source      = NULL);
00138     void onCreateAspect(const MaterialChunk *createAspect,
00139                         const MaterialChunk *source      = NULL);
00140 
00142     /*---------------------------------------------------------------------*/
00146     MaterialChunk(void);
00147     MaterialChunk(const MaterialChunk &source);
00148 
00150     /*---------------------------------------------------------------------*/
00154     virtual ~MaterialChunk(void);
00155 
00157     /*---------------------------------------------------------------------*/
00161     static void initMethod(InitPhase ePhase);
00162 
00165     static volatile UInt16 _uiChunkCounter;
00166 
00167     /*==========================  PRIVATE  ================================*/
00168 
00169   private:
00170 
00171     typedef MaterialChunkBase Inherited;
00172 
00173     friend class FieldContainer;
00174     friend class MaterialChunkBase;
00175 
00176     // class. Used for indexing in State
00177     static StateChunkClass _class;
00178 
00179     // prohibit default functions (move to 'public' if you need one)
00180     void operator =(const MaterialChunk &source);
00181 };
00182 
00183 typedef MaterialChunk              *MaterialChunkP;
00184 
00185 OSG_END_NAMESPACE
00186 
00187 #include "OSGMaterialChunkBase.inl"
00188 #include "OSGMaterialChunk.inl"
00189 
00190 #endif /* _OSGMATERIALCHUNK_H_ */