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
2d7c63d7
Commit
2d7c63d7
authored
Nov 30, 2011
by
Sebastian Eichelbaum
Browse files
[MERGE]
parents
9a51adea
c35f3440
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
252 additions
and
177 deletions
+252
-177
src/core/common/WColor.cpp
src/core/common/WColor.cpp
+16
-0
src/core/common/WColor.h
src/core/common/WColor.h
+1
-12
src/core/common/WPropertyTypes.h
src/core/common/WPropertyTypes.h
+1
-1
src/core/common/WTransferFunction.cpp
src/core/common/WTransferFunction.cpp
+6
-0
src/core/common/WTransferFunction.h
src/core/common/WTransferFunction.h
+170
-122
src/core/graphicsEngine/WFiberDrawable.h
src/core/graphicsEngine/WFiberDrawable.h
+2
-2
src/core/graphicsEngine/WGEGroupNode.cpp
src/core/graphicsEngine/WGEGroupNode.cpp
+1
-1
src/core/graphicsEngine/WGEGroupNode.h
src/core/graphicsEngine/WGEGroupNode.h
+2
-2
src/core/graphicsEngine/WGEViewer.cpp
src/core/graphicsEngine/WGEViewer.cpp
+3
-0
src/core/graphicsEngine/WGEViewer.h
src/core/graphicsEngine/WGEViewer.h
+5
-7
src/core/graphicsEngine/WGraphicsEngine.cpp
src/core/graphicsEngine/WGraphicsEngine.cpp
+6
-1
src/core/graphicsEngine/WGraphicsEngine.h
src/core/graphicsEngine/WGraphicsEngine.h
+5
-5
src/core/graphicsEngine/WPickHandler.cpp
src/core/graphicsEngine/WPickHandler.cpp
+3
-4
src/core/graphicsEngine/WPickHandler.h
src/core/graphicsEngine/WPickHandler.h
+16
-16
src/core/graphicsEngine/WROIBox.h
src/core/graphicsEngine/WROIBox.h
+3
-2
src/core/graphicsEngine/WROISphere.cpp
src/core/graphicsEngine/WROISphere.cpp
+3
-1
src/core/graphicsEngine/WROISphere.h
src/core/graphicsEngine/WROISphere.h
+1
-1
src/core/graphicsEngine/algorithms/WMarchingLegoAlgorithm.h
src/core/graphicsEngine/algorithms/WMarchingLegoAlgorithm.h
+1
-0
src/core/graphicsEngine/offscreen/WGEOffscreenRenderPass.cpp
src/core/graphicsEngine/offscreen/WGEOffscreenRenderPass.cpp
+5
-0
src/core/graphicsEngine/offscreen/WGEOffscreenRenderPass.h
src/core/graphicsEngine/offscreen/WGEOffscreenRenderPass.h
+2
-0
No files found.
src/core/common/WColor.cpp
View file @
2d7c63d7
...
...
@@ -32,6 +32,22 @@
#include "../common/WStringUtils.h"
#include "WColor.h"
// initialize static palette
namespace
defaultColor
{
/** the default palette colors */
static
const
WColor
defaultPalette
[
22
]
=
{
// The standard colors
RED
,
GREEN
,
BLUE
,
YELLOW
,
ORANGE
,
PINK
,
CYAN
,
// the slightly lighter standard colors
LIGHTRED
,
LIGHTGREEN
,
LIGHTBLUE
,
LIGHTYELLOW
,
// the slighly darker standard colors
DARKRED
,
DARKGREEN
,
DARKBLUE
,
DARKYELLOW
,
VIOLET
,
TEAL
,
// black-white
BLACK
,
GRAY25
,
GRAY50
,
GRAY75
,
WHITE
};
}
// This function is taken from VTK 5.4.2. Since its BSD licensed the license
// notice follows below. It is not taken from FAnToM since it seems more self
// documenting.
...
...
src/core/common/WColor.h
View file @
2d7c63d7
...
...
@@ -25,8 +25,6 @@
#ifndef WCOLOR_H
#define WCOLOR_H
#include <iostream>
#include <osg/Vec4>
#include <osg/io_utils> // for the operator<< and operator>> for Vec4
...
...
@@ -105,16 +103,7 @@ namespace defaultColor
* This array is a simple palette definition containing the above colors. This palette is probably not very usable for all your special
* needs. DO NOT add thousand other palettes here. Define them for yourself, in your module.
*/
static
const
WColor
DefaultPalette
[
22
]
=
{
// The standard colors
RED
,
GREEN
,
BLUE
,
YELLOW
,
ORANGE
,
PINK
,
CYAN
,
// the slightly lighter standard colors
LIGHTRED
,
LIGHTGREEN
,
LIGHTBLUE
,
LIGHTYELLOW
,
// the slighly darker standard colors
DARKRED
,
DARKGREEN
,
DARKBLUE
,
DARKYELLOW
,
VIOLET
,
TEAL
,
// black-white
BLACK
,
GRAY25
,
GRAY50
,
GRAY75
,
WHITE
};
extern
const
WColor
DefaultPalette
[
22
];
}
#endif // WCOLOR_H
src/core/common/WPropertyTypes.h
View file @
2d7c63d7
...
...
@@ -640,7 +640,7 @@ namespace PROPERTY_TYPE_HELPER
/**
* Creates a string from the specified value.
*
* \param
v
the value to convert
* \param
tf
the value to convert
*
* \return the string representation
*/
...
...
src/core/common/WTransferFunction.cpp
View file @
2d7c63d7
...
...
@@ -24,6 +24,12 @@
#include <cassert>
#include <iostream>
#include <algorithm>
//#include <osg/Vec4>
//#include <osg/io_utils> // for the operator<< and operator>> for Vec4
#include "WTransferFunction.h"
bool
WTransferFunction
::
operator
==
(
const
WTransferFunction
&
rhs
)
const
...
...
src/core/common/WTransferFunction.h
View file @
2d7c63d7
...
...
@@ -25,13 +25,9 @@
#ifndef WTRANSFERFUNCTION_H
#define WTRANSFERFUNCTION_H
#include <iostream>
#include <vector>
#include <algorithm>
#include "WColor.h"
#include <osg/Vec4>
#include <osg/io_utils> // for the operator<< and operator>> for Vec4
#include "WExportCommon.h"
...
...
@@ -41,176 +37,228 @@
*/
class
WTransferFunction
{
private:
private:
struct
Entry
/**
* Prototype for a storage element
*/
struct
Entry
{
/**
* Default constructor
* \param iso the iso value
*/
explicit
Entry
(
double
iso
)
:
iso
(
iso
)
{
explicit
Entry
(
double
iso
)
:
iso
(
iso
)
{
}
}
bool
operator
<=
(
const
Entry
&
rhs
)
const
{
return
iso
<=
rhs
.
iso
;
}
/**
* comparison by isovalue
* \param rhs entry to compare t
*/
bool
operator
<=
(
const
Entry
&
rhs
)
const
{
return
iso
<=
rhs
.
iso
;
}
double
iso
;
};
double
iso
;
//< the isovalue
};
//typedef Entry LessPred;
struct
ColorEntry
:
public
Entry
/**
* Color entries are linearly interpolated colors along isovalues
*/
struct
ColorEntry
:
public
Entry
{
/** default constructor
* \param iso the isovalue
* \param color the color at the isovalue
*/
ColorEntry
(
double
iso
,
WColor
color
)
:
Entry
(
iso
),
color
(
color
)
{
}
/**
* comparison operator to check for changes
* \param rhs ColorEntry to compare to
*/
bool
operator
==
(
const
ColorEntry
&
rhs
)
const
{
return
iso
==
rhs
.
iso
&&
color
==
rhs
.
color
;
}
WColor
color
;
WColor
color
;
//< holds the current color at isovalue Entry::iso
};
struct
AlphaEntry
:
public
Entry
/**
* Alpha entries represent linearly interpolated transparency values
* along the isovalue scale. Alpha is in the range [ 0...1 ] where
* 1 signifies entirely opaque ( which makes it more an opacity value instead
* of alpha, but I use the commonly used language here )
*/
struct
AlphaEntry
:
public
Entry
{
AlphaEntry
(
double
iso
,
double
alpha
)
:
Entry
(
iso
),
alpha
(
alpha
)
/** default constructor
* \param iso the isovalue
* \param alpha the alpha at the isovalue in the range from 0 = transparent to 1 = opaque
*/
AlphaEntry
(
double
iso
,
double
alpha
)
:
Entry
(
iso
),
alpha
(
alpha
)
{
}
/**
* comparison operator to check for changes
* \param rhs AlphaEntry to compare to
*/
bool
operator
==
(
const
AlphaEntry
&
rhs
)
const
{
return
iso
==
rhs
.
iso
&&
alpha
==
rhs
.
alpha
;
}
double
alpha
;
double
alpha
;
//< holds the current alpha at isovalue Entry::iso
};
template
<
typename
T
>
struct
LessPred
/**
* Templatized comparison predicate for internal searching
*/
template
<
typename
T
>
struct
LessPred
{
explicit
LessPred
(
double
iso
)
:
iso
(
iso
)
{
explicit
LessPred
(
double
iso
)
:
iso
(
iso
)
{
}
}
bool
operator
()(
const
T
&
t
)
{
return
iso
<
t
.
iso
;
}
/** isovalue-based comparison */
bool
operator
()(
const
T
&
t
)
{
return
iso
<
t
.
iso
;
}
double
iso
;
};
double
iso
;
//< the isovalue to compare to
};
public:
WTransferFunction
()
:
isomin
(
0.
),
isomax
(
0.
)
public:
/** default constructor of a meaningless transfer function */
WTransferFunction
()
:
isomin
(
0.
),
isomax
(
0.
)
{
}
WTransferFunction
(
const
WTransferFunction
&
rhs
)
:
colors
(
rhs
.
colors
),
alphas
(
rhs
.
alphas
),
isomin
(
rhs
.
isomin
),
isomax
(
rhs
.
isomax
),
histogram
(
rhs
.
histogram
)
{
}
WTransferFunction
&
operator
=
(
const
WTransferFunction
&
rhs
)
{
this
->
colors
=
rhs
.
colors
;
this
->
alphas
=
rhs
.
alphas
;
this
->
isomin
=
rhs
.
isomin
;
this
->
isomax
=
rhs
.
isomax
;
this
->
histogram
=
rhs
.
histogram
;
return
(
*
this
);
}
bool
operator
==
(
const
WTransferFunction
&
rhs
)
const
;
/** deep copy constructor */
WTransferFunction
(
const
WTransferFunction
&
rhs
)
:
colors
(
rhs
.
colors
),
alphas
(
rhs
.
alphas
),
isomin
(
rhs
.
isomin
),
isomax
(
rhs
.
isomax
),
histogram
(
rhs
.
histogram
)
{
}
bool
operator
!=
(
const
WTransferFunction
&
rhs
)
const
;
/** deep copy operator */
WTransferFunction
&
operator
=
(
const
WTransferFunction
&
rhs
)
{
this
->
colors
=
rhs
.
colors
;
this
->
alphas
=
rhs
.
alphas
;
this
->
isomin
=
rhs
.
isomin
;
this
->
isomax
=
rhs
.
isomax
;
this
->
histogram
=
rhs
.
histogram
;
return
(
*
this
);
}
~
WTransferFunction
()
{
}
/**
* \returns true if this object contains exactly the same
* data as rhs
* \param rhs object to compare with
*/
bool
operator
==
(
const
WTransferFunction
&
rhs
)
const
;
size_t
numAlphas
()
const
{
return
alphas
.
size
();
}
/**
* \returns negated result of operator==
*/
bool
operator
!=
(
const
WTransferFunction
&
rhs
)
const
;
size_t
numColors
()
const
{
return
colors
.
size
();
}
/** default destuctor */
~
WTransferFunction
()
{
}
double
getAlphaIsovalue
(
size_t
i
)
const
{
return
alphas
.
at
(
i
).
iso
;
}
size_t
numAlphas
(
)
const
{
return
alphas
.
size
()
;
}
double
getColorIsovalue
(
size_t
i
)
const
{
return
colors
.
at
(
i
).
iso
;
}
size_t
numColors
(
)
const
{
return
colors
.
size
()
;
}
double
getAlpha
(
size_t
i
)
const
{
return
alphas
.
at
(
i
).
alpha
;
}
double
getAlpha
Isovalue
(
size_t
i
)
const
{
return
alphas
.
at
(
i
).
iso
;
}
const
WColor
&
getColor
(
size_t
i
)
const
{
return
colors
.
at
(
i
).
color
;
}
double
getColor
Isovalue
(
size_t
i
)
const
{
return
colors
.
at
(
i
).
iso
;
}
/**
* insert a new color point
*/
void
addColor
(
double
iso
,
const
WColor
&
color
);
double
getAlpha
(
size_t
i
)
const
{
return
alphas
.
at
(
i
).
alpha
;
}
/**
* insert a new alpha point
*/
void
addAlpha
(
double
iso
,
double
alpha
);
const
WColor
&
getColor
(
size_t
i
)
const
{
return
colors
.
at
(
i
).
color
;
}
/**
* set the histogram going along with the transfer function
*
* This should be changed in the future to be handled in a different
* way. A good option would be to introduce an object encapsulating
* a transfer function and histogram information.
*/
void
setHistogram
(
std
::
vector
<
double
>
&
data
)
{
histogram
.
swap
(
data
);
}
/**
* insert a new color point
*/
void
addColor
(
double
iso
,
const
WColor
&
color
);
/**
* insert a new alpha point
*/
void
addAlpha
(
double
iso
,
double
alpha
);
/**
* set the histogram going along with the transfer function
*
* This should be changed in the future to be handled in a different
* way. A good option would be to introduce an object encapsulating
* a transfer function and histogram information.
*/
void
setHistogram
(
std
::
vector
<
double
>
&
data
)
{
histogram
.
swap
(
data
);
}
/**
* clears the histogram data so the gui won't show any
*/
void
removeHistogram
()
{
histogram
.
clear
();
}
/**
* clears the histogram data so the gui won't show any
*/
void
removeHistogram
()
{
histogram
.
clear
();
}
const
std
::
vector
<
double
>&
getHistogram
()
const
{
return
histogram
;
}
const
std
::
vector
<
double
>&
getHistogram
()
const
{
return
histogram
;
}
/**
* sample/render the transfer function linearly between min and max in an RGBA texture.
* \param width is the number of RGBA samples.
* \param min the lowest value to be sampled
* \param max the hightes value to be sampled
* \post array contains the sampled data
*/
void
sample1DTransferFunction
(
unsigned
char
*
array
,
int
width
,
double
min
,
double
max
)
const
;
private:
/**
* sample/render the transfer function linearly between min and max in an RGBA texture.
* \param width is the number of RGBA samples.
* \param min the lowest value to be sampled
* \param max the hightes value to be sampled
* \post array contains the sampled data
*/
void
sample1DTransferFunction
(
unsigned
char
*
array
,
int
width
,
double
min
,
double
max
)
const
;
private:
std
::
vector
<
ColorEntry
>
colors
;
std
::
vector
<
AlphaEntry
>
alphas
;
std
::
vector
<
ColorEntry
>
colors
;
//< sorted list of colors
std
::
vector
<
AlphaEntry
>
alphas
;
//< sorted list of alpha values
double
isomin
;
double
isomax
;
double
isomin
;
//< smallest iso value
double
isomax
;
//< largest iso value
std
::
vector
<
double
>
histogram
;
std
::
vector
<
double
>
histogram
;
//< store a histogram. This is used for property-handling only
// and does not change the transfer function at all.
};
#endif // WTRANSFERFUNCTION_H
src/core/graphicsEngine/WFiberDrawable.h
View file @
2d7c63d7
...
...
@@ -32,8 +32,8 @@
#include <boost/thread/thread.hpp>
#include <osg/Drawable>
#include <osg/ShapeDrawable>
#include <osg/Group>
//
#include <osg/ShapeDrawable>
//
#include <osg/Group>
#include "WExportWGE.h"
...
...
src/core/graphicsEngine/WGEGroupNode.cpp
View file @
2d7c63d7
...
...
@@ -23,7 +23,7 @@
//---------------------------------------------------------------------------
#include <iostream>
#include <set>
//
#include <set>
#include <osg/ShapeDrawable>
#include <osg/MatrixTransform>
...
...
src/core/graphicsEngine/WGEGroupNode.h
View file @
2d7c63d7
...
...
@@ -26,14 +26,14 @@
#define WGEGROUPNODE_H
#include <queue>
#include <utility>
//
#include <utility>
#include <boost/thread.hpp>
#include <osg/MatrixTransform>
#include <osg/NodeCallback>
#include "../common/WCondition.h"
//
#include "../common/WCondition.h"
#include "../common/WPredicateHelper.h"
#include "WExportWGE.h"
...
...
src/core/graphicsEngine/WGEViewer.cpp
View file @
2d7c63d7
...
...
@@ -43,11 +43,14 @@
#include "exceptions/WGEInitFailed.h"
#include "WGE2DManipulator.h"
#include "WGEGroupNode.h"
#include "WGENoOpManipulator.h"
#include "WGEZoomTrackballManipulator.h"
#include "WPickHandler.h"
#include "../common/WConditionOneShot.h"
#include "../common/WThreadedRunner.h"
#include "WGEViewer.h"
WGEViewer
::
WGEViewer
(
std
::
string
name
,
osg
::
ref_ptr
<
osg
::
Referenced
>
wdata
,
int
x
,
int
y
,
...
...
src/core/graphicsEngine/WGEViewer.h
View file @
2d7c63d7
...
...
@@ -32,11 +32,8 @@
#include <osg/Node>
#include <osg/Version>
#include <osgGA/DriveManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/TerrainManipulator>
#include <osgGA/UFOManipulator>
#include <osgViewer/View>
#include <osgViewer/Viewer>
// OSG interface changed in 2.9.7, to make it compile also with those versions we do this:
// OSG_MIN_VERSION_REQUIRED(2, 9, 8) macro is not available in e.g. OSG 2.8.1, hence we use the old way
...
...
@@ -53,13 +50,14 @@
#include "../common/WColor.h"
#include "../common/WFlag.h"
#include "../common/WThreadedRunner.h"
#include "WExportWGE.h"
#include "WGECamera.h"
#include "WGEGraphicsWindow.h"
#include "WGEGroupNode.h"
//#include "WGEGroupNode.h"
class
WGEGroupNode
;
#include "WGEScreenCapture.h"
#include "WPickHandler.h"
//#include "WPickHandler.h"
class
WPickHandler
;
#include "animation/WGEAnimationManipulator.h"
/**
...
...
src/core/graphicsEngine/WGraphicsEngine.cpp
View file @
2d7c63d7
...
...
@@ -73,7 +73,12 @@ WGraphicsEngine::~WGraphicsEngine()
void
WGraphicsEngine
::
setMultiThreadedViews
(
bool
enable
)
{
#ifndef __APPLE__
#ifdef __APPLE__
if
(
enable
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"WGraphicsEngine::setMultiThreadedViews not implemented for OSX, yet"
,
"GE"
,
LL_INFO
);
}
#else
// ThreadingModel: enum with the following possibilities
//
// SingleThreaded
...
...
src/core/graphicsEngine/WGraphicsEngine.h
View file @
2d7c63d7
...
...
@@ -27,13 +27,13 @@
#include <map>
#include <string>
#include <vector>
//
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/function.hpp>
//
#include <boost/function.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
//
#include <boost/thread/thread.hpp>
#include <osg/Camera>
#include <osg/Texture3D>
...
...
@@ -41,8 +41,8 @@
#include <osg/Vec4>
#include <osg/ref_ptr>
#include <osgViewer/CompositeViewer>
#include <osgViewer/View>
#include <osgViewer/Viewer>
//
#include <osgViewer/View>
//
#include <osgViewer/Viewer>
#include "../common/WThreadedRunner.h"
#include "../common/WConditionOneShot.h"
...
...
src/core/graphicsEngine/WPickHandler.cpp
View file @
2d7c63d7
...
...
@@ -22,15 +22,14 @@
//
//---------------------------------------------------------------------------
#include <iostream>
//
#include <iostream>
#include <string>
#include <osg/Vec3>
//
#include <osg/Vec3>
#include "../common/math/linearAlgebra/WLinearAlgebra.h"
//
#include "../common/math/linearAlgebra/WLinearAlgebra.h"
#include "WPickHandler.h"
#include "WPickInfo.h"
WPickHandler
::
WPickHandler
()
:
m_hitResult
(
WPickInfo
()
),
...
...
src/core/graphicsEngine/WPickHandler.h
View file @
2d7c63d7
...
...
@@ -25,26 +25,26 @@
#ifndef WPICKHANDLER_H
#define WPICKHANDLER_H
#include <sstream>
//
#include <sstream>
#include <string>
#include <boost/signals2/signal.hpp>
#include <osgUtil/Optimizer>
#include <osgDB/ReadFile>
#include <osgViewer/View
er
>
#include <osgViewer/CompositeViewer>
#include <osg/Material>
#include <osg/Geode>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/Projection>
#include <osg/MatrixTransform>
#include <osg/Camera>
#include <osg/io_utils>
#include <osg/ShapeDrawable>
#include <osgText/Text>
//
#include <osgUtil/Optimizer>
//
#include <osgDB/ReadFile>
#include <osgViewer/View>
//
#include <osgViewer/CompositeViewer>