2 #include "VsMouseSpring.h"
7 namespace Visualization
12 VsMouseSpring::VsMouseSpring(
void)
21 VsMouseSpring::~VsMouseSpring(
void)
25 void VsMouseSpring::Visible(
bool bVal)
28 m_gdeLine->setNodeMask(0x1);
30 m_gdeLine->setNodeMask(0x0);
33 void VsMouseSpring::Initialize()
36 m_linesGeom =
new osg::Geometry();
38 m_aryLines =
new osg::Vec3Array();
40 m_aryLines->push_back(m_v3Start);
41 m_aryLines->push_back(m_v3End);
44 m_linesGeom->setVertexArray(m_aryLines.get());
47 m_linesGeom->addPrimitiveSet(
new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,m_aryLines->size()));
50 osg::Vec4Array* colors =
new osg::Vec4Array;
51 colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
52 colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
53 m_linesGeom->setColorArray(colors);
54 m_linesGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
57 m_linesGeom->setDataVariance(osg::Object::DYNAMIC);
58 m_linesGeom->setUseDisplayList(
false);
60 m_gdeLine =
new osg::Geode();
61 m_gdeLine->addDrawable(m_linesGeom.get());
63 osg::StateSet *ss =
new osg::StateSet();
64 ss->setMode( GL_LIGHTING, osg::StateAttribute::PROTECTED | osg::StateAttribute::OFF );
66 m_lineWidth =
new osg::LineWidth();
67 m_lineWidth->setWidth(1.0f);
68 ss->setAttributeAndModes(m_lineWidth.get(), osg::StateAttribute::ON);
69 ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
70 m_gdeLine->setStateSet(ss);
76 void VsMouseSpring::SetStart(osg::Vec3 v3Start)
82 void VsMouseSpring::SetEnd(osg::Vec3 v3End)
88 void VsMouseSpring::Update()
90 (*m_aryLines)[0].set(m_v3Start);
91 (*m_aryLines)[1].set(m_v3End);
93 m_linesGeom->dirtyBound();
Classes for implementing the cm-labs vortex physics engine for AnimatLab.