Commit 5f7ee1e8 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[FIX #297] this fixes compilation issues on OSG 3.2. The semantic issues still...

[FIX #297] this fixes compilation issues on OSG 3.2. The semantic issues still exist. It just compiles now.
parent 62fb3f82
This diff is collapsed.
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
#include "WGEUtils.h" #include "WGEUtils.h"
#include "WTriangleMesh.h" #include "WTriangleMesh.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
namespace wge namespace wge
{ {
/** /**
...@@ -72,26 +75,26 @@ namespace wge ...@@ -72,26 +75,26 @@ namespace wge
osg::ref_ptr< osg::Node > generateSolidBoundingBoxNode( const WBoundingBox& bb, const WColor& color, bool threeDTexCoords = true ); osg::ref_ptr< osg::Node > generateSolidBoundingBoxNode( const WBoundingBox& bb, const WColor& color, bool threeDTexCoords = true );
/** /**
* Creates a osg::Geometry containing an unit cube, having 3D texture coordinates. * Creates a wosg::Geometry containing an unit cube, having 3D texture coordinates.
* *
* \param color the color to set for all vertices * \param color the color to set for all vertices
* *
* \return the geometry * \return the geometry
*/ */
osg::ref_ptr< osg::Geometry > createUnitCube( const WColor& color ); osg::ref_ptr< wosg::Geometry > createUnitCube( const WColor& color );
/** /**
* Creates a osg::Geometry containing an unit cube as line-strips, having 3D texture coordinates. * Creates a wosg::Geometry containing an unit cube as line-strips, having 3D texture coordinates.
* *
* \param color the color to set for all vertices * \param color the color to set for all vertices
* *
* \return the geometry * \return the geometry
*/ */
osg::ref_ptr< osg::Geometry > createUnitCubeAsLines( const WColor& color ); osg::ref_ptr< wosg::Geometry > createUnitCubeAsLines( const WColor& color );
/** /**
* Extract the vertices and triangles from a WTriangleMesh and save them * Extract the vertices and triangles from a WTriangleMesh and save them
* into an osg::Geometry. It can use the normals and per-vertex colors of the mesh. * into an wosg::Geometry. It can use the normals and per-vertex colors of the mesh.
* *
* \param mesh the WTriangleMesh used as input * \param mesh the WTriangleMesh used as input
* \param includeNormals When true, calculate the vertex normals and include * \param includeNormals When true, calculate the vertex normals and include
...@@ -99,10 +102,10 @@ namespace wge ...@@ -99,10 +102,10 @@ namespace wge
* \param defaultColor This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh. * \param defaultColor This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh.
* \param lighting if true, a standard lighting is activated for this geometry * \param lighting if true, a standard lighting is activated for this geometry
* \param useMeshColor if true, the mesh color is used. If false, the defaultColor is used. * \param useMeshColor if true, the mesh color is used. If false, the defaultColor is used.
* \return an osg::Geometry containing the mesh * \return an wosg::Geometry containing the mesh
* \note mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays * \note mesh cannot be const since wosg::Geometry needs non-const pointers to the contained arrays
*/ */
osg::ref_ptr< osg::Geometry > convertToOsgGeometry( WTriangleMesh::SPtr mesh, osg::ref_ptr< wosg::Geometry > convertToOsgGeometry( WTriangleMesh::SPtr mesh,
const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ), const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
bool includeNormals = false, bool includeNormals = false,
bool lighting = false, bool lighting = false,
...@@ -110,7 +113,7 @@ namespace wge ...@@ -110,7 +113,7 @@ namespace wge
/** /**
* Extract the vertices and triangles from a WTriangleMesh and save them * Extract the vertices and triangles from a WTriangleMesh and save them
* into an osg::Geometry. It can use the normals and per-vertex colors of the mesh. * into an wosg::Geometry. It can use the normals and per-vertex colors of the mesh.
* This method additionally uses the specified vertexID-color map to provide additional coloring. * This method additionally uses the specified vertexID-color map to provide additional coloring.
* *
* \param mesh the WTriangleMesh used as input * \param mesh the WTriangleMesh used as input
...@@ -119,10 +122,10 @@ namespace wge ...@@ -119,10 +122,10 @@ namespace wge
* them into the geometry. * them into the geometry.
* \param defaultColor This color is used in case the colorMap does not provide a color for a vertex * \param defaultColor This color is used in case the colorMap does not provide a color for a vertex
* \param lighting if true, a standard lighting is activated for this geometry* * \param lighting if true, a standard lighting is activated for this geometry*
* \return an osg::Geometry containing the mesh * \return an wosg::Geometry containing the mesh
* \note mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays * \note mesh cannot be const since wosg::Geometry needs non-const pointers to the contained arrays
*/ */
osg::ref_ptr< osg::Geometry > convertToOsgGeometry( WTriangleMesh::SPtr mesh, const WColoredVertices& colorMap, osg::ref_ptr< wosg::Geometry > convertToOsgGeometry( WTriangleMesh::SPtr mesh, const WColoredVertices& colorMap,
const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ), const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
bool includeNormals = false, bool includeNormals = false,
bool lighting = false bool lighting = false
...@@ -135,9 +138,9 @@ namespace wge ...@@ -135,9 +138,9 @@ namespace wge
* \param defaultColor This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh. * \param defaultColor This color is used in case the useMeshColor parameter is false or no colors are defined in the mesh.
* \param useMeshColor If true, the mesh color is used. If false, the defaultColor is used. * \param useMeshColor If true, the mesh color is used. If false, the defaultColor is used.
* *
* \return an osg::Geometry containing the mesh as lines * \return an wosg::Geometry containing the mesh as lines
*/ */
osg::ref_ptr< osg::Geometry > convertToOsgGeometryLines( WTriangleMesh::SPtr mesh, osg::ref_ptr< wosg::Geometry > convertToOsgGeometryLines( WTriangleMesh::SPtr mesh,
const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ), const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
bool useMeshColor = true ); bool useMeshColor = true );
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#include <osg/TexEnv> #include <osg/TexEnv>
#include <osgText/Text> #include <osgText/Text>
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "../common/WPathHelper.h" #include "../common/WPathHelper.h"
#include "WGETextureHud.h" #include "WGETextureHud.h"
...@@ -186,7 +189,7 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur ...@@ -186,7 +189,7 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur
osg::Geode* geode = new osg::Geode(); osg::Geode* geode = new osg::Geode();
// Set up geometry for the HUD and add it to the HUD // Set up geometry for the HUD and add it to the HUD
osg::ref_ptr< osg::Geometry > HUDBackgroundGeometry = new osg::Geometry(); osg::ref_ptr< wosg::Geometry > HUDBackgroundGeometry = new wosg::Geometry();
osg::ref_ptr< osg::Vec3Array > HUDBackgroundVertices = new osg::Vec3Array; osg::ref_ptr< osg::Vec3Array > HUDBackgroundVertices = new osg::Vec3Array;
HUDBackgroundVertices->push_back( osg::Vec3( 0, 0, -1 ) ); HUDBackgroundVertices->push_back( osg::Vec3( 0, 0, -1 ) );
...@@ -212,12 +215,12 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur ...@@ -212,12 +215,12 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur
osg::ref_ptr< osg::Vec3Array > HUDnormals = new osg::Vec3Array; osg::ref_ptr< osg::Vec3Array > HUDnormals = new osg::Vec3Array;
HUDnormals->push_back( osg::Vec3( 0.0f, 0.0f, 1.0f ) ); HUDnormals->push_back( osg::Vec3( 0.0f, 0.0f, 1.0f ) );
HUDBackgroundGeometry->setNormalArray( HUDnormals ); HUDBackgroundGeometry->setNormalArray( HUDnormals );
HUDBackgroundGeometry->setNormalBinding( osg::Geometry::BIND_OVERALL ); HUDBackgroundGeometry->setNormalBinding( wosg::Geometry::BIND_OVERALL );
HUDBackgroundGeometry->addPrimitiveSet( HUDBackgroundIndices ); HUDBackgroundGeometry->addPrimitiveSet( HUDBackgroundIndices );
HUDBackgroundGeometry->setVertexArray( HUDBackgroundVertices ); HUDBackgroundGeometry->setVertexArray( HUDBackgroundVertices );
HUDBackgroundGeometry->setColorArray( HUDcolors ); HUDBackgroundGeometry->setColorArray( HUDcolors );
HUDBackgroundGeometry->setTexCoordArray( 0, HUDBackgroundTex ); HUDBackgroundGeometry->setTexCoordArray( 0, HUDBackgroundTex );
HUDBackgroundGeometry->setColorBinding( osg::Geometry::BIND_OVERALL ); HUDBackgroundGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
geode->addDrawable( HUDBackgroundGeometry ); geode->addDrawable( HUDBackgroundGeometry );
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "osg/Version"
// Since OSG 3.2, OpenSceneGraph has changed several things in their Geometry class. For compilation compatibility, they provide
// deprecated_osg::Geometry. It was introduces somewhere in between 3.0 and 3.2. As I do not know where exactly, we only differentiate between
// 3.2 and earlier.
#if OSG_VERSION_GREATER_OR_EQUAL( 3, 2, 0 )
#define wosg deprecated_osg
#else
#define wosg osg
#endif
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#include "callbacks/WGEFunctorCallback.h" #include "callbacks/WGEFunctorCallback.h"
#include "WGraphicsEngine.h" #include "WGraphicsEngine.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WROIArbitrary.h" #include "WROIArbitrary.h"
WROIArbitrary::WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ, WROIArbitrary::WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ,
...@@ -155,7 +158,7 @@ void WROIArbitrary::updateGFX() ...@@ -155,7 +158,7 @@ void WROIArbitrary::updateGFX()
&m_vals, &m_vals,
m_threshold->get() ); m_threshold->get() );
osg::Geometry* surfaceGeometry = new osg::Geometry(); wosg::Geometry* surfaceGeometry = new wosg::Geometry();
setName( "roi" ); setName( "roi" );
surfaceGeometry->setVertexArray( m_triMesh->getVertexArray() ); surfaceGeometry->setVertexArray( m_triMesh->getVertexArray() );
...@@ -165,14 +168,14 @@ void WROIArbitrary::updateGFX() ...@@ -165,14 +168,14 @@ void WROIArbitrary::updateGFX()
// FIXME: OSG 3.2 no longer supports binding per primitive. I did not find any evidence that the marching lego Algorithm calculated any // FIXME: OSG 3.2 no longer supports binding per primitive. I did not find any evidence that the marching lego Algorithm calculated any
// normals. So the code is disabled. // normals. So the code is disabled.
// surfaceGeometry->setNormalArray( m_triMesh->getTriangleNormalArray() ); // surfaceGeometry->setNormalArray( m_triMesh->getTriangleNormalArray() );
// surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE ); // surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_PRIMITIVE );
// ------------------------------------------------ // ------------------------------------------------
// colors // colors
osg::Vec4Array* colors = new osg::Vec4Array; osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back( m_color ); colors->push_back( m_color );
surfaceGeometry->setColorArray( colors ); surfaceGeometry->setColorArray( colors );
surfaceGeometry->setColorBinding( osg::Geometry::BIND_OVERALL ); surfaceGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
osg::DrawElementsUInt* surfaceElement = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 ); osg::DrawElementsUInt* surfaceElement = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 );
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include "WGraphicsEngine.h" #include "WGraphicsEngine.h"
#include "WGEUtils.h" #include "WGEUtils.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
size_t WROIBox::maxBoxId = 0; size_t WROIBox::maxBoxId = 0;
void buildFacesFromPoints( osg::DrawElementsUInt* surfaceElements ) void buildFacesFromPoints( osg::DrawElementsUInt* surfaceElements )
...@@ -148,7 +151,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) : ...@@ -148,7 +151,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) :
m_pickHandler = m_viewer->getPickHandler(); m_pickHandler = m_viewer->getPickHandler();
m_pickHandler->getPickSignal()->connect( boost::bind( &WROIBox::registerRedrawRequest, this, _1 ) ); m_pickHandler->getPickSignal()->connect( boost::bind( &WROIBox::registerRedrawRequest, this, _1 ) );
m_surfaceGeometry = osg::ref_ptr<osg::Geometry>( new osg::Geometry() ); m_surfaceGeometry = osg::ref_ptr<wosg::Geometry>( new wosg::Geometry() );
m_surfaceGeometry->setDataVariance( osg::Object::DYNAMIC ); m_surfaceGeometry->setDataVariance( osg::Object::DYNAMIC );
std::stringstream ss; std::stringstream ss;
...@@ -185,7 +188,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) : ...@@ -185,7 +188,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) :
colors->push_back( osg::Vec4( 0.0f, 0.0f, 1.0f, 0.5f ) ); colors->push_back( osg::Vec4( 0.0f, 0.0f, 1.0f, 0.5f ) );
m_surfaceGeometry->setColorArray( colors ); m_surfaceGeometry->setColorArray( colors );
m_surfaceGeometry->setColorBinding( osg::Geometry::BIND_OVERALL ); m_surfaceGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
osg::ref_ptr< osg::LightModel > lightModel = new osg::LightModel(); osg::ref_ptr< osg::LightModel > lightModel = new osg::LightModel();
lightModel->setTwoSided( true ); lightModel->setTwoSided( true );
...@@ -199,7 +202,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) : ...@@ -199,7 +202,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) :
osg::ref_ptr<osg::Vec3Array> normals = osg::ref_ptr<osg::Vec3Array>( new osg::Vec3Array ); osg::ref_ptr<osg::Vec3Array> normals = osg::ref_ptr<osg::Vec3Array>( new osg::Vec3Array );
setNormals( normals ); setNormals( normals );
m_surfaceGeometry->setNormalArray( normals ); m_surfaceGeometry->setNormalArray( normals );
//m_surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE ); //m_surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_PRIMITIVE );
m_not->set( false ); m_not->set( false );
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include <osg/Geometry> #include <osg/Geometry>
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WPickHandler.h" #include "WPickHandler.h"
#include "shaders/WGEShader.h" #include "shaders/WGEShader.h"
...@@ -121,7 +124,7 @@ private: ...@@ -121,7 +124,7 @@ private:
WVector2d m_oldPixelPosition; //!< Caches the old picked position to a allow for cmoparison WVector2d m_oldPixelPosition; //!< Caches the old picked position to a allow for cmoparison
int16_t m_oldScrollWheel; //!< caches scroll wheel value int16_t m_oldScrollWheel; //!< caches scroll wheel value
boost::shared_mutex m_updateLock; //!< Lock to prevent concurrent threads trying to update the osg node boost::shared_mutex m_updateLock; //!< Lock to prevent concurrent threads trying to update the osg node
osg::ref_ptr< osg::Geometry > m_surfaceGeometry; //!< store this pointer for use in updates osg::ref_ptr< wosg::Geometry > m_surfaceGeometry; //!< store this pointer for use in updates
WPickInfo m_pickInfo; //!< Stores the pick information for potential redraw WPickInfo m_pickInfo; //!< Stores the pick information for potential redraw
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include <iostream> #include <iostream>
#include "../../graphicsEngine/WGEUtils.h" #include "../../graphicsEngine/WGEUtils.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WDendrogramGeode.h" #include "WDendrogramGeode.h"
/** /**
...@@ -80,14 +84,14 @@ void WDendrogramGeode::create() ...@@ -80,14 +84,14 @@ void WDendrogramGeode::create()
(*m_vertexArray)[i].y() = (*m_vertexArray)[i].y() * m_yMult + m_yOff; (*m_vertexArray)[i].y() = (*m_vertexArray)[i].y() * m_yMult + m_yOff;
} }
osg::ref_ptr< osg::Geometry > geometry = osg::ref_ptr< osg::Geometry >( new osg::Geometry() ); osg::ref_ptr< wosg::Geometry > geometry = osg::ref_ptr< wosg::Geometry >( new wosg::Geometry() );
geometry->setVertexArray( m_vertexArray ); geometry->setVertexArray( m_vertexArray );
geometry->addPrimitiveSet( m_lineArray ); geometry->addPrimitiveSet( m_lineArray );
geometry->setColorArray( m_colors ); geometry->setColorArray( m_colors );
geometry->setColorBinding( osg::Geometry::BIND_PER_VERTEX ); geometry->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
osg::StateSet* state = geometry->getOrCreateStateSet(); osg::StateSet* state = geometry->getOrCreateStateSet();
state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED ); state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include "../WGEGeodeUtils.h" #include "../WGEGeodeUtils.h"
#include "WGEGridNode.h" #include "WGEGridNode.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
WGEGridNode::WGEGridNode( WGridRegular3D::ConstSPtr grid ): WGEGridNode::WGEGridNode( WGridRegular3D::ConstSPtr grid ):
m_boundaryGeode( new osg::Geode() ), m_boundaryGeode( new osg::Geode() ),
m_innerGridGeode( new osg::Geode() ), m_innerGridGeode( new osg::Geode() ),
...@@ -251,7 +254,7 @@ void WGEGridNode::callback( osg::Node* /*node*/ ) ...@@ -251,7 +254,7 @@ void WGEGridNode::callback( osg::Node* /*node*/ )
// grab the grid // grab the grid
WGridRegular3D::ConstSPtr grid = m_grid.getReadTicket()->get(); WGridRegular3D::ConstSPtr grid = m_grid.getReadTicket()->get();
osg::Geometry* gridGeometry = new osg::Geometry(); wosg::Geometry* gridGeometry = new wosg::Geometry();
osg::ref_ptr< osg::Vec3Array > vertArray = new osg::Vec3Array( grid->size() ); osg::ref_ptr< osg::Vec3Array > vertArray = new osg::Vec3Array( grid->size() );
osg::DrawElementsUInt* gridElement = new osg::DrawElementsUInt( osg::PrimitiveSet::LINES, 0 ); osg::DrawElementsUInt* gridElement = new osg::DrawElementsUInt( osg::PrimitiveSet::LINES, 0 );
...@@ -301,7 +304,7 @@ void WGEGridNode::callback( osg::Node* /*node*/ ) ...@@ -301,7 +304,7 @@ void WGEGridNode::callback( osg::Node* /*node*/ )
// finally, the colors // finally, the colors
colors->push_back( m_gridColor ); colors->push_back( m_gridColor );
gridGeometry->setColorArray( colors ); gridGeometry->setColorArray( colors );
gridGeometry->setColorBinding( osg::Geometry::BIND_OVERALL ); gridGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
if( m_innerGridGeode->getNumDrawables() ) if( m_innerGridGeode->getNumDrawables() )
{ {
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#include "../../WGraphicsEngine.h" #include "../../WGraphicsEngine.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WGEBorderLayout.h" #include "WGEBorderLayout.h"
WGEBorderLayout::WGEBorderLayout(): WGEBorderLayout::WGEBorderLayout():
...@@ -120,14 +123,14 @@ void WGEBorderLayout::SafeUpdateCallback::operator()( osg::Node* node, osg::Node ...@@ -120,14 +123,14 @@ void WGEBorderLayout::SafeUpdateCallback::operator()( osg::Node* node, osg::Node
} }
// create geometry for the lines calculated above // create geometry for the lines calculated above
osg::ref_ptr< osg::Geometry > g = new osg::Geometry; osg::ref_ptr< wosg::Geometry > g = new wosg::Geometry;
g->setDataVariance( osg::Object::DYNAMIC ); g->setDataVariance( osg::Object::DYNAMIC );
osg::ref_ptr< osg::DrawArrays > da = new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, v->size() ); osg::ref_ptr< osg::DrawArrays > da = new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, v->size() );
g->setVertexArray( v ); g->setVertexArray( v );
osg::ref_ptr< osg::Vec4Array > colors = new osg::Vec4Array; osg::ref_ptr< osg::Vec4Array > colors = new osg::Vec4Array;
colors->push_back( osg::Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) ); colors->push_back( osg::Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) );
g->setColorArray( colors ); g->setColorArray( colors );
g->setColorBinding( osg::Geometry::BIND_OVERALL ); g->setColorBinding( wosg::Geometry::BIND_OVERALL );
g->addPrimitiveSet( da ); g->addPrimitiveSet( da );
osg::LineWidth* linewidth = new osg::LineWidth(); osg::LineWidth* linewidth = new osg::LineWidth();
......
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
#include "core/graphicsEngine/shaders/WGEPropertyUniform.h" #include "core/graphicsEngine/shaders/WGEPropertyUniform.h"
#include "core/kernel/WKernel.h" #include "core/kernel/WKernel.h"
#include "core/kernel/WSelectionManager.h" #include "core/kernel/WSelectionManager.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WMArbitraryPlane.h" #include "WMArbitraryPlane.h"
#include "WMArbitraryPlane.xpm" #include "WMArbitraryPlane.xpm"
...@@ -281,7 +285,7 @@ void WMArbitraryPlane::updatePlane() ...@@ -281,7 +285,7 @@ void WMArbitraryPlane::updatePlane()
WPosition v2( p0[0] + p0[0] - p1[0] , p0[1] + p0[1] - p2[1] , p0[2] + ( p0[2] - p1[2] ) + ( p0[2] - p2[2] ) ); WPosition v2( p0[0] + p0[0] - p1[0] , p0[1] + p0[1] - p2[1] , p0[2] + ( p0[2] - p1[2] ) + ( p0[2] - p2[2] ) );
WPosition v3( p0[0] + p0[0] - p1[0] , p2[1] , p0[2] + ( p0[2] - p1[2] ) - ( p0[2] - p2[2] ) ); WPosition v3( p0[0] + p0[0] - p1[0] , p2[1] , p0[2] + ( p0[2] - p1[2] ) - ( p0[2] - p2[2] ) );
osg::ref_ptr<osg::Geometry> planeGeometry = osg::ref_ptr<osg::Geometry>( new osg::Geometry() ); osg::ref_ptr<wosg::Geometry> planeGeometry = osg::ref_ptr<wosg::Geometry>( new wosg::Geometry() );
osg::Vec3Array* planeVertices = new osg::Vec3Array; osg::Vec3Array* planeVertices = new osg::Vec3Array;
planeVertices->push_back( v0 ); planeVertices->push_back( v0 );
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#include "core/kernel/WKernel.h" #include "core/kernel/WKernel.h"
#include "core/kernel/WROIManager.h" #include "core/kernel/WROIManager.h"
#include "core/kernel/WSelectionManager.h" #include "core/kernel/WSelectionManager.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WMArbitraryROIs.h" #include "WMArbitraryROIs.h"
#include "WMArbitraryROIs.xpm" #include "WMArbitraryROIs.xpm"
...@@ -309,7 +313,7 @@ void WMArbitraryROIs::renderMesh() ...@@ -309,7 +313,7 @@ void WMArbitraryROIs::renderMesh()
if( m_showSelector ) if( m_showSelector )
{ {
osg::Geometry* surfaceGeometry = new osg::Geometry(); wosg::Geometry* surfaceGeometry = new wosg::Geometry();
m_outputGeode = osg::ref_ptr< osg::Geode >( new osg::Geode ); m_outputGeode = osg::ref_ptr< osg::Geode >( new osg::Geode );
m_outputGeode->setName( "ROI" ); m_outputGeode->setName( "ROI" );
...@@ -319,14 +323,14 @@ void WMArbitraryROIs::renderMesh() ...@@ -319,14 +323,14 @@ void WMArbitraryROIs::renderMesh()
// ------------------------------------------------ // ------------------------------------------------
// normals // normals
surfaceGeometry->setNormalArray( m_triMesh->getVertexNormalArray() ); surfaceGeometry->setNormalArray( m_triMesh->getVertexNormalArray() );
surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_VERTEX ); surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_VERTEX );
// ------------------------------------------------ // ------------------------------------------------
// colors // colors
osg::Vec4Array* colors = new osg::Vec4Array; osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back( osg::Vec4( 0.2f, 1.0f, 0.2f, 1.0f ) ); colors->push_back( osg::Vec4( 0.2f, 1.0f, 0.2f, 1.0f ) );
surfaceGeometry->setColorArray( colors ); surfaceGeometry->setColorArray( colors );
surfaceGeometry->setColorBinding( osg::Geometry::BIND_OVERALL ); surfaceGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
osg::DrawElementsUInt* surfaceElement = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 ); osg::DrawElementsUInt* surfaceElement = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 );
......
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
#include "core/kernel/WKernel.h" #include "core/kernel/WKernel.h"
#include "core/kernel/WSelectionManager.h" #include "core/kernel/WSelectionManager.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WFileParser.h" #include "WFileParser.h"
#include "WMClusterDisplayVoxels.h" #include "WMClusterDisplayVoxels.h"
#include "WMClusterDisplayVoxels.xpm" #include "WMClusterDisplayVoxels.xpm"
...@@ -764,7 +767,7 @@ void WMClusterDisplayVoxels::renderMesh() ...@@ -764,7 +767,7 @@ void WMClusterDisplayVoxels::renderMesh()
{ {
for( size_t i = 0; i < m_triMeshes.size(); ++i ) for( size_t i = 0; i < m_triMeshes.size(); ++i )
{ {
osg::Geometry* surfaceGeometry = new osg::Geometry(); wosg::Geometry* surfaceGeometry = new wosg::Geometry();
osg::ref_ptr< osg::Geode >outputGeode = osg::ref_ptr< osg::Geode >( new osg::Geode ); osg::ref_ptr< osg::Geode >outputGeode = osg::ref_ptr< osg::Geode >( new osg::Geode );
outputGeode->setName( ( std::string( "cluster" ) + string_utils::toString( m_activatedClusters[i] ) ).c_str() ); outputGeode->setName( ( std::string( "cluster" ) + string_utils::toString( m_activatedClusters[i] ) ).c_str() );
...@@ -774,14 +777,14 @@ void WMClusterDisplayVoxels::renderMesh() ...@@ -774,14 +777,14 @@ void WMClusterDisplayVoxels::renderMesh()
// ------------------------------------------------ // ------------------------------------------------
// normals // normals
surfaceGeometry->setNormalArray( m_triMeshes[i]->getTriangleNormalArray() ); surfaceGeometry->setNormalArray( m_triMeshes[i]->getTriangleNormalArray() );
surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE ); surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_PRIMITIVE );