IvfObject.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfObject_h_
00026 #define _CIvfObject_h_
00027 
00028 #include <ivf/IvfBase.h>
00029 #include <ivfmath/IvfBoundingSphere.h>
00030 #include <ivf/IvfRenderState.h>
00031 
00032 #include <ivf/IvfGL.h>
00033 
00034 IvfSmartPointer(CIvfObject);
00035 
00036 static double g_nodeSize = 0.2;
00037 
00046 class IVF_API CIvfObject : public CIvfBase {
00047 public:
00048         enum TObjectState {
00049                 OS_ON,
00050                 OS_OFF
00051         };
00052 
00053         enum TSelectState {
00054                 SS_ON,
00055                 SS_OFF
00056         };
00057 private:
00058         std::string m_objectName;
00059         long m_tag;
00060         TSelectState m_selectState;
00061         TObjectState m_state;
00062         CIvfBoundingSpherePtr m_boundSphere;
00063         GLuint m_displayList;
00064         bool m_useList;
00065         bool m_dynamic;
00066         bool m_useSelectShape;
00067         bool m_culled;
00068         bool m_renderMaterial;
00069         CIvfRenderStatePtr m_renderState;
00070 
00071 public:
00072         bool getRenderMaterial();
00073         void setRenderMaterial(bool flag);
00074         bool isSelectEnabled();
00075         void disableSelect();
00076         void enableSelect();
00077         bool isEnabled();
00078         void disable();
00079         void enable();
00081         CIvfObject ();
00082         
00084         CIvfObject (const CIvfObject&);
00085         
00087         virtual ~CIvfObject ();
00088         CIvfObject& operator = (const CIvfObject &arg);
00089 
00090         IvfClassInfo("CIvfObject",CIvfBase);
00091 
00098         void setTag(long tag);
00099         
00101         long getTag();
00102         
00115         void setSelect(TSelectState selectState);
00116         
00118         TSelectState getSelect();
00119         
00129         void setState(TObjectState state);
00130         
00132         TObjectState getState();
00133         
00134         bool getUseSelectShape();
00135         void setUseSelectShape(bool flag);
00136 
00142         CIvfBoundingSphere* getBoundingSphere();
00143         
00149         void setDisplayList(GLuint nList);
00150         
00156         GLuint getDisplayList();
00157         
00164         void setUselist(bool flag);
00165         
00167         bool getUselist();
00168         
00185         virtual void    render ();
00186 
00194         void initBoundingSphere();
00195 
00205         virtual void updateBoundingSphere();
00206 
00213         void setCulled(bool flag);
00214 
00216         bool getCulled();
00217 
00219         const char* getName();
00220 
00222         void setName(const char* name);
00223 
00233         void setRenderState(CIvfRenderState* state);
00234 
00236         CIvfRenderState* getRenderState();
00237 
00238 protected:
00239         virtual void preGeometry();
00240         virtual void postGeometry();
00241 
00247         virtual void compileList();
00248         
00255         virtual void createSelect();
00256 
00265         virtual void createGeometry ();
00266 
00275         virtual void createMaterial ();
00276 
00285         virtual void beginTransform ();
00286 
00294         virtual void endTransform ();
00295 
00296 };
00297 #endif

Generated on Fri Sep 1 15:36:45 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO