Commit 983990bc authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[MERGE]

parents c9808d6d f7bf97f5
......@@ -168,6 +168,17 @@ public:
protected:
private:
/**
* Checks if the two given intervals intersect and computes the distance between them.
*
* \param a0 lower bound of the first interval
* \param a1 upper bound of the first interval
* \param b0 lower bound of the second interval
* \param b1 upper bound if the second interval
*
* \return The distance between those intervals if they don't overlap, zero otherwise
*/
double intervalDistance( double a0, double a1, double b0, double b1 ) const;
};
template< class VT >
......@@ -223,33 +234,18 @@ inline bool WBoundingBoxImpl< VT >::intersects( const WBoundingBoxImpl< VT > &bb
return osg::BoundingBoxImpl< VT >::intersects( bb );
}
/**
* Anonymous namespace, just to be DRY in minDistance.
*/
namespace
template< class VT >
inline double WBoundingBoxImpl< VT >::intervalDistance( double a0, double a1, double b0, double b1 ) const
{
/**
* Checks if the two given intervals intersect and computes the distance between them.
*
* \param a0 lower bound of the first interval
* \param a1 upper bound of the first interval
* \param b0 lower bound of the second interval
* \param b1 upper bound if the second interval
*
* \return The distance between those intervals if they don't overlap, zero otherwise
*/
inline double intervalDistance( double a0, double a1, double b0, double b1 )
if( a1 < b0 )
{
if( a1 < b0 )
{
return b0 - a1;
}
else if( b1 < a0 )
{
return a0 - b1;
}
return 0.0;
return b0 - a1;
}
else if( b1 < a0 )
{
return a0 - b1;
}
return 0.0;
}
template< class VT >
......
......@@ -54,22 +54,24 @@ typedef boost::array< std::pair< std::complex< double >, WVector3d >, 3 > EigenS
std::ostream& operator<<( std::ostream& os, const RealEigenSystem& sys );
namespace
/**
* Helper function to sort eigen values on their size. As each eigenvalues has an eigenvector they must be twiddled the same.
*
* \param es Eigensystem consisting of eigenvalues and eigenvectors.
*/
void sortRealEigenSystem( RealEigenSystem* es )
{
void sortRealEigenSystem( RealEigenSystem* es )
if( ( *es )[0].first > ( *es )[2].first )
{
if( ( *es )[0].first > ( *es )[2].first )
{
std::swap( ( *es )[0], ( *es )[2] );
}
if( ( *es )[0].first > ( *es )[1].first )
{
std::swap( ( *es )[0], ( *es )[1] );
}
if( ( *es )[1].first > ( *es )[2].first )
{
std::swap( ( *es )[1], ( *es )[2] );
}
std::swap( ( *es )[0], ( *es )[2] );
}
if( ( *es )[0].first > ( *es )[1].first )
{
std::swap( ( *es )[0], ( *es )[1] );
}
if( ( *es )[1].first > ( *es )[2].first )
{
std::swap( ( *es )[1], ( *es )[2] );
}
}
......
......@@ -145,24 +145,36 @@ osg::ref_ptr< osg::Texture2D > WGEOffscreenRenderPass::createTexture( GLint inte
tex->setSourceType( GL_FLOAT );
tex->setSourceFormat( GL_RED );
break;
// Those ifdef's where introduced, as otherwise OW would not compile on older platforms where no newer OpenGL is available.
#ifdef GL_RGB16F
case GL_RGB16F:
tex->setSourceType( GL_HALF_FLOAT );
tex->setSourceFormat( GL_RGB );
break;
#endif
#ifdef GL_RGBA16F
case GL_RGBA16F:
tex->setSourceType( GL_HALF_FLOAT );
tex->setSourceFormat( GL_RGBA );
break;
case GL_RGB32F:
#endif
#ifdef GL_RGB32F
case GL_RGB32F:
tex->setSourceType( GL_FLOAT );
tex->setSourceFormat( GL_RGB );
break;
case GL_RGBA32F:
#endif
#ifdef GL_RGBA32F
case GL_RGBA32F:
tex->setSourceType( GL_FLOAT );
tex->setSourceFormat( GL_RGBA );
break;
#endif
default:
// keep default format and type
wlog::warn( "WGEOffscreenRenderPass" ) << "Unsupported OpenGL internal format used, this is not available on your platform: " << internalFormat;
break;
}
......
......@@ -41,7 +41,7 @@ FIND_PACKAGE( Qt4 REQUIRED )
MARK_AS_ADVANCED( FORCE QT_QMAKE_EXECUTABLE )
# Includes:
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( SYSTEM ${QT_INCLUDE_DIR} )
# Libraries for linking:
SET( QT_LIBS ${QT_QTCORE_LIBRARY}
......
......@@ -5,20 +5,38 @@
#
# INPUT Variables
#
# CXXTEST_USE_PYTHON
# If true, the CXXTEST_ADD_TEST macro will use
# the Python test generator instead of Perl.
# CXXTEST_USE_PYTHON [deprecated since 1.3]
# Only used in the case both Python & Perl
# are detected on the system to control
# which CxxTest code generator is used.
# Valid only for CxxTest version 3.
#
# NOTE: In older versions of this Find Module,
# this variable controlled if the Python test
# generator was used instead of the Perl one,
# regardless of which scripting language the
# user had installed.
#
# CXXTEST_TESTGEN_ARGS (since CMake 2.8.3)
# Specify a list of options to pass to the CxxTest code
# generator. If not defined, --error-printer is
# passed.
#
# OUTPUT Variables
#
# CXXTEST_FOUND
# True if the CxxTest framework was found
# CXXTEST_INCLUDE_DIR
# CXXTEST_INCLUDE_DIRS
# Where to find the CxxTest include directory
# CXXTEST_PERL_TESTGEN_EXECUTABLE
# The perl-based test generator.
# The perl-based test generator
# CXXTEST_PYTHON_TESTGEN_EXECUTABLE
# The python-based test generator.
# The python-based test generator
# CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3)
# The test generator that is actually used (chosen using user preferences
# and interpreters found in the system)
# CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3)
# The full path to the Perl or Python executable on the system
#
# MACROS for optional use by CMake users:
#
......@@ -26,10 +44,12 @@
# Creates a CxxTest runner and adds it to the CTest testing suite
# Parameters:
# test_name The name of the test
# gen_source_file The generated source filename to be generated by CxxTest
# gen_source_file The generated source filename to be
# generated by CxxTest
# input_files_to_testgen The list of header files containing the
# CxxTest::TestSuite's to be included in this runner
#
# CxxTest::TestSuite's to be included in
# this runner
#
# #==============
# Example Usage:
#
......@@ -39,7 +59,7 @@
# enable_testing()
#
# CXXTEST_ADD_TEST(unittest_foo foo_test.cc
# ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h other.cpp)
# ${CMAKE_CURRENT_SOURCE_DIR}/foo_test.h)
# target_link_libraries(unittest_foo foo) # as needed
# endif()
#
......@@ -47,14 +67,13 @@
# 1. Invoke the testgen executable to autogenerate foo_test.cc in the
# binary tree from "foo_test.h" in the current source directory.
# 2. Create an executable and test called unittest_foo.
# 3. Link additionally against other.cpp
#
#
# #=============
# Example foo_test.h:
#
# #include <cxxtest/TestSuite.h>
#
# class MyTestSuite : public CxxTest::TestSuite
#
# class MyTestSuite : public CxxTest::TestSuite
# {
# public:
# void testAddition( void )
......@@ -64,7 +83,34 @@
# }
# };
#
#
#=============================================================================
# Copyright 2008-2010 Kitware, Inc.
# Copyright 2008-2010 Philip Lowman <philip@yhbt.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Version 1.4 (11/18/10) (CMake 2.8.4)
# Issue 11384: Added support to the CXX_ADD_TEST macro so header
# files (containing the tests themselves) show up in
# Visual Studio and other IDEs.
#
# Version 1.3 (8/19/10) (CMake 2.8.3)
# Included patch by Simone Rossetto to check if either Python or Perl
# are present in the system. Whichever intepreter that is detected
# is now used to run the test generator program. If both interpreters
# are detected, the CXXTEST_USE_PYTHON variable is obeyed.
#
# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying
# options to the CxxTest code generator.
# Version 1.2 (3/2/08)
# Included patch from Tyler Roscoe to have the perl & python binaries
# detected based on CXXTEST_INCLUDE_DIR
......@@ -76,31 +122,18 @@
# Fixed CXXTEST_INCLUDE_DIRS so it will work properly
# Eliminated superfluous CXXTEST_FOUND assignment
# Cleaned up and added more documentation
#
# FindCxxTest.cmake
# Copyright (c) 2008-2009
# Philip Lowman <philip@yhbt.com>
#
# Redistribution AND use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#=============================================================
# CXXTEST_ADD_TEST (public macro)
#=============================================================
macro( CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname _cxxtest_testsuite )
macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname)
set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_outfname})
if(CXXTEST_USE_PYTHON)
set(_cxxtest_executable ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
else()
set(_cxxtest_executable ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
endif()
add_custom_command(
OUTPUT ${_cxxtest_real_outfname}
DEPENDS ${_cxxtest_testsuite} ${ARGN}
COMMAND ${_cxxtest_executable}
--error-printer -o ${_cxxtest_real_outfname} ${_cxxtest_testsuite}
DEPENDS ${ARGN}
COMMAND ${CXXTEST_TESTGEN_INTERPRETER}
${CXXTEST_TESTGEN_EXECUTABLE} ${CXXTEST_TESTGEN_ARGS} -o ${_cxxtest_real_outfname} ${ARGN}
)
set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true)
......@@ -166,18 +199,53 @@ FUNCTION( CXXTEST_ADD_TESTS_FROM_LIST _SourceList _TestLibs )
ENDFOREACH( _ClassName )
ENDFUNCTION( CXXTEST_ADD_TESTS_FROM_LIST )
#=============================================================
# main()
#=============================================================
if(NOT DEFINED CXXTEST_TESTGEN_ARGS)
set(CXXTEST_TESTGEN_ARGS --error-printer)
endif()
find_package(PythonInterp QUIET)
find_package(Perl QUIET)
find_path(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h)
find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE
NAMES cxxtestgen cxxtestgen.py
PATHS ${CXXTEST_INCLUDE_DIR})
find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
PATHS ${CXXTEST_INCLUDE_DIR})
find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE cxxtestgen.py
NAMES cxxtestgen
PATHS ${CXXTEST_INCLUDE_DIR})
PATHS ${CXXTEST_INCLUDE_DIR})
if(PYTHONINTERP_FOUND OR PERL_FOUND)
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) # It is available since CMAKE 2.6 and we require 2.8 anyways
if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON))
set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
set(CXXTEST_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE)
elseif(PERL_FOUND)
set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE)
endif()
if(CXXTEST_FOUND)
set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
endif()
else()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG CXXTEST_INCLUDE_DIR)
set(CXXTEST_FOUND false)
if(NOT CxxTest_FIND_QUIETLY)
if(CxxTest_FIND_REQUIRED)
message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!")
else()
message(STATUS "Neither Python nor Perl found, CxxTest will not be used.")
endif()
endif()
set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
endif()
......@@ -257,6 +257,9 @@ FUNCTION( BUILD_SYSTEM_COMPILER )
# MESSAGE( STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
# MESSAGE( STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}" )
# Supress compilation warnings from includes residing in system paths, see #230 for further details.
SET( CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem" CACHE STRING "" FORCE )
ENDFUNCTION( BUILD_SYSTEM_COMPILER )
# GCC 4.7 requires us to explicitly link against libstdc++ and libm. CMake offers a variable for this called "CMAKE_STANDARD_LIBRARIES".
......@@ -315,7 +318,7 @@ ELSE()
ENDIF() #BUILD_SCRIPTENGINE
# include the boost headers
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( SYSTEM ${Boost_INCLUDE_DIR} )
# avoid filesystem 2 stuff
ADD_DEFINITIONS( "-DBOOST_FILESYSTEM_VERSION=3" )
......@@ -335,7 +338,7 @@ IF( ANDROID )
ELSE()
FIND_PACKAGE( OpenGL REQUIRED )
# include the OpenGL header paths
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( SYSTEM ${OPENGL_INCLUDE_DIR} )
ENDIF()
# -----------------------------------------------------------------------------------------------------------------------------------------------
......@@ -346,7 +349,7 @@ ENDIF()
SET( MIN_OSG_VERSION 2.8.0 )
FIND_PACKAGE( OpenSceneGraph ${MIN_OSG_VERSION} REQUIRED osgWidget osgViewer osgText osgSim osgGA osgDB osgUtil )
IF( OPENSCENEGRAPH_FOUND )
INCLUDE_DIRECTORIES( ${OPENSCENEGRAPH_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( SYSTEM ${OPENSCENEGRAPH_INCLUDE_DIRS} )
# is the OSG linked statically? If yes, we need to take care that all the osgdb plugins are linked too.
STRING( REGEX MATCH "osgDB\\.a" OPENSCENEGRAPH_STATIC "${OPENSCENEGRAPH_LIBRARIES}" )
......@@ -409,7 +412,7 @@ MARK_AS_ADVANCED( FORCE OPENTHREADS_LIBRARY_DEBUG )
FIND_PACKAGE( eigen3 REQUIRED )
IF( EIGEN3_FOUND )
INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} )
INCLUDE_DIRECTORIES( SYSTEM ${EIGEN3_INCLUDE_DIR} )
# NOTE: this is included in ext. But we need to set several definitions to make this work on 32 Bit machines due to alignment problems
SET( EIGEN3_DEFINES -DEIGEN_DONT_VECTORIZE -DEIGEN_DONT_ALIGN -DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT )
......@@ -431,8 +434,8 @@ FIND_PACKAGE( CxxTest QUIET )
IF( CXXTEST_FOUND )
# To enable testing
OPTION( OW_USE_TESTS "This enables compilation of tests" ON )
INCLUDE_DIRECTORIES( ${CXXTEST_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( ${CXXTEST_INCLUDE_DIR} ) # NOTE: old FindCXXTest versions used this name
INCLUDE_DIRECTORIES( SYSTEM ${CXXTEST_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( SYSTEM ${CXXTEST_INCLUDE_DIR} ) # NOTE: old FindCXXTest versions used this name
IF( OW_USE_TESTS )
SET( OW_COMPILE_TESTS ON ) #We need this variable because this is tested more often.
# Package settings:
......
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