VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtPolygonModelInstance.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2009 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtPolygonModelInstance.h,v $ $Revision: 1.0 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #ifndef DtAttachablePolygonModelInstance_H_
00014 #define DtAttachablePolygonModelInstance_H_
00015 
00016 #include <vrvOsg/vrvOsg.h>
00017 #include <vrvOsg/DtOsgModelInstance.h>
00018 
00019 #include <osg/Geode>
00020 #include <osg/MatrixTransform>
00021 
00022 #include <vector>
00023 
00024 namespace osg
00025 {
00026    class LineWidth;
00027 }
00028 
00029 namespace makVrv
00030 {
00033    class DT_DLL_VRVOSG DtPolygonModelInstance
00034       : public DtOsgModelInstance
00035    {
00036    public:
00037 
00038       struct AttachablePolygonParameters
00039       {
00040          float rColor; // RGBA red value
00041          float gColor; // RGBA green value
00042          float bColor; // RGBA blue value
00043          float aColor; // RGBA alpha value
00044          std::string texturePath; // Path to texture file
00045          double numTextureTiles; // Number of times to tile the texture
00046       };
00047 
00049       static const AttachablePolygonParameters defaultParameters;
00050 
00052       DtPolygonModelInstance(DtDe& de);
00053 
00055       virtual ~DtPolygonModelInstance();
00056 
00058       virtual bool realize( DtModelDefinition& definition );
00059 
00061       virtual void setColor(float r,float g,float b,float a);
00062 
00064       virtual void setPosition( int vtx, const DtVector& position );
00065 
00071       virtual void setTexturePath(const std::string& texturePath);
00072 
00074       virtual void setNumTextureTiles(double numTiles);
00075 
00077       virtual void setOrientation( int vtx, const DtTaitBryan& orientation );
00078 
00080       virtual void  addToConnector( DtOsgSceneConnector* connector );
00081 
00083       virtual bool removeFromConnector( DtOsgSceneConnector* connector );
00084 
00086       virtual void setVisible(bool isVisible) {}
00087 
00089       virtual void addPoint(const DtVector& point,int index);
00090 
00092       virtual void setLockUpdates(bool lock);
00093       bool updatesLocked() const
00094       {
00095          return myIsLocked;
00096       }
00097 
00099       virtual void setPickable(bool enabled);
00100 
00102       virtual void removePoint(int index);
00103 
00105       virtual void setStipplePattern(unsigned int stipplePattern);
00106 
00108       virtual void setWidth(float width);
00109 
00110    protected:
00111 
00113       virtual void buildGeometry(const AttachablePolygonParameters& parameters);
00114 
00116       virtual void buildState(const AttachablePolygonParameters& parameters);
00117 
00118    protected:
00119       osg::ref_ptr<osg::LineWidth> myLineWidth;
00120 
00122       AttachablePolygonParameters myParameters;
00123 
00124       typedef std::vector<osg::Vec3> VertexList;
00125       VertexList myVertices;
00126 
00127       osg::ref_ptr<osg::Geode> myGeode;
00128 
00129       bool myIsLocked;
00130       bool myGeometryIsDirty;
00131       bool myStateIsDirty;
00132    };
00133 }
00134 
00135 #endif
00136 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)