Commit 3792f163 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE] reactivated code according to issue #28 in core OpenWalnut

parent 131e15d1
...@@ -30,62 +30,60 @@ ...@@ -30,62 +30,60 @@
#include "core/graphicsEngine/WGraphicsEngine.h" #include "core/graphicsEngine/WGraphicsEngine.h"
#include "WTransparentLinesDrawable.h" #include "WTransparentLinesDrawable.h"
// namespace namespace
// { {
// double depth( osg::Vec3f pos, WPosition viewDir ) double depth( osg::Vec3f pos, WPosition viewDir )
// { {
// WVector3d tmp = pos - WPosition(); WVector3d tmp = pos - WPosition();
// double result = dot( tmp, viewDir ); double result = dot( tmp, viewDir );
// return result; return result;
// } }
// class MySorting class MySorting
// { {
// public: public:
// int operator()( std::pair< double, size_t > p1 , std::pair< double, size_t > p2 ) int operator()( std::pair< double, size_t > p1 , std::pair< double, size_t > p2 )
// { {
// return ( p1.first < p2.first ); return ( p1.first < p2.first );
// } }
// }; };
// } }
void WTransparentLinesDrawable::drawImplementation( osg::RenderInfo &/*renderInfo*/ ) const //NOLINT void WTransparentLinesDrawable::drawImplementation( osg::RenderInfo &renderInfo ) const //NOLINT
{ {
// TODO(wiebel): reactivate this and above if build server has osg100 boost::shared_ptr< WGraphicsEngine > ge = WGraphicsEngine::getGraphicsEngine();
boost::shared_ptr< WGEViewer > viewer; //!< Stores reference to the main viewer
// boost::shared_ptr< WGraphicsEngine > ge = WGraphicsEngine::getGraphicsEngine(); viewer = ge->getViewerByName( "Main View" );
// boost::shared_ptr< WGEViewer > viewer; //!< Stores reference to the main viewer WPosition endPos = WPosition( wge::unprojectFromScreen( osg::Vec3( 0.0, 0.0, 1.0 ), viewer->getCamera() ) );
// viewer = ge->getViewerByName( "Main View" ); WPosition startPos = WPosition( wge::unprojectFromScreen( osg::Vec3(), viewer->getCamera() ) );
// WPosition endPos = WPosition( wge::unprojectFromScreen( osg::Vec3( 0.0, 0.0, 1.0 ), viewer->getCamera() ) ); WPosition viewDir = normalize( endPos - startPos );
// WPosition startPos = WPosition( wge::unprojectFromScreen( osg::Vec3(), viewer->getCamera() ) );
// WPosition viewDir = normalize( endPos - startPos );
// std::vector< std::pair< double, size_t > > depthVals( _vertexArray->getNumElements() ); std::vector< std::pair< double, size_t > > depthVals( _vertexArray->getNumElements() );
// for( size_t i = 0; i < _vertexArray->getNumElements(); i += 2 ) for( size_t i = 0; i < _vertexArray->getNumElements(); i += 2 )
// { {
// double myDepth = -1 * depth( ( *( dynamic_cast< osg::Vec3Array* >( _vertexArray.get() ) ) )[i], viewDir ); double myDepth = -1 * depth( ( *( dynamic_cast< osg::Vec3Array* >( _vertexArray.get() ) ) )[i], viewDir );
// // TODO(wiebel): improve this unidication of values // TODO(wiebel): improve this unidication of values
// depthVals[i] = std::make_pair( myDepth, i ); depthVals[i] = std::make_pair( myDepth, i );
// depthVals[i+1] = std::make_pair( myDepth, i+1 ); depthVals[i+1] = std::make_pair( myDepth, i+1 );
// } }
// std::stable_sort( depthVals.begin(), depthVals.end(), MySorting() ); std::stable_sort( depthVals.begin(), depthVals.end(), MySorting() );
// // osg::ref_ptr< osg::Vec3Array > tmp( new osg::Vec3Array( _vertexArray->getNumElements() ) ); // osg::ref_ptr< osg::Vec3Array > tmp( new osg::Vec3Array( _vertexArray->getNumElements() ) );
// osg::ref_ptr< osg::Vec3Array > oldVec = osg::ref_ptr< osg::Vec3Array > oldVec =
// new osg::Vec3Array( *dynamic_cast<osg::Vec3Array*>( _vertexArray.get() ), osg::CopyOp::DEEP_COPY_ALL ); new osg::Vec3Array( *dynamic_cast<osg::Vec3Array*>( _vertexArray.get() ), osg::CopyOp::DEEP_COPY_ALL );
// osg::Vec3Array* oldVec2 = oldVec.get(); osg::Vec3Array* oldVec2 = oldVec.get();
// osg::Vec3Array* tmpVec = const_cast< osg::Vec3Array* >( ( dynamic_cast< const osg::Vec3Array*>( _vertexArray.get() ) ) ); osg::Vec3Array* tmpVec = const_cast< osg::Vec3Array* >( ( dynamic_cast< const osg::Vec3Array*>( _vertexArray.get() ) ) );
// osg::ref_ptr< osg::Vec3Array > oldTexCoords = osg::ref_ptr< osg::Vec3Array > oldTexCoords =
// new osg::Vec3Array( *dynamic_cast<osg::Vec3Array*>( _texCoordList[0].get() ), osg::CopyOp::DEEP_COPY_ALL ); new osg::Vec3Array( *dynamic_cast<osg::Vec3Array*>( _texCoordList[0].get() ), osg::CopyOp::DEEP_COPY_ALL );
// osg::Vec3Array* oldTexCoords2 = oldTexCoords.get(); osg::Vec3Array* oldTexCoords2 = oldTexCoords.get();
// osg::Vec3Array* tmpTexCoords = const_cast< osg::Vec3Array* >( ( dynamic_cast< const osg::Vec3Array*>( _texCoordList[0].get() ) ) ); osg::Vec3Array* tmpTexCoords = const_cast< osg::Vec3Array* >( ( dynamic_cast< const osg::Vec3Array*>( _texCoordList[0].get() ) ) );
// for( size_t i = 0; i < _vertexArray->getNumElements(); ++i ) for( size_t i = 0; i < _vertexArray->getNumElements(); ++i )
// { {
// ( *tmpTexCoords )[i] = ( *oldTexCoords2 )[ depthVals[i].second ]; ( *tmpTexCoords )[i] = ( *oldTexCoords2 )[ depthVals[i].second ];
// ( *tmpVec )[i] = ( *oldVec2 )[ depthVals[i].second ]; ( *tmpVec )[i] = ( *oldVec2 )[ depthVals[i].second ];
// } }
// osg::Geometry::drawImplementation( renderInfo ); osg::Geometry::drawImplementation( renderInfo );
} }
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