Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
20b1cbf8
Commit
20b1cbf8
authored
Aug 29, 2013
by
Sebastian Eichelbaum
Browse files
[MERGE]
parents
35fb64e0
5f7ee1e8
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
176 additions
and
115 deletions
+176
-115
src/core/graphicsEngine/WGEGeodeUtils.cpp
src/core/graphicsEngine/WGEGeodeUtils.cpp
+31
-28
src/core/graphicsEngine/WGEGeodeUtils.h
src/core/graphicsEngine/WGEGeodeUtils.h
+17
-14
src/core/graphicsEngine/WGETextureHud.cpp
src/core/graphicsEngine/WGETextureHud.cpp
+6
-3
src/core/graphicsEngine/WOSG.h
src/core/graphicsEngine/WOSG.h
+9
-9
src/core/graphicsEngine/WROIArbitrary.cpp
src/core/graphicsEngine/WROIArbitrary.cpp
+6
-3
src/core/graphicsEngine/WROIBox.cpp
src/core/graphicsEngine/WROIBox.cpp
+6
-3
src/core/graphicsEngine/WROIBox.h
src/core/graphicsEngine/WROIBox.h
+4
-1
src/core/graphicsEngine/geodes/WDendrogramGeode.cpp
src/core/graphicsEngine/geodes/WDendrogramGeode.cpp
+6
-2
src/core/graphicsEngine/geodes/WGEGridNode.cpp
src/core/graphicsEngine/geodes/WGEGridNode.cpp
+5
-2
src/core/graphicsEngine/widgets/labeling/WGEBorderLayout.cpp
src/core/graphicsEngine/widgets/labeling/WGEBorderLayout.cpp
+5
-2
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
+5
-1
src/modules/arbitraryROIs/WMArbitraryROIs.cpp
src/modules/arbitraryROIs/WMArbitraryROIs.cpp
+7
-3
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
+9
-6
src/modules/colormapper/WMColormapper.cpp
src/modules/colormapper/WMColormapper.cpp
+5
-2
src/modules/coordinateHUD/WMCoordinateHUD.cpp
src/modules/coordinateHUD/WMCoordinateHUD.cpp
+9
-6
src/modules/coordinateSystem/WMCoordinateSystem.cpp
src/modules/coordinateSystem/WMCoordinateSystem.cpp
+7
-3
src/modules/coordinateSystem/WRulerOrtho.cpp
src/modules/coordinateSystem/WRulerOrtho.cpp
+16
-13
src/modules/coordinateSystem/WRulerOrtho.h
src/modules/coordinateSystem/WRulerOrtho.h
+9
-6
src/modules/datasetProfile/WMDatasetProfile.cpp
src/modules/datasetProfile/WMDatasetProfile.cpp
+10
-6
src/modules/eegView/WEEGEvent.cpp
src/modules/eegView/WEEGEvent.cpp
+4
-2
No files found.
src/core/graphicsEngine/WGEGeodeUtils.cpp
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
geometry
=
ref_ptr
<
w
osg
::
Geometry
>
(
new
w
osg
::
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
(
w
osg
::
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
<
w
osg
::
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
<
w
osg
::
Geometry
>
cube
=
new
w
osg
::
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
(
w
osg
::
Geometry
::
BIND_PER_VERTEX
);
// finally, the colors
colors
->
push_back
(
color
);
cube
->
setColorArray
(
colors
);
cube
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
cube
->
setColorBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
return
cube
;
}
osg
::
ref_ptr
<
osg
::
Geometry
>
wge
::
createUnitCubeAsLines
(
const
WColor
&
color
)
osg
::
ref_ptr
<
w
osg
::
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
<
w
osg
::
Geometry
>
cube
=
new
w
osg
::
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
(
w
osg
::
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
<
w
osg
::
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
<
w
osg
::
Geometry
>
geometry
(
new
w
osg
::
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
(
w
osg
::
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
(
w
osg
::
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
(
w
osg
::
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
<
w
osg
::
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
);
w
osg
::
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
(
w
osg
::
Geometry
::
BIND_PER_VERTEX
);
return
geometry
;
}
osg
::
ref_ptr
<
osg
::
Geometry
>
wge
::
convertToOsgGeometryLines
(
WTriangleMesh
::
SPtr
mesh
,
osg
::
ref_ptr
<
w
osg
::
Geometry
>
wge
::
convertToOsgGeometryLines
(
WTriangleMesh
::
SPtr
mesh
,
const
WColor
&
defaultColor
,
bool
useMeshColor
)
{
osg
::
ref_ptr
<
osg
::
Geometry
>
geometry
(
new
osg
::
Geometry
);
osg
::
ref_ptr
<
w
osg
::
Geometry
>
geometry
(
new
w
osg
::
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
(
w
osg
::
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
(
w
osg
::
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
<
w
osg
::
Geometry
>
geometry
=
ref_ptr
<
w
osg
::
Geometry
>
(
new
w
osg
::
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
(
w
osg
::
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
<
w
osg
::
Geometry
>
borderGeom
=
ref_ptr
<
w
osg
::
Geometry
>
(
new
w
osg
::
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
(
w
osg
::
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
<
w
osg
::
Geometry
>
geometry
=
new
w
osg
::
Geometry
();
geometry
->
setVertexArray
(
vertices
);
geometry
->
setTexCoordArray
(
0
,
texcoords0
);
geometry
->
setNormalBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
geometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
geometry
->
setNormalBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
geometry
->
setColorBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
geometry
->
setNormalArray
(
normals
);
geometry
->
setColorArray
(
colors
);
geometry
->
addPrimitiveSet
(
new
osg
::
DrawArrays
(
osg
::
PrimitiveSet
::
QUADS
,
0
,
4
)
);
...
...
src/core/graphicsEngine/WGEGeodeUtils.h
View file @
20b1cbf8
...
...
@@ -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
w
osg::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
<
w
osg
::
Geometry
>
createUnitCube
(
const
WColor
&
color
);
/**
* Creates a osg::Geometry containing an unit cube as line-strips, having 3D texture coordinates.
* Creates a
w
osg::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
<
w
osg
::
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
w
osg::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
w
osg::Geometry containing the mesh
* \note mesh cannot be const since
w
osg::Geometry needs non-const pointers to the contained arrays
*/
osg
::
ref_ptr
<
osg
::
Geometry
>
convertToOsgGeometry
(
WTriangleMesh
::
SPtr
mesh
,
osg
::
ref_ptr
<
w
osg
::
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
w
osg::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
w
osg::Geometry containing the mesh
* \note mesh cannot be const since
w
osg::Geometry needs non-const pointers to the contained arrays
*/
osg
::
ref_ptr
<
osg
::
Geometry
>
convertToOsgGeometry
(
WTriangleMesh
::
SPtr
mesh
,
const
WColoredVertices
&
colorMap
,
osg
::
ref_ptr
<
w
osg
::
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
w
osg::Geometry containing the mesh as lines
*/
osg
::
ref_ptr
<
osg
::
Geometry
>
convertToOsgGeometryLines
(
WTriangleMesh
::
SPtr
mesh
,
osg
::
ref_ptr
<
w
osg
::
Geometry
>
convertToOsgGeometryLines
(
WTriangleMesh
::
SPtr
mesh
,
const
WColor
&
defaultColor
=
WColor
(
1.0
,
1.0
,
1.0
,
1.0
),
bool
useMeshColor
=
true
);
...
...
src/core/graphicsEngine/WGETextureHud.cpp
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
HUDBackgroundGeometry
=
new
w
osg
::
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.0
f
,
0.0
f
,
1.0
f
)
);
HUDBackgroundGeometry
->
setNormalArray
(
HUDnormals
);
HUDBackgroundGeometry
->
setNormalBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
HUDBackgroundGeometry
->
setNormalBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
HUDBackgroundGeometry
->
addPrimitiveSet
(
HUDBackgroundIndices
);
HUDBackgroundGeometry
->
setVertexArray
(
HUDBackgroundVertices
);
HUDBackgroundGeometry
->
setColorArray
(
HUDcolors
);
HUDBackgroundGeometry
->
setTexCoordArray
(
0
,
HUDBackgroundTex
);
HUDBackgroundGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
HUDBackgroundGeometry
->
setColorBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
geode
->
addDrawable
(
HUDBackgroundGeometry
);
...
...
src/
modules/sliceContext/shaders/WMSliceContext-vertex.glsl
→
src/
core/graphicsEngine/WOSG.h
View file @
20b1cbf8
...
...
@@ -22,13 +22,13 @@
//
//---------------------------------------------------------------------------
varying
vec4
myColor
;
#include "osg/Version"
void
main
()
{
myColor
=
gl_Color
;
gl_TexCoord
[
0
]
=
gl_Textu
re
M
at
rix
[
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 dep
re
c
at
ed_osg
#else
#define wosg osg
#endif
src/core/graphicsEngine/WROIArbitrary.cpp
View file @
20b1cbf8
...
...
@@ -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
();
w
osg
::
Geometry
*
surfaceGeometry
=
new
w
osg
::
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(
w
osg::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
(
w
osg
::
Geometry
::
BIND_OVERALL
);
osg
::
DrawElementsUInt
*
surfaceElement
=
new
osg
::
DrawElementsUInt
(
osg
::
PrimitiveSet
::
TRIANGLES
,
0
);
...
...
src/core/graphicsEngine/WROIBox.cpp
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
(
new
w
osg
::
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.0
f
,
0.0
f
,
1.0
f
,
0.5
f
)
);
m_surfaceGeometry
->
setColorArray
(
colors
);
m_surfaceGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
m_surfaceGeometry
->
setColorBinding
(
w
osg
::
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(
w
osg::Geometry::BIND_PER_PRIMITIVE );
m_not
->
set
(
false
);
...
...
src/core/graphicsEngine/WROIBox.h
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
m_surfaceGeometry
;
//!< store this pointer for use in updates
WPickInfo
m_pickInfo
;
//!< Stores the pick information for potential redraw
...
...
src/core/graphicsEngine/geodes/WDendrogramGeode.cpp
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
geometry
=
osg
::
ref_ptr
<
w
osg
::
Geometry
>
(
new
w
osg
::
Geometry
()
);
geometry
->
setVertexArray
(
m_vertexArray
);
geometry
->
addPrimitiveSet
(
m_lineArray
);
geometry
->
setColorArray
(
m_colors
);
geometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_PER_VERTEX
);
geometry
->
setColorBinding
(
w
osg
::
Geometry
::
BIND_PER_VERTEX
);
osg
::
StateSet
*
state
=
geometry
->
getOrCreateStateSet
();
state
->
setMode
(
GL_LIGHTING
,
osg
::
StateAttribute
::
OFF
|
osg
::
StateAttribute
::
PROTECTED
);
...
...
src/core/graphicsEngine/geodes/WGEGridNode.cpp
View file @
20b1cbf8
...
...
@@ -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
();
w
osg
::
Geometry
*
gridGeometry
=
new
w
osg
::
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
(
w
osg
::
Geometry
::
BIND_OVERALL
);
if
(
m_innerGridGeode
->
getNumDrawables
()
)
{
...
...
src/core/graphicsEngine/widgets/labeling/WGEBorderLayout.cpp
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
g
=
new
w
osg
::
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.0
f
,
0.0
f
,
0.0
f
,
1.0
f
)
);
g
->
setColorArray
(
colors
);
g
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
g
->
setColorBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
g
->
addPrimitiveSet
(
da
);
osg
::
LineWidth
*
linewidth
=
new
osg
::
LineWidth
();
...
...
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
View file @
20b1cbf8
...
...
@@ -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
<
w
osg
::
Geometry
>
planeGeometry
=
osg
::
ref_ptr
<
w
osg
::
Geometry
>
(
new
w
osg
::
Geometry
()
);
osg
::
Vec3Array
*
planeVertices
=
new
osg
::
Vec3Array
;
planeVertices
->
push_back
(
v0
);
...
...
src/modules/arbitraryROIs/WMArbitraryROIs.cpp
View file @
20b1cbf8
...
...
@@ -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
();
w
osg
::
Geometry
*
surfaceGeometry
=
new
w
osg
::
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
(
w
osg
::
Geometry
::
BIND_PER_VERTEX
);
// ------------------------------------------------
// colors
osg
::
Vec4Array
*
colors
=
new
osg
::
Vec4Array
;
colors
->
push_back
(
osg
::
Vec4
(
0.2
f
,
1.0
f
,
0.2
f
,
1.0
f
)
);
surfaceGeometry
->
setColorArray
(
colors
);
surfaceGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_OVERALL
);
surfaceGeometry
->
setColorBinding
(
w
osg
::
Geometry
::
BIND_OVERALL
);
osg
::
DrawElementsUInt
*
surfaceElement
=
new
osg
::
DrawElementsUInt
(
osg
::
PrimitiveSet
::
TRIANGLES
,
0
);
...
...
src/modules/clusterDisplayVoxels/WMClusterDisplayVoxels.cpp
View file @
20b1cbf8
...
...
@@ -43,6 +43,9 @@
<