Commit dc7721c8 authored by Alexander Wiebel's avatar Alexander Wiebel

[CLEAN #382] removed wge::osgVec3

parent 981f4313
......@@ -174,8 +174,8 @@ osg::ref_ptr< osg::Node > wge::generateSolidBoundingBoxNode( const wmath::WPosit
// transform the cube to match the bbox
osg::Matrixd transformM;
osg::Matrixd scaleM;
transformM.makeTranslate( wge::osgVec3( pos1 ) );
scaleM.makeScale( wge::osgVec3( pos2 - pos1 ) );
transformM.makeTranslate( pos1 );
scaleM.makeScale( pos2 - pos1 );
// apply transformation to bbox
osg::ref_ptr< osg::MatrixTransform > transform = new osg::MatrixTransform();
......@@ -303,10 +303,10 @@ osg::ref_ptr< osg::Geode > wge::genFinitePlane( double xSize, double ySize, cons
colors->push_back( wge::osgColor( color ) );
vertices->push_back( osgVec3( p.getPointInPlane( xSize, ySize ) ) );
vertices->push_back( osgVec3( p.getPointInPlane( -xSize, ySize ) ) );
vertices->push_back( osgVec3( p.getPointInPlane( -xSize, -ySize ) ) );
vertices->push_back( osgVec3( p.getPointInPlane( xSize, -ySize ) ) );
vertices->push_back( p.getPointInPlane( xSize, ySize ) );
vertices->push_back( p.getPointInPlane( -xSize, ySize ) );
vertices->push_back( p.getPointInPlane( -xSize, -ySize ) );
vertices->push_back( p.getPointInPlane( xSize, -ySize ) );
geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, 4 ) );
geometry->setVertexArray( vertices );
......
......@@ -40,35 +40,35 @@ osg::ref_ptr< osg::Vec3Array > wge::generateCuboidQuads( const std::vector< wmat
osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
// Surfaces
vertices->push_back( wge::osgVec3( corners[0] ) );
vertices->push_back( wge::osgVec3( corners[1] ) );
vertices->push_back( wge::osgVec3( corners[2] ) );
vertices->push_back( wge::osgVec3( corners[3] ) );
vertices->push_back( wge::osgVec3( corners[1] ) );
vertices->push_back( wge::osgVec3( corners[5] ) );
vertices->push_back( wge::osgVec3( corners[6] ) );
vertices->push_back( wge::osgVec3( corners[2] ) );
vertices->push_back( wge::osgVec3( corners[5] ) );
vertices->push_back( wge::osgVec3( corners[4] ) );
vertices->push_back( wge::osgVec3( corners[7] ) );
vertices->push_back( wge::osgVec3( corners[6] ) );
vertices->push_back( wge::osgVec3( corners[4] ) );
vertices->push_back( wge::osgVec3( corners[0] ) );
vertices->push_back( wge::osgVec3( corners[3] ) );
vertices->push_back( wge::osgVec3( corners[7] ) );
vertices->push_back( wge::osgVec3( corners[3] ) );
vertices->push_back( wge::osgVec3( corners[2] ) );
vertices->push_back( wge::osgVec3( corners[6] ) );
vertices->push_back( wge::osgVec3( corners[7] ) );
vertices->push_back( wge::osgVec3( corners[0] ) );
vertices->push_back( wge::osgVec3( corners[1] ) );
vertices->push_back( wge::osgVec3( corners[5] ) );
vertices->push_back( wge::osgVec3( corners[4] ) );
vertices->push_back( corners[0] );
vertices->push_back( corners[1] );
vertices->push_back( corners[2] );
vertices->push_back( corners[3] );
vertices->push_back( corners[1] );
vertices->push_back( corners[5] );
vertices->push_back( corners[6] );
vertices->push_back( corners[2] );
vertices->push_back( corners[5] );
vertices->push_back( corners[4] );
vertices->push_back( corners[7] );
vertices->push_back( corners[6] );
vertices->push_back( corners[4] );
vertices->push_back( corners[0] );
vertices->push_back( corners[3] );
vertices->push_back( corners[7] );
vertices->push_back( corners[3] );
vertices->push_back( corners[2] );
vertices->push_back( corners[6] );
vertices->push_back( corners[7] );
vertices->push_back( corners[0] );
vertices->push_back( corners[1] );
vertices->push_back( corners[5] );
vertices->push_back( corners[4] );
return vertices;
}
......@@ -80,7 +80,7 @@ osg::Vec3 wge::getQuadNormal( const wmath::WPosition& a,
wmath::WPosition vec2 = c - b;
wmath::WPosition normal = vec2.crossProduct( vec1 );
normal.normalize();
return wge::osgVec3( normal );
return normal;
}
osg::ref_ptr< osg::Vec3Array > wge::generateCuboidQuadNormals( const std::vector< wmath::WPosition >& corners )
......
......@@ -37,7 +37,7 @@ osg::ref_ptr< osg::Vec3Array > wge::osgVec3Array( const std::vector< wmath::WPos
std::vector< wmath::WPosition >::const_iterator cit;
for( cit = posArray.begin(); cit != posArray.end(); ++cit )
{
result->push_back( wge::osgVec3( *cit ) );
result->push_back( *cit );
}
return result;
}
......
......@@ -62,15 +62,6 @@ namespace wge
*/
osg::Vec4 osgColor( const WColor& color );
/**
* Converts a given WPosition into an osg::Vec3.
*
* \param pos The WPosition which should be converted
*
* \return The osg::Vec3 vector of pos
*/
osg::Vec3 osgVec3( const wmath::WPosition& pos );
/**
* Converts a whole vector of WPositions into an osg::Vec3Array.
*
......@@ -169,11 +160,6 @@ inline osg::Vec4 wge::osgColor( const WColor& color )
return osg::Vec4( color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() );
}
inline osg::Vec3 wge::osgVec3( const wmath::WPosition& pos )
{
return osg::Vec3( pos[0], pos[1], pos[2] );
}
inline osg::Matrixd wge::toOSGMatrix( const wmath::WMatrix<double>& matrix )
{
WAssert( ( matrix.getNbRows() == 3 || matrix.getNbRows() == 4 ) && ( matrix.getNbCols() == 3 || matrix.getNbCols() == 4 ),
......
......@@ -307,7 +307,7 @@ void WMEffectiveConnectivityCluster::moduleMain()
{
osg::ref_ptr< WGELabel > label1 = new WGELabel();
label1->setText( voi1 );
label1->setAnchor( wge::osgVec3( m_labelPos1 ) ); // the position relative to the current world coordinate system
label1->setAnchor( m_labelPos1 ); // the position relative to the current world coordinate system
label1->setCharacterSize( m_labelCharacterSize->get( true ) );
layouter->addLayoutable( label1 );
}
......@@ -316,7 +316,7 @@ void WMEffectiveConnectivityCluster::moduleMain()
{
osg::ref_ptr< WGELabel > label2 = new WGELabel();
label2->setText( voi2 );
label2->setAnchor( wge::osgVec3( m_labelPos2 ) ); // the position relative to the current world coordinate system
label2->setAnchor( m_labelPos2 ); // the position relative to the current world coordinate system
label2->setCharacterSize( m_labelCharacterSize->get( true ) );
layouter->addLayoutable( label2 );
}
......
......@@ -662,7 +662,7 @@ void WMTemplate::TranslateCallback::operator()( osg::Node* node, osg::NodeVisito
osg::ref_ptr< osg::MatrixTransform > transform = static_cast< osg::MatrixTransform* >( node );
// Build a translation matrix (to comfortably convert between WPosition and osg::Vec3 use the convenience methods in "wge::" namespace)
osg::Matrixd translate = osg::Matrixd::translate( wge::osgVec3( m_module->m_aPosition->get( true ) ) );
osg::Matrixd translate = osg::Matrixd::translate( m_module->m_aPosition->get( true ) );
// and set the translation matrix
transform->setMatrix( translate );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment