IvfShape.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 _CIvfShape_h_
00026 #define _CIvfShape_h_
00027 
00028 #include <ivf/IvfObject.h>
00029 #include <ivf/IvfMaterial.h>
00030 #include <ivf/IvfTexture.h>
00031 
00032 #include <ivfmath/IvfPoint3d.h>
00033 #include <ivfmath/IvfVec3d.h>
00034 #include <ivfmath/IvfQuat.h>
00035 
00036 IvfSmartPointer(CIvfShape);
00037 
00038 #define IVF_NONAME                      9999
00039 #define IVF_NO_ENUM         9998
00040 
00041 // Modified JL
00042 
00055 class IVF_API CIvfShape : public CIvfObject {
00056 public:
00057         enum THighlightState {
00058                 HS_ON,
00059                 HS_OFF
00060         };
00061         enum THighlightType {
00062                 HT_MATERIAL,
00063                 HT_LIGHTEN
00064         };
00065 public:
00066         bool isEnabledHighlight();
00067         void disableHighlight();
00068         void enableHighlight();
00069         void setHighlightType(THighlightType type);
00071         CIvfShape ();
00072 
00074         virtual ~CIvfShape ();
00075 
00076         IvfClassInfo("CIvfShape",CIvfObject);
00077 
00079         virtual void refresh();
00080 
00093         virtual void setHighlight(THighlightState state);
00094 
00096         THighlightState getHighlight();
00097 
00106         void setUseName(bool flag);
00107 
00109         bool getUseName();
00110 
00117         void setObjectName(GLuint name);
00118 
00120         GLuint getObjectName();
00121 
00126         void assignPointTo(CIvfPoint3d* point);
00127 
00133         void assignPositionTo(CIvfShape* shape);
00134 
00145         void setHighlightMaterial(CIvfMaterial* material);
00146         
00148         CIvfMaterial* getHightlightMaterial();
00149 
00160         void setMaterial (CIvfMaterial* material);
00161 
00163         virtual CIvfMaterial* getMaterial ();
00164         
00175         void setTexture(CIvfTexture* texture);
00176 
00178         CIvfTexture* getTexture();
00179 
00190         void setRotationQuat(double vx, double vy, double vz, double theta);
00191 
00193         void setRotation(CIvfQuat& q);
00194 
00196         void getRotationQuat(double &vx, double &vy, double &vz, double &theta);
00197 
00199         void setRotation (const double xRot, const double yRot, const double zRot);
00200         
00202         void getRotation (double &xRot, double &yRot, double &zRot);
00203         
00212         virtual void setPosition (const double x, const double y, const double z);
00213 
00220         virtual void setPosition (CIvfShape* shape);
00221         
00228         virtual void setPosition (CIvfPoint3d* point);
00229 
00236         virtual void setPosition(CIvfPoint3d& pos);
00237 
00244         virtual void setPosition(CIvfVec3d& pos);
00245 
00247         virtual void getPosition (double &x, double &y, double &z);
00248 
00250         virtual void getPosition (CIvfShape* shape);
00251 
00253         virtual void getPosition (CIvfPoint3d* point);
00254 
00256         virtual CIvfVec3d& getPosition();
00257 
00266         void setScale (const double xScale, const double yScale, const double zScale);
00267         
00269         void getScale (double &xScale, double &yScale, double &zScale);
00270 
00272         void setSelectMaterial(CIvfMaterial* material);
00273 
00275         void setNormalize(bool flag);
00276         
00277         // Dynamic methods beta
00278 
00279 private:
00280         bool m_renderName;
00281         int m_selectState;
00282         THighlightState m_highlight;
00283         THighlightType  m_highlightType;
00284         CIvfMaterialPtr m_highlightMaterial;
00285         CIvfMaterialPtr m_selectMaterial;
00286         GLuint m_objectName;
00287         double  m_position[3];
00288         double  m_scale[3];
00289         double  m_rotation[3];
00290         double  m_rotQuat[4];
00291         CIvfMaterialPtr m_material;
00292         CIvfTexturePtr    m_texture;
00293         bool m_normalize;
00294 protected:
00296         virtual void createGeometry();
00297         virtual void createSelect();
00298         virtual void endTransform();
00299         virtual void beginTransform();
00300         virtual void createMaterial();
00301 };
00302 #endif

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