Commit 69f4923e authored by Robert Menzel's avatar Robert Menzel

merged experimental branch

parents 1b103edf c51f9537
#
# Use this to compile ACGL as a library. To include it statically compiled into
# your own project you can also just include the CMakeListsStaticInclude.txt:
# INCLUDE(${CMAKE_SOURCE_DIR}/CMakeListsStaticInclude.txt)
#
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
################################################################################
......@@ -15,7 +20,7 @@ INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GlobalAndLocalExternACGL.txt)
# OpenGL Support
IF(NOT DEFINED ACGL_OPENGL_SUPPORT)
SET(ACGL_OPENGL_SUPPORT CORE_42 CACHE STRING "")
SET_PROPERTY(CACHE ACGL_OPENGL_SUPPORT PROPERTY STRINGS CORE_32 CORE_33 CORE_40 CORE_41 CORE_41_ES CORE_42 FULL_21 FULL_30 FULL_31 FULL_32 FULL_33 FULL_40 FULL_41 FULL_42 ES_20)
SET_PROPERTY(CACHE ACGL_OPENGL_SUPPORT PROPERTY STRINGS CORE_32 CORE_33 CORE_40 CORE_41 CORE_42 CORE_43 CORE_42 FULL_21 FULL_30 FULL_31 FULL_32 FULL_33 FULL_40 FULL_41 FULL_42 FULL_43 ES_20)
ENDIF()
# Error Level
......@@ -44,12 +49,11 @@ SET(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib")
# Project Files
################################################################################
# Find all used files of certain file-types
FILE(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")
FILE(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hh")
# Add ACGL to the include path
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include")
#
# if ACGL should not get compiled as a library, just include the following file
# into the projects CMakeList.txt
#
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeListsStaticInclude.txt)
################################################################################
# Defines
......@@ -63,7 +67,7 @@ ADD_DEFINITIONS(${ACGL_DEFINES})
################################################################################
# Qt
IF(DEFINED ACGL_COMPILE_WITH_QT)
IF(ACGL_COMPILE_WITH_QT)
#MESSAGE("QT")
SET(QT_USE_QTOPENGL TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
......@@ -71,19 +75,6 @@ IF(DEFINED ACGL_COMPILE_WITH_QT)
SET(LIBRARIES ${LIBRARIES} ${QT_LIBRARIES})
ENDIF()
# GLM
FIND_PACKAGE(GLM REQUIRED)
INCLUDE_DIRECTORIES(${GLM_INCLUDE_DIR})
# GLEW
IF(DEFINED ACGL_PLATFORM_DESKTOP)
#MESSAGE("GLEW")
FIND_PACKAGE(GLEW REQUIRED)
ADD_DEFINITIONS(${GLEW_DEFINES})
INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
SET(LIBRARIES ${LIBRARIES} ${GLEW_LIBRARIES})
ENDIF()
################################################################################
# Final Definition
################################################################################
......
#
# To build ACGL as a library, use the CMakeLists.txt
# To build it statically into a project just include this file,
# e.g.: INCLUDE(${CMAKE_SOURCE_DIR}/extern/acgl/CMakeListsStaticInclude.txt)
#
# Find all used files of certain file-types
FILE(GLOB_RECURSE SOURCE_FILES_C "${CMAKE_CURRENT_LIST_DIR}/src/*.c")
FILE(GLOB_RECURSE SOURCE_FILES_CC "${CMAKE_CURRENT_LIST_DIR}/src/*.cc")
FILE(GLOB_RECURSE SOURCE_FILES_CPP "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")
FILE(GLOB_RECURSE HEADER_FILES_H "${CMAKE_CURRENT_LIST_DIR}/include/*.h")
FILE(GLOB_RECURSE HEADER_FILES_HH "${CMAKE_CURRENT_LIST_DIR}/include/*.hh")
FILE(GLOB_RECURSE HEADER_FILES_HPP "${CMAKE_CURRENT_LIST_DIR}/include/*.hpp")
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})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/include)
......@@ -3,6 +3,13 @@ ACGL - Aachen Computer Graphics Library
Intended to speed up graphics/OpenGL prototyping. Developed by Lars Krecklau and Robert Menzel with help from Andreas Neu, Janis Born, Kersten Schuster, Ole Untzelmann, based on prior work from Lars Krecklau.
Included third-party software:
* Includes lodepng by Lode Vandevenne, unchanged except for the include path in lodepng.cpp. lodepng is provided as-is, see license text in the lodepng source code.
* Includes OpenGL loader code created by a modified glLoadGen by Jason McKesson.
* Includes GLM by Christophe Riccio.
* Includes data type definitions from libspnav header originally by John Tsiombikas (see mini_spnav.h for details).
* Includes RGBE/Radiance image import by Bruce Walter (code provided 'as-is') minimally adjusted to reduce compiler warnings.
See LICENSE.TXT for licensing information.
cmake @ 2ab8ddba
Subproject commit fbc7a6c6d438fd390368709eb7727f3a522bfe27
Subproject commit 2ab8ddba5b6c77730193e734bfb63cc45ac93e77
......@@ -137,7 +137,7 @@ namespace ACGL
* Returns false if a critical error occured, in that case the ACGL behavior is
* not defined.
*/
bool init(void);
bool init();
}
......
......@@ -27,8 +27,8 @@ public:
Animation() :
mInited(false),
mStopped(false) {};
virtual ~Animation() {};
mStopped(false) {}
virtual ~Animation() {}
virtual void init() = 0;
virtual long update(uint_t msec) = 0;
......
......@@ -263,7 +263,7 @@ public:
}
}
inline const bool finished()
inline bool finished()
{
return mCurrentPosition == mKeypoints.size();
}
......
......@@ -30,15 +30,10 @@ protected:
//! Constructor is protected => singleton.
Settings()
: mResourcePath (""),
mTexturePath ("Texture/"),
mGeometryPath ("Geometry/"),
mShaderPath ("Shader/")
mTexturePath (""),
mGeometryPath (""),
mShaderPath ("")
{
# if defined(ACGL_OPENGL_VERSION_21)
// use an alternative path if compiled for old OpenGL
mShaderPath = "Shader21/";
ACGL::Utils::message() << "compiled for OpenGL 2.1: using alternative shader folder Shader21/" << std::endl;
# endif
}
public:
......
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* Copyright 2011-2013 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_RESOURCE_BASICUPDATECONTROLLER_HH
#define ACGL_RESOURCE_BASICUPDATECONTROLLER_HH
/*
* Base class for all controllers.
*
* Controllers can provide more flexible ways of creating objects, they are also
* making managers more flexibe.
*/
#pragma once
#include <ACGL/ACGL.hh>
#include <ACGL/Scene/GenericCamera.hh>
namespace ACGL{
namespace Resource{
namespace HardwareSupport{
template<typename RESOURCE>
class BasicUpdateController
/// Controls a GenericCamera with a space navigator
class SpaceNavControl
{
// ==================================================================================================== \/
// ========================================================================================== INTERFACE \/
// ==================================================================================================== \/
public:
virtual bool update(ptr::shared_ptr<RESOURCE>&) = 0;
SpaceNavControl(Scene::GenericCamera *_cam, const glm::vec3 &_moveSensitivity = glm::vec3(1.0), const glm::vec3 &_rotateSensitivity = glm::vec3(1.0));
~SpaceNavControl();
/// Updates the camera: call this once a frame, it will poll the SpaceNavigator. The elapsed time is used to scale the movement to
/// to be framerate independent.
void update(float _elapsedSeconds);
private:
/// The referenced camera
Scene::GenericCamera *mCamera;
/// Sensitivity for moving the camera
glm::vec3 mMoveSensitivity;
/// Sensitivity for rotating the camera
glm::vec3 mRotateSensitivity;
};
} // Resource
} // HardwareSupport
} // ACGL
#endif // ACGL_RESOURCE_BASICCONTROLLER_HH
/***********************************************************************
* Copyright 2011-2013 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#pragma once
#include <ACGL/ACGL.hh>
namespace ACGL{
namespace HardwareSupport{
/*
* To compile:
* Linux: do nothing
* MacOS X: link to 3DconnexionClient,
* e.g. add 'SET(LIBRARIES -Wl,-framework,3DconnexionClient)' to CMakeLists.txt
* to build a version without space nav support, define NO_SPACE_NAVIGATOR_SUPPORT
* Windows: only dummy functionality will get build
*/
// Each listener should call this *once* before starting to poll,
// the first listener will start a connection to the driver.
// If the connection could be made, true will be returned, false otherwise.
// If false gets returned, SpaceNavUnregisterListener() should not get called
// and all SpaceNavPollEvent() calls will return 0 events.
bool SpaceNavRegisterListener();
// Each listener should call this *once* when stopping to listen iff the call
// to SpaceNavRegisterListener() returned true.
// Last unregister call will trigger disconnection from the driver.
void SpaceNavUnregisterListener();
enum SpaceNavEventType {
movement,
button,
other
};
// Values of the buttons:
// the 2 button space navigator:
static const int SNE_BUTTON_LEFT = 0;
static const int SNE_BUTTON_RIGHT = 1;
// the larger space pilot:
static const int SNE_BUTTON_1 = 0;
static const int SNE_BUTTON_2 = 1;
static const int SNE_BUTTON_3 = 2;
static const int SNE_BUTTON_4 = 3;
static const int SNE_BUTTON_5 = 4;
static const int SNE_BUTTON_6 = 5;
static const int SNE_BUTTON_ESC = 10;
static const int SNE_BUTTON_CTRL = 13;
static const int SNE_BUTTON_ALT = 11;
static const int SNE_BUTTON_SHIFT = 12;
static const int SNE_BUTTON_CONFIG = 20;
static const int SNE_BUTTON_PANEL = 15;
static const int SNE_BUTTON_VOL_DOWN = 17;
static const int SNE_BUTTON_VOL_UP = 16;
static const int SNE_BUTTON_DOM = 18;
static const int SNE_BUTTON_T = 6;
static const int SNE_BUTTON_L = 7;
static const int SNE_BUTTON_R = 8;
static const int SNE_BUTTON_F = 9;
static const int SNE_BUTTON_3D = 19;
static const int SNE_BUTTON_FIT = 14;
//
// translation and rotation can go from about -500 to 500.
// note that the neutral postion might not be 0,0,0
// not all axes have the same maximum value (-361 to 441 might be possible)
struct SpaceNavEvent {
SpaceNavEventType type;
int x,y,z; // translation, right-handed-coord-system (right/up/towards the user are positive)
int rx,ry,rz; // rotation, pitch-yaw-roll
int button; // button number, see values above
bool pressed; // button state, pressing the button down and release will create two events
};
// Call this to poll for new events.
// Return value is the number of valid events waiting, 0 means no event
// is waiting and the eventToFill will not get changed in that situation.
// If no device was found or the connection to the driver failed for other
// reasons, 0 will get returned.
// -> polling for events and only interpreting them if >0 gets returned
// should be always save!
unsigned int SpaceNavPollEvent( SpaceNavEvent &eventToFill );
} // HardwareSupport
} // ACGL
/*
This file is based on a part of libspnav, part of the spacenav project (spacenav.sf.net)
Original file (spnav.h) Copyright (C) 2007-2010 John Tsiombikas <nuclear@member.fsf.org>
This file (mini_spnav.h) Copyright (C) 2013 Robert Menzel
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef MINI_SPACENAV_H_
#define MINI_SPACENAV_H_
/*
* This file can be used as an alternative to spnav.h iff the library should get loaded
* dynamically. Add this to your project and the code will compile independent of the
* presence of libspnav (and also run independent of it).
*/
#include <dlfcn.h> // for dlopen
enum {
SPNAV_EVENT_ANY, /* used by spnav_remove_events() */
SPNAV_EVENT_MOTION,
SPNAV_EVENT_BUTTON /* includes both press and release */
};
struct spnav_event_motion {
int type;
int x, y, z;
int rx, ry, rz;
unsigned int period;
int *data;
};
struct spnav_event_button {
int type;
int press;
int bnum;
};
typedef union spnav_event {
int type;
struct spnav_event_motion motion;
struct spnav_event_button button;
} spnav_event;
#ifdef __cplusplus
extern "C" {
#endif
/* Open connection to the daemon via AF_UNIX socket.
* The unix domain socket interface is an alternative to the original magellan
* protocol, and it is *NOT* compatible with the 3D connexion driver. If you wish
* to remain compatible, use the X11 protocol (spnav_x11_open, see below).
* Returns -1 on failure.
*/
typedef int (*spnav_open_ptr)(void);
/* Close connection to the daemon. Use it for X11 or AF_UNIX connections.
* Returns -1 on failure
*/
typedef int (*spnav_close_ptr)(void);
/* Retrieves the file descriptor used for communication with the daemon, for
* use with select() by the application, if so required.
* If the X11 mode is used, the socket used to communicate with the X server is
* returned, so the result of this function is always reliable.
* If AF_UNIX mode is used, the fd of the socket is returned or -1 if
* no connection is open / failure occured.
*/
//int spnav_fd(void);
/* TODO: document */
//int spnav_sensitivity(double sens);
/* blocks waiting for space-nav events. returns 0 if an error occurs */
//int spnav_wait_event(spnav_event *event);
/* checks the availability of space-nav events (non-blocking)
* returns the event type if available, or 0 otherwise.
*/
typedef int (*spnav_poll_event_ptr)(spnav_event *event);
/* Removes any pending events from the specified type, or all pending events
* events if the type argument is SPNAV_EVENT_ANY. Returns the number of
* removed events.
*/
//int spnav_remove_events(int type);
#ifdef __cplusplus
}
#endif
#endif /* MINI_SPACENAV_H_ */
......@@ -4,40 +4,10 @@
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_HH
#define ACGL_OPENGL_CONTROLLER_HH
/*
* A shortcut to include all controller of OpenGL objects.
* Will also include the objects themself!
*/
#pragma once
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/Objects.hh>
#include <ACGL/Resource/NameManager.hh>
#include <ACGL/Resource/FileManager.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControlFile.hh>
#include <ACGL/OpenGL/Controller/ArrayBufferControlFileATB.hh>
#include <ACGL/OpenGL/Controller/ElementArrayBufferControl.hh>
#include <ACGL/OpenGL/Controller/FrameBufferObjectControl.hh>
#include <ACGL/OpenGL/Controller/RenderBufferControl.hh>
#include <ACGL/OpenGL/Controller/RenderObjectControl.hh>
#include <ACGL/OpenGL/Controller/ShaderControlFile.hh>
#include <ACGL/OpenGL/Controller/ShaderProgramControlFiles.hh>
#include <ACGL/OpenGL/Controller/ShaderProgramObjectControl.hh>
#include <ACGL/OpenGL/Controller/DataControlFileFactory.hh>
#include <ACGL/OpenGL/Controller/TextureDataControlFileJPG.hh>
#include <ACGL/OpenGL/Controller/TextureControl.hh>
#include <ACGL/OpenGL/Controller/TextureControlCubeMap.hh>
#include <ACGL/OpenGL/Controller/TextureControlFile.hh>
#include <ACGL/OpenGL/Controller/VertexArrayObjectControl.hh>
#include <ACGL/OpenGL/Controller/VertexArrayObjectControlFile.hh>
#include <ACGL/OpenGL/Controller/UniformControl.hh>
#include <ACGL/OpenGL/Controller/ViewportControl.hh>
#include <ACGL/OpenGL/Controller/LocationMappingsControl.hh>
#endif // ACGL_OPENGL_CONTROLLER_HH
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#ifndef ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROL_HH
#define ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROL_HH
/* *************** DEPRECATED ********************* */
#include <ACGL/ACGL.hh>
#include <ACGL/Resource/BasicCreateController.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/GL.hh>
namespace ACGL{
namespace OpenGL{
class ArrayBufferControl : public Resource::BasicCreateController<ArrayBuffer>
{
// ==================================================================================================== \/
// ============================================================================================ STRUCTS \/
// ==================================================================================================== \/
public:
struct AttributeDefine
{
std::string name;
GLenum type;
GLint dimension;
GLboolean normalized;
};
// ===================================================================================================== \/
// ============================================================================================ TYPEDEFS \/
// ===================================================================================================== \/
public:
typedef std::vector< AttributeDefine > AttributeDefineVec;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
ArrayBufferControl(void)
: mUsage(GL_STATIC_DRAW),
mElements(0),
mpData(NULL),
mAttributeDefines()
{}
virtual ~ArrayBufferControl() {}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline ArrayBufferControl& usage (GLenum _usage) { mUsage = _usage; return *this; }
inline ArrayBufferControl& data (const GLvoid* _pData, GLsizei _elements)
{
mpData = _pData;
mElements = _elements;
return *this;
}
inline ArrayBufferControl& attribute (const std::string& _name, GLenum _type, GLint _dimension, GLboolean _normalized = GL_FALSE)
{
AttributeDefine a = {_name, _type, _dimension, _normalized};
mAttributeDefines.push_back(a);
return *this;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
virtual SharedArrayBuffer create(void);
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLenum mUsage;
GLsizei mElements;
const GLvoid* mpData;
AttributeDefineVec mAttributeDefines;
};
} // OpenGL
} // ACGL
#endif // ACGL_OPENGL_CONTROLLER_ARRAYBUFFERCONTROL_HH