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
......@@ -48,6 +48,9 @@
#include "WGEUtils.h"
#include "widgets/labeling/WGELabel.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
osg::ref_ptr< osg::Geode > wge::generateBoundingBoxGeode( const WBoundingBox& bb, const WColor& color )
{
const WBoundingBox::vec_type& pos1 = bb.getMin();
......@@ -57,7 +60,7 @@ osg::ref_ptr< osg::Geode > wge::generateBoundingBoxGeode( const WBoundingBox& bb
using osg::ref_ptr;
ref_ptr< osg::Vec3Array > vertices = ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
ref_ptr< osg::Vec4Array > colors = ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
ref_ptr< osg::Geometry > geometry = ref_ptr< osg::Geometry >( new osg::Geometry );
ref_ptr< wosg::Geometry > geometry = ref_ptr< wosg::Geometry >( new wosg::Geometry );
vertices->push_back( osg::Vec3( pos1[0], pos1[1], pos1[2] ) );
vertices->push_back( osg::Vec3( pos2[0], pos1[1], pos1[2] ) );
......@@ -84,7 +87,7 @@ osg::ref_ptr< osg::Geode > wge::generateBoundingBoxGeode( const WBoundingBox& bb
geometry->setVertexArray( vertices );
colors->push_back( color );
geometry->setColorArray( colors );
geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
geometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
osg::ref_ptr< osg::Geode > geode = osg::ref_ptr< osg::Geode >( new osg::Geode );
geode->addDrawable( geometry );
......@@ -95,10 +98,10 @@ osg::ref_ptr< osg::Geode > wge::generateBoundingBoxGeode( const WBoundingBox& bb
return geode;
}
osg::ref_ptr< osg::Geometry > wge::createUnitCube( const WColor& color )
osg::ref_ptr< wosg::Geometry > wge::createUnitCube( const WColor& color )
{
// create the unit cube manually as the ShapeDrawable and osg::Box does not provide 3D texture coordinates
osg::ref_ptr< osg::Geometry > cube = new osg::Geometry();
osg::ref_ptr< wosg::Geometry > cube = new wosg::Geometry();
osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
osg::ref_ptr< osg::Vec3Array > normals = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
......@@ -175,20 +178,20 @@ osg::ref_ptr< osg::Geometry > wge::createUnitCube( const WColor& color )
// set normals
cube->setNormalArray( normals );
cube->setNormalBinding( osg::Geometry::BIND_PER_VERTEX );
cube->setNormalBinding( wosg::Geometry::BIND_PER_VERTEX );
// finally, the colors
colors->push_back( color );
cube->setColorArray( colors );
cube->setColorBinding( osg::Geometry::BIND_OVERALL );
cube->setColorBinding( wosg::Geometry::BIND_OVERALL );
return cube;
}
osg::ref_ptr< osg::Geometry > wge::createUnitCubeAsLines( const WColor& color )
osg::ref_ptr< wosg::Geometry > wge::createUnitCubeAsLines( const WColor& color )
{
// create the unit cube manually as the ShapeDrawable and osg::Box does not provide 3D texture coordinates
osg::ref_ptr< osg::Geometry > cube = new osg::Geometry();
osg::ref_ptr< wosg::Geometry > cube = new wosg::Geometry();
osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
......@@ -223,7 +226,7 @@ osg::ref_ptr< osg::Geometry > wge::createUnitCubeAsLines( const WColor& color )
// finally, the colors
colors->push_back( color );
cube->setColorArray( colors );
cube->setColorBinding( osg::Geometry::BIND_OVERALL );
cube->setColorBinding( wosg::Geometry::BIND_OVERALL );
return cube;
}
......@@ -264,13 +267,13 @@ osg::ref_ptr< osg::Node > wge::generateSolidBoundingBoxNode( const WBoundingBox&
return transform;
}
osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mesh,
osg::ref_ptr< wosg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mesh,
const WColor& defaultColor,
bool includeNormals,
bool lighting,
bool useMeshColor )
{
osg::ref_ptr< osg::Geometry> geometry( new osg::Geometry );
osg::ref_ptr< wosg::Geometry> geometry( new wosg::Geometry );
geometry->setVertexArray( mesh->getVertexArray() );
osg::DrawElementsUInt* surfaceElement;
......@@ -290,14 +293,14 @@ osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mes
if( mesh->getVertexColorArray() && useMeshColor )
{
geometry->setColorArray( mesh->getVertexColorArray() );
geometry->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
geometry->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
}
else
{
osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
colors->push_back( defaultColor );
geometry->setColorArray( colors );
geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
geometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
}
// ------------------------------------------------
......@@ -305,7 +308,7 @@ osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mes
if( includeNormals )
{
geometry->setNormalArray( mesh->getVertexNormalArray() );
geometry->setNormalBinding( osg::Geometry::BIND_PER_VERTEX );
geometry->setNormalBinding( wosg::Geometry::BIND_PER_VERTEX );
if( lighting )
{
......@@ -334,10 +337,10 @@ osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mes
return geometry;
}
osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mesh, const WColoredVertices& colorMap, const WColor& defaultColor,
osg::ref_ptr< wosg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mesh, const WColoredVertices& colorMap, const WColor& defaultColor,
bool includeNormals, bool lighting )
{
osg::Geometry* geometry = convertToOsgGeometry( mesh, defaultColor, includeNormals, lighting, false );
wosg::Geometry* geometry = convertToOsgGeometry( mesh, defaultColor, includeNormals, lighting, false );
// ------------------------------------------------
// colors
......@@ -356,16 +359,16 @@ osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometry( WTriangleMesh::SPtr mes
}
geometry->setColorArray( colors );
geometry->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
geometry->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
return geometry;
}
osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometryLines( WTriangleMesh::SPtr mesh,
osg::ref_ptr< wosg::Geometry > wge::convertToOsgGeometryLines( WTriangleMesh::SPtr mesh,
const WColor& defaultColor,
bool useMeshColor )
{
osg::ref_ptr< osg::Geometry > geometry( new osg::Geometry );
osg::ref_ptr< wosg::Geometry > geometry( new wosg::Geometry );
geometry->setVertexArray( mesh->getVertexArray() );
osg::DrawElementsUInt* meshElement;
......@@ -389,14 +392,14 @@ osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometryLines( WTriangleMesh::SPt
if( mesh->getVertexColorArray() && useMeshColor )
{
geometry->setColorArray( mesh->getVertexColorArray() );
geometry->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
geometry->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
}
else
{
osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
colors->push_back( defaultColor );
geometry->setColorArray( colors );
geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
geometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
}
osg::StateSet* stateset = geometry->getOrCreateStateSet();
......@@ -446,7 +449,7 @@ osg::ref_ptr< osg::Geode > wge::genFinitePlane( double xSize, double ySize, cons
using osg::ref_ptr;
ref_ptr< osg::Vec3Array > vertices = ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
ref_ptr< osg::Vec4Array > colors = ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
ref_ptr< osg::Geometry > geometry = ref_ptr< osg::Geometry >( new osg::Geometry );
ref_ptr< wosg::Geometry > geometry = ref_ptr< wosg::Geometry >( new wosg::Geometry );
colors->push_back( color );
......@@ -458,7 +461,7 @@ osg::ref_ptr< osg::Geode > wge::genFinitePlane( double xSize, double ySize, cons
geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, 4 ) );
geometry->setVertexArray( vertices );
geometry->setColorArray( colors );
geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
geometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
osg::StateSet* stateset = new osg::StateSet;
stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
......@@ -470,13 +473,13 @@ osg::ref_ptr< osg::Geode > wge::genFinitePlane( double xSize, double ySize, cons
if( border )
{
vertices->push_back( vertices->front() );
ref_ptr< osg::Geometry > borderGeom = ref_ptr< osg::Geometry >( new osg::Geometry );
ref_ptr< wosg::Geometry > borderGeom = ref_ptr< wosg::Geometry >( new wosg::Geometry );
borderGeom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINE_STRIP, 0, 4 ) );
borderGeom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINE_STRIP, 3, 2 ) );
ref_ptr< osg::Vec4Array > colors = ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
colors->push_back( inverseColor( color ) );
borderGeom->setColorArray( colors );
borderGeom->setColorBinding( osg::Geometry::BIND_OVERALL );
borderGeom->setColorBinding( wosg::Geometry::BIND_OVERALL );
borderGeom->setVertexArray( vertices );
geode->addDrawable( borderGeom );
}
......@@ -513,11 +516,11 @@ osg::ref_ptr< osg::Geode > wge::genFinitePlane( osg::Vec3 const& base, osg::Vec3
texcoords0->push_back( bNorm );
// put it all together
osg::ref_ptr< osg::Geometry > geometry = new osg::Geometry();
osg::ref_ptr< wosg::Geometry > geometry = new wosg::Geometry();
geometry->setVertexArray( vertices );
geometry->setTexCoordArray( 0, texcoords0 );
geometry->setNormalBinding( osg::Geometry::BIND_OVERALL );
geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
geometry->setNormalBinding( wosg::Geometry::BIND_OVERALL );
geometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
geometry->setNormalArray( normals );
geometry->setColorArray( colors );
geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, 4 ) );
......
......@@ -47,6 +47,9 @@
#include "WGEUtils.h"
#include "WTriangleMesh.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
namespace wge
{
/**
......@@ -72,26 +75,26 @@ namespace wge
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
*
* \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
*
* \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
* 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 includeNormals When true, calculate the vertex normals and include
......@@ -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 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.
* \return an osg::Geometry containing the mesh
* \note mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays
* \return an wosg::Geometry containing the mesh
* \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 ),
bool includeNormals = false,
bool lighting = false,
......@@ -110,7 +113,7 @@ namespace wge
/**
* 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.
*
* \param mesh the WTriangleMesh used as input
......@@ -119,10 +122,10 @@ namespace wge
* them into the geometry.
* \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*
* \return an osg::Geometry containing the mesh
* \note mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays
* \return an wosg::Geometry containing the mesh
* \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 ),
bool includeNormals = false,
bool lighting = false
......@@ -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 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 ),
bool useMeshColor = true );
......
......@@ -36,6 +36,9 @@
#include <osg/TexEnv>
#include <osgText/Text>
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "../common/WPathHelper.h"
#include "WGETextureHud.h"
......@@ -186,7 +189,7 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur
osg::Geode* geode = new osg::Geode();
// 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;
HUDBackgroundVertices->push_back( osg::Vec3( 0, 0, -1 ) );
......@@ -212,12 +215,12 @@ WGETextureHud::WGETextureHudEntry::WGETextureHudEntry( osg::ref_ptr< osg::Textur
osg::ref_ptr< osg::Vec3Array > HUDnormals = new osg::Vec3Array;
HUDnormals->push_back( osg::Vec3( 0.0f, 0.0f, 1.0f ) );
HUDBackgroundGeometry->setNormalArray( HUDnormals );
HUDBackgroundGeometry->setNormalBinding( osg::Geometry::BIND_OVERALL );
HUDBackgroundGeometry->setNormalBinding( wosg::Geometry::BIND_OVERALL );
HUDBackgroundGeometry->addPrimitiveSet( HUDBackgroundIndices );
HUDBackgroundGeometry->setVertexArray( HUDBackgroundVertices );
HUDBackgroundGeometry->setColorArray( HUDcolors );
HUDBackgroundGeometry->setTexCoordArray( 0, HUDBackgroundTex );
HUDBackgroundGeometry->setColorBinding( osg::Geometry::BIND_OVERALL );
HUDBackgroundGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
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 @@
#include "callbacks/WGEFunctorCallback.h"
#include "WGraphicsEngine.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WROIArbitrary.h"
WROIArbitrary::WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ,
......@@ -155,7 +158,7 @@ void WROIArbitrary::updateGFX()
&m_vals,
m_threshold->get() );
osg::Geometry* surfaceGeometry = new osg::Geometry();
wosg::Geometry* surfaceGeometry = new wosg::Geometry();
setName( "roi" );
surfaceGeometry->setVertexArray( m_triMesh->getVertexArray() );
......@@ -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
// normals. So the code is disabled.
// surfaceGeometry->setNormalArray( m_triMesh->getTriangleNormalArray() );
// surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
// surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_PRIMITIVE );
// ------------------------------------------------
// colors
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back( m_color );
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 );
......
......@@ -37,6 +37,9 @@
#include "WGraphicsEngine.h"
#include "WGEUtils.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
size_t WROIBox::maxBoxId = 0;
void buildFacesFromPoints( osg::DrawElementsUInt* surfaceElements )
......@@ -148,7 +151,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) :
m_pickHandler = m_viewer->getPickHandler();
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 );
std::stringstream ss;
......@@ -185,7 +188,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) :
colors->push_back( osg::Vec4( 0.0f, 0.0f, 1.0f, 0.5f ) );
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();
lightModel->setTwoSided( true );
......@@ -199,7 +202,7 @@ WROIBox::WROIBox( WPosition minPos, WPosition maxPos ) :
osg::ref_ptr<osg::Vec3Array> normals = osg::ref_ptr<osg::Vec3Array>( new osg::Vec3Array );
setNormals( 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 );
......
......@@ -32,6 +32,9 @@
#include <osg/Geometry>
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WPickHandler.h"
#include "shaders/WGEShader.h"
......@@ -121,7 +124,7 @@ private:
WVector2d m_oldPixelPosition; //!< Caches the old picked position to a allow for cmoparison
int16_t m_oldScrollWheel; //!< caches scroll wheel value
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
......
......@@ -25,6 +25,10 @@
#include <iostream>
#include "../../graphicsEngine/WGEUtils.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WDendrogramGeode.h"
/**
......@@ -80,14 +84,14 @@ void WDendrogramGeode::create()
(*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->addPrimitiveSet( m_lineArray );
geometry->setColorArray( m_colors );
geometry->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
geometry->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
osg::StateSet* state = geometry->getOrCreateStateSet();
state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
......
......@@ -31,6 +31,9 @@
#include "../WGEGeodeUtils.h"
#include "WGEGridNode.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
WGEGridNode::WGEGridNode( WGridRegular3D::ConstSPtr grid ):
m_boundaryGeode( new osg::Geode() ),
m_innerGridGeode( new osg::Geode() ),
......@@ -251,7 +254,7 @@ void WGEGridNode::callback( osg::Node* /*node*/ )
// grab the grid
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::DrawElementsUInt* gridElement = new osg::DrawElementsUInt( osg::PrimitiveSet::LINES, 0 );
......@@ -301,7 +304,7 @@ void WGEGridNode::callback( osg::Node* /*node*/ )
// finally, the colors
colors->push_back( m_gridColor );
gridGeometry->setColorArray( colors );
gridGeometry->setColorBinding( osg::Geometry::BIND_OVERALL );
gridGeometry->setColorBinding( wosg::Geometry::BIND_OVERALL );
if( m_innerGridGeode->getNumDrawables() )
{
......
......@@ -28,6 +28,9 @@
#include "../../WGraphicsEngine.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WGEBorderLayout.h"
WGEBorderLayout::WGEBorderLayout():
......@@ -120,14 +123,14 @@ void WGEBorderLayout::SafeUpdateCallback::operator()( osg::Node* node, osg::Node
}
// 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 );
osg::ref_ptr< osg::DrawArrays > da = new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, v->size() );
g->setVertexArray( v );
osg::ref_ptr< osg::Vec4Array > colors = new osg::Vec4Array;
colors->push_back( osg::Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) );
g->setColorArray( colors );
g->setColorBinding( osg::Geometry::BIND_OVERALL );
g->setColorBinding( wosg::Geometry::BIND_OVERALL );
g->addPrimitiveSet( da );
osg::LineWidth* linewidth = new osg::LineWidth();
......
......@@ -40,6 +40,10 @@
#include "core/graphicsEngine/shaders/WGEPropertyUniform.h"
#include "core/kernel/WKernel.h"
#include "core/kernel/WSelectionManager.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WMArbitraryPlane.h"
#include "WMArbitraryPlane.xpm"
......@@ -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 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;
planeVertices->push_back( v0 );
......
......@@ -41,6 +41,10 @@
#include "core/kernel/WKernel.h"
#include "core/kernel/WROIManager.h"
#include "core/kernel/WSelectionManager.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WMArbitraryROIs.h"
#include "WMArbitraryROIs.xpm"
......@@ -309,7 +313,7 @@ void WMArbitraryROIs::renderMesh()
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->setName( "ROI" );
......@@ -319,14 +323,14 @@ void WMArbitraryROIs::renderMesh()
// ------------------------------------------------
// normals
surfaceGeometry->setNormalArray( m_triMesh->getVertexNormalArray() );
surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_VERTEX );
surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_VERTEX );
// ------------------------------------------------
// colors
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back( osg::Vec4( 0.2f, 1.0f, 0.2f, 1.0f ) );
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 );
......
......@@ -43,6 +43,9 @@
#include "core/kernel/WKernel.h"
#include "core/kernel/WSelectionManager.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"