Commit e3f9f4d5 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[FIX #195] Now common should not be longer dependent on OSG

parent d0a73b2a
......@@ -86,11 +86,6 @@ float WColor::getAlpha() const
return m_alpha;
}
osg::Vec4 WColor::getOSGColor() const
{
return osg::Vec4( m_red, m_green, m_blue, m_alpha );
}
void WColor::setRGB( double r, double g, double b )
{
setRed( r );
......
......@@ -87,11 +87,6 @@ public:
*/
float getAlpha() const;
/**
* Makes a OSG compatible copy of this.
*/
osg::Vec4 getOSGColor() const;
/**
* Reset this color via a given HSV color.
*/
......
......@@ -23,23 +23,22 @@
//---------------------------------------------------------------------------
#include <iostream>
#include <list>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/thread/locks.hpp>
#include <osgViewer/Viewer>
#include <osg/Vec4>
#include <osgViewer/CompositeViewer>
#include <osgViewer/View>
#include <osgViewer/Viewer>
#include "exceptions/WGEInitFailed.h"
#include "../common/WLogger.h"
#include "../common/WColor.h"
#include "WGraphicsEngine.h"
#include "../common/WLogger.h"
#include "WGEViewer.h"
#include "WGraphicsEngine.h"
#include "exceptions/WGEInitFailed.h"
WGraphicsEngine::WGraphicsEngine():
WThreadedRunner()
......@@ -145,3 +144,7 @@ void WGraphicsEngine::notifyStop()
m_Viewer->setDone( true );
}
osg::Vec4 wge::osgColor( const WColor& color )
{
return osg::Vec4( color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha() );
}
......@@ -28,22 +28,21 @@
#include <map>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <osg/Camera>
#include <osg/Texture3D>
#include <osgViewer/Viewer>
#include <osg/Vec4>
#include <osgViewer/CompositeViewer>
#include <osgViewer/View>
#include <osgViewer/Viewer>
#include "WGEScene.h"
#include "../common/WThreadedRunner.h"
#include "WGEGraphicsWindow.h"
#include "WGEScene.h"
#include "WGEViewer.h"
#include "../common/WThreadedRunner.h"
/**
* Base class for initializing the graphics engine. This Class also serves as adaptor to access the graphics
......@@ -162,5 +161,19 @@ private:
* This module implements the graphics engine for OpenWalnut.
*/
/**
* Convinient functions for use with the graphics engine of OpenWalnut.
*/
namespace wge
{
/**
* Converts a WColor to an OSG compatible color
*
*\param color The color in WColor format
*\return A color which may be used inside of OSG
*/
osg::Vec4 osgColor( const WColor& color );
} // end of namespace
#endif // WGRAPHICSENGINE_H
......@@ -33,21 +33,22 @@
#include <osg/Geode>
#include <osg/Geometry>
#include "../../common/datastructures/WDXtLookUpTable.h"
#include "../../common/datastructures/WFiberCluster.h"
#include "../../common/WColor.h"
#include "../../common/WLogger.h"
#include "../../common/WStatusReport.h"
#include "../../common/WStringUtils.hpp"
#include "../../dataHandler/io/WIOTools.hpp"
#include "../../dataHandler/io/WReaderLookUpTableVTK.h"
#include "../../dataHandler/io/WWriterLookUpTableVTK.h"
#include "../../common/datastructures/WDXtLookUpTable.h"
#include "../../common/datastructures/WFiberCluster.h"
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WDataSetFibers.h"
#include "../../dataHandler/WSubject.h"
#include "../../dataHandler/io/WIOTools.hpp"
#include "../../dataHandler/io/WReaderLookUpTableVTK.h"
#include "../../dataHandler/io/WWriterLookUpTableVTK.h"
#include "../../graphicsEngine/WGraphicsEngine.h"
#include "../../kernel/WKernel.h"
#include "../../math/fiberSimilarity/WDLTMetric.h"
#include "../../math/WFiber.h"
#include "../../math/fiberSimilarity/WDLTMetric.h"
#include "../../utils/WColorUtils.h"
#include "WMFiberClustering.h"
......@@ -245,7 +246,7 @@ osg::ref_ptr< osg::Geode > WMFiberClustering::genFiberGeode( const WFiberCluster
geometry->setVertexArray( vertices );
ref_ptr< osg::Vec4Array > colors = ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
colors->push_back( cluster.getColor().getOSGColor() );
colors->push_back( wge::osgColor( cluster.getColor() ) );
geometry->setColorArray( colors );
geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
......
......@@ -34,6 +34,7 @@
#include "../../dataHandler/WDataHandler.h"
#include "../../dataHandler/WDataSetFibers.h"
#include "../../dataHandler/WSubject.h"
#include "../../graphicsEngine/WGraphicsEngine.h"
#include "../../kernel/WKernel.h"
#include "../../math/WFiber.h"
#include "../../utils/WColorUtils.h"
......@@ -80,7 +81,7 @@ osg::ref_ptr< osg::Geode > WMFiberDisplay::genFiberGeode( boost::shared_ptr< con
{
c = color_utils::getRGBAColorFromDirection( fib[0], fib[ fib.size() -1 ] );
}
colors->push_back( c.getOSGColor() );
colors->push_back( wge::osgColor( c ) );
}
colors->push_back( colors->back() );
geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINE_STRIP, vertexNum - fib.size(), fib.size() ) );
......
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