Commit 00b79d73 authored by Philip Trettner's avatar Philip Trettner

Merge branch 'master' of dawes.informatik.rwth-aachen.de:/data/git-repository/acgl/libraries/acgl

parents fe00ab5c 0f7c9ed5
......@@ -5,6 +5,27 @@
#
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
################################################################################
# Macro to sort acgl into directories
################################################################################
MACRO (RECURSE_GROUPS dirname)
FILE(GLOB_RECURSE allfiles "${dirname}/*.*")
SET(ALL_FILES ${ALL_FILES} ${allfiles})
STRING(REGEX REPLACE ".*/([^/]*)" "\\1" maindir "${dirname}")
FOREACH(file ${allfiles})
STRING(REGEX REPLACE "${dirname}/(.*)/[^/]*" "\\1" loopdirname "${file}")
STRING(REGEX REPLACE "/" "\\\\" loopdirname "${loopdirname}")
IF(NOT "${file}" MATCHES "${dirname}/(.*)/[^/]*")
source_group("${maindir}" FILES ${file})
ELSE()
source_group("${maindir}\\${loopdirname}" FILES ${file})
ENDIF()
ENDFOREACH()
ENDMACRO (RECURSE_GROUPS)
################################################################################
# Global Settings
################################################################################
......
......@@ -12,6 +12,9 @@ FILE(GLOB_RECURSE SOURCE_FILES_CPP "${ACGL_BASE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE HEADER_FILES_H "${ACGL_BASE_DIR}/include/*.h")
FILE(GLOB_RECURSE HEADER_FILES_HH "${ACGL_BASE_DIR}/include/*.hh")
FILE(GLOB_RECURSE HEADER_FILES_HPP "${ACGL_BASE_DIR}/include/*.hpp")
#group files in msvc
RECURSE_GROUPS ("${ACGL_BASE_DIR}/include")
RECURSE_GROUPS ("${ACGL_BASE_DIR}/src")
SET(HEADER_FILES ${HEADER_FILES} ${HEADER_FILES_H} ${HEADER_FILES_HH} ${HEADER_FILES_HPP})
SET(SOURCE_FILES ${SOURCE_FILES} ${SOURCE_FILES_C} ${SOURCE_FILES_CC} ${SOURCE_FILES_CPP})
......@@ -28,3 +31,7 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES debug)
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
ADD_DEFINITIONS(-DDEBUG)
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
IF(WIN32)
ADD_DEFINITIONS(-DWIN32)
ENDIF(WIN32)
......@@ -112,7 +112,7 @@ public:
glm::vec4 getChromAbParam();
//! the full physical screen resolution, offscreen rendering should get performed at a higher resolution!
//! 'full' means it's the size used fpr both eyes!
//! 'full' means it's the size used for both eyes!
glm::uvec2 getPhysicalScreenResolution();
//! returns the stereo projection from the stored camera adjusted for the rift
......
......@@ -44,6 +44,8 @@
// gcc >= 4.6:
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtype-limits"
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
# endif
// gcc:
# pragma GCC diagnostic ignored "-Wunused-parameter"
......@@ -51,8 +53,10 @@
//
/////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/ext.hpp>
......
......@@ -4,6 +4,8 @@
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifdef ACGL_INCLUDE_UNSUPPORTED
#ifndef ACGL_SCENE_COORDINATESYSTEM_HH
#define ACGL_SCENE_COORDINATESYSTEM_HH
......@@ -66,3 +68,5 @@ private:
} // ACGL
#endif // ACGL_SCENE_COORDINATESYSTEM_HH
#endif
......@@ -10,6 +10,7 @@
#include <glm/gtx/quaternion.hpp>
#include "CameraBase.hh"
#include "MoveableObject.hh"
/*
* What you definitly want to set:
......@@ -48,7 +49,7 @@
namespace ACGL{
namespace Scene{
class GenericCamera : public CameraBase
class GenericCamera : public CameraBase, public MoveableObject
{
public:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -220,22 +221,8 @@ class GenericCamera : public CameraBase
// actually used.
//
/// Gets the orthonormal rotation matrix (mat3)
const glm::mat3 &getRotationMatrix3() const { return mRotationMatrix; }
/// Gets the inverse orthonormal rotation matrix (mat3)
glm::mat3 getInverseRotationMatrix3() const { return glm::transpose(mRotationMatrix); }
/// Gets the orthonormal rotation matrix as a mat4
glm::mat4 getRotationMatrix4() const { return glm::mat4(mRotationMatrix); }
/// Sets the rotation matrix (mat3)
void setRotationMatrix( glm::mat3 _matrix );
/// Sets the rotation matrix (mat3-part of a mat4)
void setRotationMatrix( glm::mat4 _matrix );
/// Sets the complete camera lookat (position and rotation)
void setLookAtMatrix( const glm::vec3 &_position, const glm::vec3 &_target, const glm::vec3 &_up );
/// Gets the translation matrix of this camera
glm::mat4 getTranslationMatrix4() const;
/// forward to MovableObject to implement the full CameraBase interface:
glm::vec3 getPosition() const { return MoveableObject::getPosition(); }
///////////////////////////////////////////////////////////////////////////////////////////
//
......@@ -302,51 +289,6 @@ class GenericCamera : public CameraBase
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Set the position of the camera.
* @param _position New position of the camera.
*/
void setPosition( const glm::vec3 &_position ) { mPosition = _position; }
virtual glm::vec3 getPosition() const { return mPosition; }
/// Moves the camera by a given vector (in eyespace)
void move( const glm::vec3 &_vector );
void moveRight( float _distance ) { move( glm::vec3(_distance,0,0) ); }
void moveBack( float _distance ) { move( glm::vec3(0,0,_distance) ); }
void moveUp( float _distance ) { move( glm::vec3(0,_distance,0) ); }
void moveLeft( float _distance ) { move( glm::vec3(-_distance,0,0) ); }
void moveForward( float _distance ) { move( glm::vec3(0,0,-_distance) ); }
void moveDown( float _distance ) { move( glm::vec3(0,-_distance,0) ); }
/**
* Set the distance of the camera to the object we're looking at.
* Will change the target!
* @param _distance New focal distance of the camera.
*/
void setLookAtDistance( float _distance );
/// Gets the look-at distance
float getLookAtDistance() const { return mLookAtDistance; }
/// Will change the look at distance!
/// Will change the rotation!
/// Uses stored up-vector as reference
void setTarget( const glm::vec3 &_target ) { setTarget(_target, getUpDirection()); }
/// Will change the look at distance!
/// Will change the rotation!
/// Uses given up-vector as reference
void setTarget( const glm::vec3 &_target, const glm::vec3 &_up );
/// Gets the reconstructed target
glm::vec3 getTarget() const { return mPosition + getForwardDirection() * getLookAtDistance(); }
/// Get the unit up direction
glm::vec3 getUpDirection () const;
/// Get the unit right direction
glm::vec3 getRightDirection () const;
/// Get the unit forward direction
glm::vec3 getForwardDirection() const;
/**
* Look around with a mouse, works like a FPS camera:
* No roll possible.
......@@ -364,13 +306,6 @@ class GenericCamera : public CameraBase
/// States: update the storeStateToString() & setStateFromString() functions whenever adding a new state!
///
/// Current camera position
glm::vec3 mPosition;
/// Current camera rotation
glm::mat3 mRotationMatrix;
/// Current camera projection mode
ProjectionMode mProjectionMode;
/// stereo view mode
......@@ -391,9 +326,6 @@ class GenericCamera : public CameraBase
float mNearClippingPlane;
/// Current camera far clipping plane
float mFarClippingPlane;
/// Current camera focal distance
float mLookAtDistance;
/// viewport in pixel:
glm::uvec2 mViewportSize;
......
/***********************************************************************
* Copyright 2014 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
/*
* A moveable object is an interface for something that can be moved around and has an orientation.
* This means it has access functions for a modelmatrix containing a position and orientation as
* well as just getting the position or the rotation.
* It can be moved relative to its own orientation.
*
*
* ModelMatrix = Rotation * Translation
* ( it is translated in space and then rotated around that spot )
*
*/
#pragma once
#include <ACGL/ACGL.hh>
#include <ACGL/Math/Math.hh>
#include <glm/gtx/quaternion.hpp>
namespace ACGL{
namespace Scene{
class MoveableObject
{
public:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Constructor / Destructor / save&store
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Default Constructor.
*/
MoveableObject();
/**
* Destructor.
*/
virtual ~MoveableObject() {}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Set / Get the matrices:
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
//
// Generic rotation and translation matrices.
//
/// Gets the orthonormal rotation matrix (mat3)
const glm::mat3 &getRotationMatrix3() const { return mRotationMatrix; }
/// Gets the inverse orthonormal rotation matrix (mat3)
glm::mat3 getInverseRotationMatrix3() const { return glm::transpose(mRotationMatrix); }
/// Gets the orthonormal rotation matrix as a mat4
glm::mat4 getRotationMatrix4() const { return glm::mat4(mRotationMatrix); }
/// Sets the rotation matrix (mat3)
void setRotationMatrix( glm::mat3 _matrix );
/// Sets the rotation matrix (mat3-part of a mat4)
void setRotationMatrix( glm::mat4 _matrix );
/// Sets the complete lookat (position and rotation)
void setLookAtMatrix( const glm::vec3 &_position, const glm::vec3 &_target, const glm::vec3 &_up );
/// Gets the translation matrix of this object (no rotational element)
glm::mat4 getTranslationMatrix4() const;
///////////////////////////////////////////////////////////////////////////////////////////
//
// Generic model matrices.
//
/// Gets the currently active view matrix (depends on stereo mode and current eye)
glm::mat4 getModelMatrix() const;
/// Gets the currently active view matrix (depends on stereo mode and current eye)
glm::mat4 getInverseModelMatrix() const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Set / Get properties that move the object around (or rotate etc.)
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Set the position of the camera.
* @param _position New position of the object.
*/
void setPosition( const glm::vec3 &_position ) { mPosition = _position; }
glm::vec3 getPosition() const { return mPosition; }
/// Moves the object by a given vector (relative to own orientation)
void move( const glm::vec3 &_vector );
void moveRight( float _distance ) { move( glm::vec3(_distance,0,0) ); }
void moveBack( float _distance ) { move( glm::vec3(0,0,_distance) ); }
void moveUp( float _distance ) { move( glm::vec3(0,_distance,0) ); }
void moveLeft( float _distance ) { move( glm::vec3(-_distance,0,0) ); }
void moveForward( float _distance ) { move( glm::vec3(0,0,-_distance) ); }
void moveDown( float _distance ) { move( glm::vec3(0,-_distance,0) ); }
/**
* Set the distance of the object to the object it's looking at.
* Will change the target!
* @param _distance New distance of the object this is pointed at.
*/
void setLookAtDistance( float _distance );
/// Gets the look-at distance
float getLookAtDistance() const { return mLookAtDistance; }
/// Will change the look at distance!
/// Will change the rotation!
/// Uses stored up-vector as reference
void setTarget( const glm::vec3 &_target ) { setTarget(_target, getUpDirection()); }
/// Will change the look at distance!
/// Will change the rotation!
/// Uses given up-vector as reference
void setTarget( const glm::vec3 &_target, const glm::vec3 &_up );
/// Gets the reconstructed target
glm::vec3 getTarget() const { return mPosition + getForwardDirection() * getLookAtDistance(); }
/// Get the unit up direction
glm::vec3 getUpDirection () const;
/// Get the unit right direction
glm::vec3 getRightDirection () const;
/// Get the unit forward direction
glm::vec3 getForwardDirection() const;
protected:
/// Current position
glm::vec3 mPosition;
/// Current rotation
glm::mat3 mRotationMatrix;
/// might be used later to rotate around this position:
float mLookAtDistance;
};
} // Scene
} // ACGL
set(NAME glm)
set(NAME glm_dummy)
file(GLOB ROOT_SOURCE *.cpp)
file(GLOB ROOT_INLINE *.inl)
file(GLOB ROOT_HEADER *.hpp)
file(GLOB ROOT_TEXT ../*.txt)
file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp)
file(GLOB_RECURSE CORE_INLINE ./core/*.inl)
file(GLOB_RECURSE CORE_HEADER ./core/*.hpp)
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp)
file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp)
file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl)
......@@ -16,10 +17,7 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp)
file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl)
file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp)
source_group("Text Files" FILES ${ROOT_TEXT})
source_group("Core Files" FILES ${CORE_SOURCE})
source_group("Core Files" FILES ${CORE_INLINE})
source_group("Core Files" FILES ${CORE_HEADER})
......@@ -29,15 +27,14 @@ source_group("GTC Files" FILES ${GTC_HEADER})
source_group("GTX Files" FILES ${GTX_SOURCE})
source_group("GTX Files" FILES ${GTX_INLINE})
source_group("GTX Files" FILES ${GTX_HEADER})
source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE})
source_group("VIRTREV Files" FILES ${VIRTREV_INLINE})
source_group("VIRTREV Files" FILES ${VIRTREV_HEADER})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
add_executable(${NAME}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
add_executable(${NAME} ${ROOT_TEXT}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER})
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
#add_library(glm STATIC glm.cpp)
#add_library(glm_shared SHARED glm.cpp)
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref core
/// @file glm/common.hpp
/// @date 2013-12-24 / 2013-12-24
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_COMMON_INCLUDED
#define GLM_COMMON_INCLUDED
#include "detail/func_common.hpp"
#endif//GLM_COMMON_INCLUDED
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref core
/// @file glm/core/_vectorize.hpp
/// @date 2011-10-14 / 2011-10-14
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define VECTORIZE2_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
detail::tvec2<T> const & v) \
{ \
return detail::tvec2<T>( \
func(v.x), \
func(v.y)); \
}
#define VECTORIZE3_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
detail::tvec3<T> const & v) \
{ \
return detail::tvec3<T>( \
func(v.x), \
func(v.y), \
func(v.z)); \
}
#define VECTORIZE4_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
detail::tvec4<T> const & v) \
{ \
return detail::tvec4<T>( \
func(v.x), \
func(v.y), \
func(v.z), \
func(v.w)); \
}
#define VECTORIZE_VEC(func) \
VECTORIZE2_VEC(func) \
VECTORIZE3_VEC(func) \
VECTORIZE4_VEC(func)
#define VECTORIZE2_VEC_SCA(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func \
( \
detail::tvec2<T> const & x, \
typename detail::tvec2<T>::value_type const & y \
) \
{ \