VR-Forces 4.0.4 Class Documentation
include/vrvOsg/Dt3DLineModelInstanceSegment.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2012 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 
00009 
00010 #ifndef DtAttachableLineModelInstanceSegment_H_
00011 #define DtAttachableLineModelInstanceSegment_H_
00012 
00013 #include <vrvOsg/vrvOsg.h>
00014 #include <vrvOsg/Dt3DLineModelInstanceSegmentInterface.h>
00015 
00016 #include <osg/Billboard>
00017 #include <osg/MatrixTransform>
00018 
00019 namespace makVrv
00020 {
00024    class DT_DLL_VRVOSG Dt3DLineModelInstanceSegment 
00025       : public Dt3DLineModelInstanceSegmentInterface
00026    {
00027    public:
00029       Dt3DLineModelInstanceSegment();
00030 
00032       ~Dt3DLineModelInstanceSegment();
00033 
00035       virtual void setStartPoint(const osg::Vec3d& startPoint);
00036 
00038       virtual void setEndPoint(const osg::Vec3d& endPoint);
00039 
00040       const osg::Vec3d& startPoint() const
00041       {
00042          return myState.startPoint;
00043       }
00044 
00045       const osg::Vec3d& endPoint() const
00046       {
00047          return myState.endPoint;
00048       }
00049 
00051       virtual void setColor(const osg::Vec4& color);
00052 
00054       virtual void setVertexColor( unsigned int vertexIndex, const osg::Vec4& color );
00055 
00057       virtual void setStartArrow(bool arrowEnabled);
00058 
00060       virtual void setEndArrow(bool arrowEnabled);
00061 
00063       virtual void setLightningStyle(bool lightningStyle);
00064 
00066       virtual void setWidth(double width);
00067 
00069       virtual double width() const;
00070 
00072       virtual void setStipplePattern(unsigned int stipplePattern, int repeatFactor);
00073 
00075       virtual osg::Node* rootNode();
00076 
00077       const std::vector<osg::Vec3>& pickableVertices() const;
00078 
00080       virtual void update();
00081 
00083       virtual void updateGeometry();
00084 
00085    protected:
00086 
00088       virtual void build();
00089 
00093       virtual void calculateArrowVertices(
00094          const osg::Vec3d& segmentStart, const osg::Vec3d& segmentEnd,
00095          osg::Vec3d& arrowStartOut, osg::Vec3d& arrowEndOut);
00096 
00098       virtual void buildVertices();
00099 
00101       virtual void buildLinePrimitive();
00102 
00104       virtual void buildPickableVertices();
00105 
00107       virtual void buildColorArray();
00108 
00112       virtual unsigned int startArrowVertexIndex();
00113 
00117       virtual unsigned int endArrowVertexIndex();
00118 
00122       virtual unsigned int lightningVertexIndex();
00123 
00124    protected:
00125 
00127       struct LineSegmentState
00128       {
00129          osg::Vec3d startPoint;
00130          osg::Vec3d endPoint;
00131          osg::Vec4 color[2];
00132          bool startArrow;
00133          bool endArrow;
00134          bool lightning;
00135          double width;
00136          unsigned int stipplePattern;
00137       };
00138 
00139       LineSegmentState myState;
00140 
00141       bool myGeometryDirty;
00142 
00143       osg::ref_ptr<osg::Billboard> myGeode;
00144       osg::ref_ptr<osg::Geometry> myGeometry;
00145       osg::ref_ptr<osg::Vec3Array> myPickableVertices;
00146    };
00147 }
00148 
00149 #endif
00150 

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)