Commit dcdcf30d authored by Stefan Philips's avatar Stefan Philips

[MERGE]

parents b46f4c5c e12301ed
......@@ -46,6 +46,14 @@
*/
typedef Eigen::Matrix< double, 3, 1 > WVector3D_2;
/**
* The new vector type. It is a stack-allocated double vector with three dimension.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::Matrix< double, 2, 1 > WVector2D_2;
/**
* Define WPosition as an alias for WVector3D_2
*
......
......@@ -30,6 +30,7 @@
#include "../common/math/WPosition.h"
#include "../common/math/WVector3D.h"
#include "../common/WDefines.h"
#include "WExportWGE.h"
......@@ -134,7 +135,14 @@ public:
/**
* Get pixel coordinates where object was hit.
*/
inline std::pair< float, float > getPickPixelPosition() const;
OW_API_DEPRECATED inline std::pair< float, float > getPickPixelPosition() const;
/**
* Returns the picked pixel coordinates in screen-space.
*
* \return the coordinates
*/
inline WVector2D_2 getPickPixel() const;
/**
* Tests two pick infos for equality
......@@ -244,4 +252,9 @@ inline bool WPickInfo::operator!=( WPickInfo rhs ) const
return !( *this == rhs );
}
inline WVector2D_2 WPickInfo::getPickPixel() const
{
return WVector2D_2( m_pixelCoords.first, m_pixelCoords.second );
}
#endif // WPICKINFO_H
......@@ -209,9 +209,6 @@ void WMImageSpaceLIC::initOSG( boost::shared_ptr< WGridRegular3D > grid, boost::
}
else
{
// we want the tex matrix for each slice to be modified too,
osg::ref_ptr< osg::TexMat > texMat;
// create a new geode containing the slices
osg::ref_ptr< osg::Node > xSlice = wge::genFinitePlane( grid->getOrigin(), grid->getNbCoordsY() * grid->getDirectionY(),
grid->getNbCoordsZ() * grid->getDirectionZ() );
......
......@@ -83,10 +83,10 @@ void main()
vec3 plainColor = u_cmapRatio * cmap + ( 1.0 - u_cmapRatio ) * vec3( u_contrastingS * pow( advected, u_contrastingP ) );
// MPI Paper Hack: {
/*plainColor = u_cmapRatio * cmap;
plainColor += 1.5*( 1.0 - u_cmapRatio ) * vec3( u_contrastingS * pow( advected, u_contrastingP ), 0.0, 0.0 );
if ( isZero( cmap.r, 0.1 ) )
discard;*/
// plainColor = u_cmapRatio * cmap;
// plainColor += 1.5*( 1.0 - u_cmapRatio ) * vec3( u_contrastingS * pow( advected, u_contrastingP ), 0.0, 0.0 );
// if ( isZero( cmap.r, 0.1 ) )
// discard;
// }
gl_FragColor = vec4(
......
......@@ -140,19 +140,19 @@ void main()
#endif
// MPI PAper Hack: {
/* vec4 cmap = colormapping();
gl_FragData[1] = vec4( vec3( cmap.r ), 1.0 );
if ( cmap.r < 0.15 )
discard;
if ( isZero( cmap.r - 0.2, 0.1 ) )
gl_FragData[1] = vec4( 0.25, 0.0, 0.0, 1.0 );
if ( isZero( cmap.r - 0.3, 0.1 ) )
gl_FragData[1] = vec4( 0.5, 0.0, 0.0, 1.0 );
if ( isZero( cmap.r - 1.0, 0.15 ) )
gl_FragData[1] = vec4( 1.0, 0.0, 0.0, 1.0 );
// vec4 cmap = colormapping();
// gl_FragData[1] = vec4( vec3( cmap.r ), 1.0 );
//
// if ( cmap.r < 0.15 )
// discard;
// if ( isZero( cmap.r - 0.2, 0.1 ) )
// gl_FragData[1] = vec4( 0.25, 0.0, 0.0, 1.0 );
// if ( isZero( cmap.r - 0.3, 0.1 ) )
// gl_FragData[1] = vec4( 0.5, 0.0, 0.0, 1.0 );
// if ( isZero( cmap.r - 1.0, 0.15 ) )
// gl_FragData[1] = vec4( 1.0, 0.0, 0.0, 1.0 );
// }
*/
// is the vector very orthogonal to the surface?
float dotS = dot( v_normal, vec.xyz );
......
......@@ -14,6 +14,7 @@ ADD_SUBDIRECTORY( imageSpaceLIC )
ADD_SUBDIRECTORY( isosurfaceRaytracer )
ADD_SUBDIRECTORY( lic )
ADD_SUBDIRECTORY( marchingCubes )
ADD_SUBDIRECTORY( navigationSlices )
ADD_SUBDIRECTORY( overlayAtlas )
ADD_SUBDIRECTORY( paintTexture )
ADD_SUBDIRECTORY( superquadricGlyphs )
......
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
# Grab module name and setup target directories
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_TARGET_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/modules/${MODULE_NAME} )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MODULE_TARGET_DIR} )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MODULE_TARGET_DIR} )
SET( MODULE_DIRNAME ${MODULE_NAME} )
SET( MODULE_NAME "${OWmodulesPrefix}_${MODULE_NAME}" ) # prefix all module names with "OWmodule_" to separate them from other libs
SET( ${MODULE_NAME}_COMBINER_SRC ${MODULES_SRC} )
SET( ${MODULE_NAME}_ALL_CPP ${MODULES_SRC} )
FILE( GLOB_RECURSE ${MODULE_NAME}_REMOVE_H "*.h" )
LIST( REMOVE_ITEM ${MODULE_NAME}_ALL_CPP ${${MODULE_NAME}_REMOVE_H} )
IF( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/" )
FILE( GLOB_RECURSE ${MODULE_NAME}_REMOVE_TEST "test/*.cpp" "test/*.h" )
LIST( REMOVE_ITEM ${MODULE_NAME}_ALL_CPP ${${MODULE_NAME}_REMOVE_TEST} )
LIST( REMOVE_ITEM ${MODULE_NAME}_COMBINER_SRC ${${MODULE_NAME}_REMOVE_TEST} )
ENDIF( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/" )
LIST( LENGTH ${MODULE_NAME}_ALL_CPP cpp_count )
IF( ${cpp_count} GREATER 3 )
IF( OW_BUILD_AS_ONE_BIG_FILE )
SET( UNITY_BUILD_FILE_NAME "${MODULE_NAME}UnityBuildFile.cpp" )
GENERATE_UNITY_BUILD_FILE( ${MODULE_NAME}_ALL_CPP )
ADD_LIBRARY( ${MODULE_NAME} SHARED ${UNITY_BUILD_FILE_NAME} ${${MODULE_NAME}_COMBINER_SRC} )
ENDIF( OW_BUILD_AS_ONE_BIG_FILE )
ENDIF( ${cpp_count} GREATER 3 )
IF( ( NOT OW_BUILD_AS_ONE_BIG_FILE ) OR NOT ( ${cpp_count} GREATER 3 ) )
ADD_LIBRARY( ${MODULE_NAME} SHARED ${${MODULE_NAME}_COMBINER_SRC} )
ENDIF( ( NOT OW_BUILD_AS_ONE_BIG_FILE ) OR NOT ( ${cpp_count} GREATER 3 ) )
# Build module lib
#ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OWKernelName} )
IF(MSVC_IDE)
SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES PREFIX "../")
ENDIF(MSVC_IDE)
# Copy local shaders to module target directory
IF( OW_COPY_SHADERS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/shaders ) # copy shaders only if the user wants it
ADD_CUSTOM_TARGET( ${MODULE_NAME}_CopyShaders
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${MODULE_TARGET_DIR}/shaders/
COMMENT "Copy shaders of ${MODULE_NAME}"
)
ADD_DEPENDENCIES( ${MODULE_NAME} ${MODULE_NAME}_CopyShaders )
ENDIF()
# Build unit tests
IF( OW_COMPILE_TESTS )
# This ensures that the test is copied to the module directory
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MODULE_TARGET_DIR} )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"${OWKernelName};${MODULE_NAME}"
)
# Copy fixtures if they exist
IF( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/fixtures )
ADD_CUSTOM_TARGET( ${MODULE_NAME}_CopyFixtures
# as the "test" target runs in CMakes temporary build dir, the fixtures need to be placed there too.
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/test/fixtures ${CMAKE_BINARY_DIR}/modules/${MODULE_DIRNAME}/fixtures/
COMMENT "Copy fixtures of ${MODULE_NAME}"
)
ADD_DEPENDENCIES( ${MODULE_NAME} ${MODULE_NAME}_CopyFixtures )
ENDIF( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/fixtures )
ENDIF( OW_COMPILE_TESTS )
This diff is collapsed.
//---------------------------------------------------------------------------
//
// 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/>.
//
//---------------------------------------------------------------------------
#ifndef WMNAVIGATIONSLICES_H
#define WMNAVIGATIONSLICES_H
#include <string>
#include <vector>
#include <osg/Camera>
#include <boost/signals2.hpp>
#include "../../graphicsEngine/WGEManagedGroupNode.h"
#include "../../common/WPropertyTypes.h"
#include "../../graphicsEngine/WPickInfo.h"
#include "../../kernel/WModule.h"
/**
* This module provides simple slices that can be color-mapped. It is the default navigation tool for three-dimensional datasets.
*
* \ingroup modules
*/
class WMNavigationSlices: public WModule
{
public:
/**
* Default constructor.
*/
WMNavigationSlices();
/**
* Destructor.
*/
virtual ~WMNavigationSlices();
/**
* Gives back the name of this module.
* \return the module's name.
*/
virtual const std::string getName() const;
/**
* Gives back a description of this module.
* \return description to module.
*/
virtual const std::string getDescription() const;
/**
* Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
* should never be initialized or modified in some other way. A simple new instance is required.
*
* \return the prototype used to create every module in OpenWalnut.
*/
virtual boost::shared_ptr< WModule > factory() const;
/**
* Get the icon for this module in XPM format.
*/
virtual const char** getXPMIcon() const;
protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual void moduleMain();
/**
* Initialize the connectors this module is using.
*/
virtual void connectors();
/**
* Initialize the properties for this module.
*/
virtual void properties();
private:
/**
* Initializes the needed geodes, transformations and vertex arrays.
*/
void initOSG();
/**
* Handles picking events.
*/
class PickCallback
{
public:
/**
* For the lazy guys.
*/
typedef boost::shared_ptr< PickCallback > SPtr;
/**
* The callback, controlling
*
* \param property the property controlling the position of the slice
* \param node the node getting controlled by this instance.
* \param negateDirection if true, the translation direction is switched.
*/
PickCallback( osg::ref_ptr< osg::Node > node, WPropDouble property, bool negateDirection = false );
private:
/**
* Pick event handler. Uses for dragging the slices
*
* \param pickInfo the pick information.
*/
void pick( WPickInfo pickInfo );
/**
* The pick connection for the pick() event handler.
*/
boost::signals2::scoped_connection m_pickConnection;
/**
* The slice node. Used for checking if picked.
*/
osg::ref_ptr< osg::Node > m_node;
/**
* The property controlling the position of the slice
*/
WPropDouble m_property;
/**
* The camera under which the node is placed. Needed for proper back-projection.
*/
osg::ref_ptr< osg::Camera > m_camera;
/**
* If true, the item is still picked.
*/
bool m_isPicked;
/**
* The stored pixel position of a previous drag event.
*/
WVector2D_2 m_oldPixelPosition;
/**
* The transformation direction. This is needed since the OSG coord system has a mirrored coronal direction.
*/
float m_dir;
};
/**
* X-Slice pick callback.
*/
PickCallback::SPtr m_xSlicePicker;
/**
* Y-Slice pick callback.
*/
PickCallback::SPtr m_ySlicePicker;
/**
* Z-Slice pick callback.
*/
PickCallback::SPtr m_zSlicePicker;
/**
* A condition used to notify about changes in several properties.
*/
boost::shared_ptr< WCondition > m_propCondition;
/**
* The Geode containing all the slices and the mesh
*/
osg::ref_ptr< WGEManagedGroupNode > m_output;
WPropGroup m_sliceGroup; //!< the group contains several slice properties
WPropDouble m_xPos; //!< x position of the slice
WPropDouble m_yPos; //!< y position of the slice
WPropDouble m_zPos; //!< z position of the slice
WPropBool m_showonX; //!< indicates whether the vector should be shown on slice X
WPropBool m_showonY; //!< indicates whether the vector should be shown on slice Y
WPropBool m_showonZ; //!< indicates whether the vector should be shown on slice Z
};
#endif // WMNAVIGATIONSLICES_H
/* XPM */
static const char * WMNavigationSlices_xpm[] = {
"16 16 59 1",
" c None",
". c #000000",
"+ c #666666",
"@ c #262626",
"# c #7B7B7B",
"$ c #676767",
"% c #8E8E8E",
"& c #4B4B4B",
"* c #B3B3B3",
"= c #848484",
"- c #9D9D9D",
"; c #464646",
"> c #3C3C3C",
", c #808080",
"' c #4C4C4C",
") c #8D8D8D",
"! c #969696",
"~ c #767676",
"{ c #6E6E6E",
"] c #585858",
"^ c #898989",
"/ c #5E5E5E",
"( c #C0C0C0",
"_ c #E1E1E1",
": c #D0D0D0",
"< c #6F6F6F",
"[ c #707070",
"} c #191919",
"| c #7A7A7A",
"1 c #4E4E4E",
"2 c #D8D8D8",
"3 c #E5E5E5",
"4 c #999999",
"5 c #BFBFBF",
"6 c #BBBBBB",
"7 c #2C2C2C",
"8 c #A7A7A7",
"9 c #CCCCCC",
"0 c #D9D9D9",
"a c #8F8F8F",
"b c #141414",
"c c #333333",
"d c #858585",
"e c #3A3A3A",
"f c #F8F8F8",
"g c #F2F2F2",
"h c #A9A9A9",
"i c #B2B2B2",
"j c #050505",
"k c #868686",
"l c #6D6D6D",
"m c #505050",
"n c #DEDEDE",
"o c #B6B6B6",
"p c #9B9B9B",
"q c #616161",
"r c #888888",
"s c #AFAFAF",
"t c #818181",
" .. ",
" .... ... ",
" .......... ",
" ..+@#.$..... ",
" .%&*.=-;>... ",
" .,%.')!~{].. ",
" .^../(_:<[...",
" }|..-1234=...",
" .56.78:,90ab..",
" ..cd.1efghi=.. ",
"..jkl.mnopcq... ",
"....].rst%..... ",
" ............ ",
" ......... ",
" .. ",
" .. "};
//---------------------------------------------------------------------------
//
// 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/>.
//
//---------------------------------------------------------------------------
#version 120
#include "WGEColormapping-fragment.glsl"
/**
* Applies colormapping.
*/
void main()
{
vec4 cmap = colormapping();
gl_FragColor = cmap;
}
//---------------------------------------------------------------------------
//
// 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/>.
//
//---------------------------------------------------------------------------
#version 120
#include "WGEColormapping-vertex.glsl"
/**
* Vertex Main. Simply transforms the geometry. The work is done per fragment.
*/
void main()
{
// Allow the colormapper to do some precalculations with the real vertex coordinate in ow-scene-space
colormapping( gl_Vertex );
// transform position
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment