Commit 20b1cbf8 by Sebastian Eichelbaum

[MERGE]

parents 35fb64e0 5f7ee1e8
......@@ -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 );
......
......@@ -22,13 +22,13 @@
//
//---------------------------------------------------------------------------
varying vec4 myColor;
#include "osg/Version"
void main()
{
myColor = gl_Color;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_Position = ftransform(); // store final position
}
// 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"
#include "WFileParser.h"
#include "WMClusterDisplayVoxels.h"
#include "WMClusterDisplayVoxels.xpm"
......@@ -764,7 +767,7 @@ void WMClusterDisplayVoxels::renderMesh()
{
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 );
outputGeode->setName( ( std::string( "cluster" ) + string_utils::toString( m_activatedClusters[i] ) ).c_str() );
......@@ -774,14 +777,14 @@ void WMClusterDisplayVoxels::renderMesh()
// ------------------------------------------------
// normals
surfaceGeometry->setNormalArray( m_triMeshes[i]->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_clusterColors[m_activatedClusters[i]] );
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 );
......@@ -807,7 +810,7 @@ void WMClusterDisplayVoxels::renderMesh()
}
if( m_propShowVoxelTriangulation->get( true ) && m_showNotInClusters->get() )
{
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 );
outputGeode->setName( ( std::string( "non active" ) ).c_str() );
......@@ -817,7 +820,7 @@ void WMClusterDisplayVoxels::renderMesh()
// ------------------------------------------------
// normals
surfaceGeometry->setNormalArray( m_nonActiveMesh->getTriangleNormalArray() );
surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
surfaceGeometry->setNormalBinding( wosg::Geometry::BIND_PER_PRIMITIVE );
// ------------------------------------------------
// colors
......@@ -825,7 +828,7 @@ void WMClusterDisplayVoxels::renderMesh()
colors->push_back( osg::Vec4( 0.3, 0.3, 0.3, 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 );
......
......@@ -37,6 +37,9 @@
#include "core/graphicsEngine/widgets/labeling/WGELabel.h"
#include "core/kernel/WKernel.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WMColormapper.xpm"
#include "WMColormapper.h"
......@@ -435,12 +438,12 @@ void WMColormapper::updateColorbarScale( osg::Node* scaleLabels )
}
// create the line drawable
osg::Geometry* lines = new osg::Geometry();
wosg::Geometry* lines = new wosg::Geometry();
lines->setVertexArray( lineVerts );
osg::Vec3Array* color = new osg::Vec3Array();
color->push_back( osg::Vec3( 1.0, 1.0, 1.0 ) );
lines->setColorArray( color );
lines->setColorBinding( osg::Geometry::BIND_OVERALL );
lines->setColorBinding( wosg::Geometry::BIND_OVERALL );
lines->addPrimitiveSet( new osg::DrawArrays( GL_LINES, 0, lineVerts->size() ) );
g->addDrawable( lines );
}
......
......@@ -41,6 +41,9 @@
#include "core/common/WPropertyHelper.h"
#include "core/graphicsEngine/WGEUtils.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WMCoordinateHUD.h"
#include "WMCoordinateHUD.xpm"
#include "option_1.xpm"
......@@ -178,7 +181,7 @@ void WMCoordinateHUD::buildColorAxis()
{
// build the geometry & geode for the coordinate axis
osg::ref_ptr< osg::Geode > coordGeode = new osg::Geode();
osg::ref_ptr< osg::Geometry> coordGeom = new osg::Geometry;
osg::ref_ptr< wosg::Geometry> coordGeom = new wosg::Geometry;
// Vertices
osg::Vec3Array* vertices = new osg::Vec3Array;
......@@ -209,7 +212,7 @@ void WMCoordinateHUD::buildColorAxis()
// add color to geometry
coordGeom->setColorArray( color );
coordGeom->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
coordGeom->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
// primitives = draw lines between vertices
osg::DrawArrays *da = new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, vertices->size( ) );
......@@ -227,7 +230,7 @@ void WMCoordinateHUD::buildBWAxis()
{
//build the geometry & geode for the coordinate axis
osg::ref_ptr< osg::Geode > coordGeode = new osg::Geode();
osg::ref_ptr< osg::Geometry> coordGeom = new osg::Geometry;
osg::ref_ptr< wosg::Geometry> coordGeom = new wosg::Geometry;
//Vertices
osg::Vec3Array* vertices = new osg::Vec3Array;
......@@ -253,7 +256,7 @@ void WMCoordinateHUD::buildBWAxis()
//add color to geometry
coordGeom->setColorArray( color );
coordGeom->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
coordGeom->setColorBinding( wosg::Geometry::BIND_PER_VERTEX );
//primitives = draw lines between vertices
osg::DrawArrays *da = new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, vertices->size( ) );
......@@ -271,7 +274,7 @@ void WMCoordinateHUD::buildColorCube( bool withFaceLabels, std::string labelPref
{
// build the geometry & geode for the coordinate axis
osg::ref_ptr< osg::Geode > coordGeode = new osg::Geode();
osg::ref_ptr< osg::Geometry> coordGeom = new osg::Geometry;
osg::ref_ptr< wosg::Geometry> coordGeom = new wosg::Geometry;
// Vertices
osg::Vec3Array* vertices = new osg::Vec3Array( 36 );
......@@ -301,7 +304,7 @@ void WMCoordinateHUD::buildColorCube( bool withFaceLabels, std::string labelPref
// add color to geometry
coordGeom->setColorArray( color );
coordGeom->setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE );
coordGeom->setColorBinding( wosg::Geometry::BIND_PER_PRIMITIVE );
// primitives = draw lines between vertices
osg::DrawArrays *da = new osg::DrawArrays( osg::PrimitiveSet::TRIANGLES, 0, vertices->size( ) );
......
......@@ -39,6 +39,10 @@
#include "core/graphicsEngine/WGEGeodeUtils.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 "WMCoordinateSystem.h"
#include "WMCoordinateSystem.xpm"
#include "WTalairachConverter.h"
......@@ -572,7 +576,7 @@ void WMCoordinateSystem::addSagittalGrid( float position )
}
osg::ref_ptr< osg::Geode > gridGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
WBoundingBox boundingBox = m_coordConverter->getBoundingBox();
......@@ -653,7 +657,7 @@ void WMCoordinateSystem::addCoronalGrid( float position )
}
osg::ref_ptr< osg::Geode > gridGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
WBoundingBox boundingBox = m_coordConverter->getBoundingBox();
......@@ -734,7 +738,7 @@ void WMCoordinateSystem::addAxialGrid( float position )
}
osg::ref_ptr< osg::Geode > gridGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
WBoundingBox boundingBox = m_coordConverter->getBoundingBox();
......
......@@ -34,6 +34,9 @@
#include "core/common/WStringUtils.h"
#include "core/common/WPathHelper.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WRulerOrtho.h"
WRulerOrtho::WRulerOrtho( boost::shared_ptr<WCoordConverter>coordConverter, osg::Vec3 origin, scaleMode mode, bool showNumbers ) :
......@@ -56,7 +59,7 @@ WRulerOrtho::~WRulerOrtho()
void WRulerOrtho::create()
{
osg::ref_ptr< osg::Geode > rulerGeode = osg::ref_ptr< osg::Geode >( new osg::Geode() );
osg::ref_ptr< osg::Geometry > geometry;
osg::ref_ptr< wosg::Geometry > geometry;
switch( m_scaleMode )
{
......@@ -124,9 +127,9 @@ void WRulerOrtho::addLabel( osg::Vec3 position, std::string text )
labelXform->addChild( labelGeode );
}
osg::ref_ptr< osg::Geometry > WRulerOrtho::createXY()
osg::ref_ptr< wosg::Geometry > WRulerOrtho::createXY()
{
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
int startX = static_cast< int > ( m_lb[0] + 0.5 );
......@@ -198,9 +201,9 @@ osg::ref_ptr< osg::Geometry > WRulerOrtho::createXY()
return geometry;
}
osg::ref_ptr< osg::Geometry > WRulerOrtho::createXZ()
osg::ref_ptr< wosg::Geometry > WRulerOrtho::createXZ()
{
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
int startX = static_cast< int > ( m_lb[0] + 0.5 );
......@@ -271,9 +274,9 @@ osg::ref_ptr< osg::Geometry > WRulerOrtho::createXZ()
return geometry;
}
osg::ref_ptr< osg::Geometry > WRulerOrtho::createYX()
osg::ref_ptr< wosg::Geometry > WRulerOrtho::createYX()
{
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
int startY = static_cast< int > ( m_lb[1] + 0.5 );
......@@ -346,9 +349,9 @@ osg::ref_ptr< osg::Geometry > WRulerOrtho::createYX()
return geometry;
}
osg::ref_ptr< osg::Geometry > WRulerOrtho::createYZ()
osg::ref_ptr< wosg::Geometry > WRulerOrtho::createYZ()
{
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
int startY = static_cast< int > ( m_lb[1] + 0.5 );
......@@ -421,9 +424,9 @@ osg::ref_ptr< osg::Geometry > WRulerOrtho::createYZ()
return geometry;
}
osg::ref_ptr< osg::Geometry > WRulerOrtho::createZX()
osg::ref_ptr< wosg::Geometry > WRulerOrtho::createZX()
{
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
int startZ = static_cast< int > ( m_lb[2] + 0.5 );
......@@ -496,9 +499,9 @@ osg::ref_ptr< osg::Geometry > WRulerOrtho::createZX()
return geometry;
}
osg::ref_ptr< osg::Geometry > WRulerOrtho::createZY()
osg::ref_ptr< wosg::Geometry > WRulerOrtho::createZY()
{
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() );
osg::Vec3Array* vertices = new osg::Vec3Array;
int startZ = static_cast< int > ( m_lb[2] + 0.5 );
......
......@@ -31,6 +31,9 @@
#include "core/common/math/linearAlgebra/WVectorFixed.h"
// Compatibility between OSG 3.2 and earlier versions
#include "core/graphicsEngine/WOSG.h"
#include "WCoordConverter.h"
#include "WRuler.h"
......@@ -104,42 +107,42 @@ private:
*
* \return A part of the geometry of the ruler
*/
osg::ref_ptr< osg::Geometry > createXY();
osg::ref_ptr< wosg::Geometry > createXY();
/**
* Helper function to create the ruler along the x axis
*
* \return A part of the geometry of the ruler
*/
osg::ref_ptr< osg::Geometry > createXZ();
osg::ref_ptr< wosg::Geometry > createXZ();
/**
* Helper function to create the ruler along the y axis
*
* \return A part of the geometry of the ruler
*/
osg::ref_ptr< osg::Geometry > createYX();
osg::ref_ptr< wosg::Geometry > createYX();
/**
* Helper function to create the ruler along the y axis
*
* \return A part of the geometry of the ruler
*/
osg::ref_ptr< osg::Geometry > createYZ();