Commit c3e12e05 by Alexander Wiebel

[MERGE]

parents 8e0581fe d989572a
......@@ -49,6 +49,11 @@ osg::Matrixd WGEZoomTrackballManipulator::getMatrix() const
return osg::Matrixd::scale( 1.0 / m_zoom, 1.0 / m_zoom, 1.0 / m_zoom ) * TrackballManipulator::getMatrix();
}
osg::Matrixd WGEZoomTrackballManipulator::getMatrixWithoutZoom() const
{
return TrackballManipulator::getMatrix();
}
osg::Matrixd WGEZoomTrackballManipulator::getInverseMatrix() const
{
return TrackballManipulator::getInverseMatrix() * osg::Matrixd::scale( m_zoom, m_zoom, m_zoom );
......
......@@ -51,6 +51,13 @@ public:
virtual osg::Matrixd getMatrix() const;
/**
* Get the manipulator only containing rotation and translation.
*
* \return the matrix with translation and rotation.
*/
virtual osg::Matrixd getMatrixWithoutZoom() const;
/**
* Get the position of the manipulator as a inverse matrix of the
* manipulator, typically used as a model view matrix.
*/
......
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 "OWmodule_${MODULE_NAME}" ) # prefix all module names with "OWmodule_" to separate them from other libs
# Build module lib
ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} OWkernel )
# 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}"
"OWkernel;${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 )
//---------------------------------------------------------------------------
//
// 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 WMCOORDINATEHUD_H
#define WMCOORDINATEHUD_H
#include <string>
#include <osg/Geode>
#include "../../common/WItemSelection.h"
#include "../../common/WItemSelector.h"
#include "../../graphicsEngine/WGEManagedGroupNode.h"
#include "../../graphicsEngine/WGEZoomTrackballManipulator.h"
#include "../../graphicsEngine/WShader.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
/**
* This module shows a coordinatesystem as HUD.
* The attenuation can be customized to users needs.
*/
class WMCoordinateHUD: public WModule, public osg::Referenced
{
public:
/**
* Default constructor.
*/
WMCoordinateHUD();
/**
* Destructor.
*/
virtual ~WMCoordinateHUD();
/**
* 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();
/**
* Build the geode for colorfull coordinate axis
*/
virtual void buildColorAxis();
/**
* build the geode for black & white coordinate axis
*/
virtual void buildBWAxis();
/**
* build the geode for black & white coordinate cube
*/
virtual void buildColorCube();
/**
* build the geometry of the cube
*/
virtual osg::Vec3Array* buildCubeVertices();
/**
* build the geometry of the axis
*/
virtual osg::Vec3Array* buildAxisVertices();
/**
* create caption for medical plane
*/
virtual void buildCaption();
/**
* The root node used for this modules graphics.
*/
osg::ref_ptr< WGEManagedGroupNode > m_rootNode;
/**
* The geometry rendered by this module.
*/
osg::ref_ptr< osg::Geode > m_geode;
/**
* The caption rendered by this module.
*/
osg::ref_ptr< osg::Geode > m_txtGeode;
private:
/**
* the shader
*/
osg::ref_ptr< WShader > m_shader;
/**
* A condition used to notify about changes in several properties.
*/
boost::shared_ptr< WCondition > m_propCondition;
/**
* A property allowing the user to select ONE item of some list
*/
WPropSelection m_aSingleSelection;
/**
* A list of items that can be selected using m_aSingleSelection or m_aMultiSelection.
*/
boost::shared_ptr< WItemSelection > m_possibleSelections;
};
#endif // WMCOORDINATEHUD_H
/* XPM */
static const char * coordinateHUD_xpm[] = {
"16 16 5 1",
" c None",
". c #FF0000",
"+ c #0072FF",
"@ c #000000",
"# c #12FF00",
".. ++",
".. ++",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".@@ @+@@ @ @@@@ ",
".@@ @+@@ @ @@ @@",
".@@@@ @@ @ @@ @",
".@@+@ @@ @ @@ @@",
".@@#@#@@@@#@@@@#",
"..##############"};
/* XPM */
static const char * option_1_xpm[] = {
"16 16 4 1",
" c None",
". c #FF0000",
"+ c #0072FF",
"@ c #12FF00",
".. ++",
".. ++",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
"..++ ",
"..++ ",
"..@@@@@@@@@@@@@@",
"..@@@@@@@@@@@@@@"};
/* XPM */
static const char * option_2_xpm[] = {
"16 16 4 1",
" c None",
". c #363636",
"+ c #646464",
"@ c #BABABA",
".. ++",
".. ++",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
".. ++ ",
"..++ ",
"..++ ",
"..@@@@@@@@@@@@@@",
"..@@@@@@@@@@@@@@"};
/* XPM */
static const char * option_3_xpm[] = {
"16 16 4 1",
" c None",
". c #0072FF",
"+ c #12FF00",
"@ c #FF0000",
" ",
" ",
" ",
" ........... ",
" ...........+ ",
" ...........++ ",
"...........+++ ",
"@@@@@@@@@@++++ ",
"@@@@@@@@@@++++ ",
"@@@@@@@@@@++++ ",
"@@@@@@@@@@++++ ",
"@@@@@@@@@@++++ ",
"@@@@@@@@@@++++ ",
"@@@@@@@@@@+++ ",
"@@@@@@@@@@++ ",
"@@@@@@@@@@+ "};
//---------------------------------------------------------------------------
//
// 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
void main()
{
// simply set the color. All the magic happens in vertex shader.
gl_FragColor = gl_Color;
// this line ensures that the coordinate system is always on top.
gl_FragDepth = 0.001 * gl_FragCoord.z;
}
//---------------------------------------------------------------------------
//
// 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
void main ()
{
// keep color
gl_FrontColor = gl_Color;
// get the scaling applied during transformation from model space to camera space
vec4 vertexScale = gl_ModelViewMatrix * vec4( 1.0, 0.0, 0.0, 0.0 ); // <- needs to be of length 1
float s = 1.0 / length( vertexScale );
float size = 25.0;
// project
vec4 vertexInScreenSpace = gl_ModelViewProjectionMatrix * vec4( s * size * gl_Vertex.xyz, 0.0 );
vertexInScreenSpace.w = 1.0;
gl_Position = vec4( -0.75, -0.75, 0.0, 0.0 ) + vertexInScreenSpace;
}
......@@ -2,6 +2,7 @@
ADD_SUBDIRECTORY( arbitraryRois )
ADD_SUBDIRECTORY( boundingBox )
ADD_SUBDIRECTORY( coordinateHUD )
ADD_SUBDIRECTORY( coordinateSystem )
ADD_SUBDIRECTORY( distanceMap )
ADD_SUBDIRECTORY( distanceMapIsosurface )
......
ADD_SUBDIRECTORY( applyMask )
ADD_SUBDIRECTORY( arbitraryPlane )
ADD_SUBDIRECTORY( atlasSurfaces )
ADD_SUBDIRECTORY( clusterParamDisplay )
ADD_SUBDIRECTORY( clusterSlicer )
......@@ -14,8 +16,6 @@ ADD_SUBDIRECTORY( probTractDisplay )
ADD_SUBDIRECTORY( scalarSegmentation )
ADD_SUBDIRECTORY( splineSurface )
ADD_SUBDIRECTORY( surfaceParameterAnimator )
ADD_SUBDIRECTORY( applyMask )
ADD_SUBDIRECTORY( arbitraryPlane )
IF( Teem_FOUND )
ADD_SUBDIRECTORY( homeGlyphs )
......
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