VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtOsgOverlayPolygonModelInstance.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2009 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtOsgOverlayPolygonModelInstance.h,v $ $Revision: 1.0 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #pragma once
00014 
00015 #include <vrvOsg/vrvOsg.h>
00016 #include <vrvCore/DtModelInstance.h>
00017 #include <osg/Vec4>
00018 #include <osg/Vec3>
00019 #include <osg/Quat>
00020 #include <vector>
00021 
00022 namespace makVrv
00023 {
00024    class DtPolygon;
00025 
00028    class DT_DLL_VRVOSG DtOsgOverlayPolygonModelInstance
00029       : public DtModelInstance
00030    {
00031    public:
00033       DtOsgOverlayPolygonModelInstance(DtDe& de);
00034 
00036       virtual ~DtOsgOverlayPolygonModelInstance();
00037 
00039       virtual void setModelSet(int);
00040 
00042       virtual void setPosition( int vtx, const DtVector& position );
00043 
00045       virtual void setRotation(const osg::Quat& quat);
00046 
00048       virtual void setOrigin(const DtVector&);
00049 
00051       virtual void addPoint(const DtVector& point,int index);
00052 
00054       virtual void removePoint(int index);
00055 
00057       virtual void set2dOffset(int index, float x, float y);
00058 
00061       virtual void set3dDirection2dLength( int index, float x, float y, float z,
00062          float len );
00063 
00065       virtual void setColor(float r,float g,float b,float a);
00066 
00072       virtual void setTexturePath(const std::string& texturePath);
00073 
00075       virtual void setNumTextureTiles(double numTiles);
00076 
00078       virtual void setStipplePattern(unsigned int stipplePattern);
00079 
00081       virtual void setWidth(float width);
00082 
00084       virtual void setEventWidth(float width);
00085 
00087       virtual void setVisible(bool isVisible);
00088 
00090       virtual void setLockUpdates(bool lock);
00091 
00093       bool updatesLocked() const;
00094 
00096       virtual void setPickable(bool enabled);
00097 
00099       virtual void setEventsEnabled(bool, unsigned long long userData);
00100 
00102       bool eventsEnabled() const;
00103 
00104       virtual void setVisibleViaSwitch(bool isVisible);
00105 
00107       virtual void setFill(bool);
00108 
00110       virtual void setInsideColor( float r, float g, float b, float a );
00111 
00113       virtual void setOutsideColor( float r, float g, float b, float a );
00114 
00115    protected:
00116 
00117       struct VertexData
00118       {
00119          VertexData()
00120          : my3DPos()
00121          {
00122             my2DOffset[0] = 0.0f;
00123             my2DOffset[1] = 0.0f;
00124          }
00125 
00126          osg::Vec3d my3DPos;
00127          osg::Vec3d my3DOffset;
00128          float my2DLength;
00129          float my2DOffset[2];        
00130       };
00131 
00132 
00134       virtual void createPolygonIfNecessary();
00135 
00137       virtual void updateGeometry();
00138 
00140       virtual void updateColors();
00141 
00143       virtual void translateAndUpdateVertex( unsigned int index, const VertexData& vert);
00144       
00145 
00146    protected:
00147 
00148       typedef std::vector<VertexData> VertexList;
00149       VertexList myVertices;
00150       DtPolygon* myPolygon;
00151 
00152       bool myIsLocked;
00153       bool myGeometryIsDirty;
00154       bool myFilled;
00155 
00156       float myWidth;
00157       osg::Vec4 myInnerColor;
00158       osg::Vec4 myOuterColor;
00159       unsigned int myStipplePattern;
00160       int myModelSet;
00161       unsigned long long myUserData;
00162 
00163       bool myEventsEnabled;
00164       bool myGeometryDirty;
00165       bool myLockUpdates;
00166       bool myVisibleFlag;
00167 
00168       osg::Vec3d myOrigin;
00169       osg::Quat myRotation;
00170    };
00171 }

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)