Commit a5db50e5 authored by Martin Heistermann's avatar Martin Heistermann

Merge remote-tracking branch 'origin/master' into propvis-histogram-mr

parents e094f5c0 b8177901
......@@ -45,3 +45,14 @@ VS2013-Qt-5.5.1-x64:
artifacts:
paths:
- rel/*.exe
Mac-Cpp11:
script: "CI/ci-mac.sh"
cache:
paths:
- build-release/
tags:
- Apple
artifacts:
paths:
- build-release/*.dmg
......@@ -86,6 +86,7 @@ set (directories
Geometry
Config
Geometry/Types
Geometry/bsp
GL
Glut
IO
......
......@@ -446,6 +446,9 @@ class ScenegraphTraversalStackEl {
void IRenderer::traverseRenderableNodes( ACG::GLState* _glState, ACG::SceneGraph::DrawModes::DrawMode _drawMode, ACG::SceneGraph::BaseNode &_node, const ACG::SceneGraph::Material &_mat )
{
renderObjectSource_.clear();
overlayObjectSource_.clear();
if (_node.status() == ACG::SceneGraph::BaseNode::HideSubtree)
return;
......@@ -478,6 +481,10 @@ void IRenderer::traverseRenderableNodes( ACG::GLState* _glState, ACG::SceneGraph
if (cur.node->status() != ACG::SceneGraph::BaseNode::HideNode)
cur.node->getRenderObjects(this, *_glState, nodeDM, cur.material);
// keep track of which node added objects
size_t numAddedObjects = renderObjects_.size() - renderObjectSource_.size();
renderObjectSource_.insert(renderObjectSource_.end(), numAddedObjects, cur.node);
// Process children?
if (cur.node->status() != ACG::SceneGraph::BaseNode::HideChildren) {
// Process all children which are second pass
......@@ -565,11 +572,21 @@ void IRenderer::prepareRenderingPipeline(ACG::GLState* _glState, ACG::SceneGraph
lineGL42Objects_.clear();
lineGL42Objects_.reserve(numLineObjects);
sortListObjects_.clear();
sortListObjects_.reserve(numRenderObjects);
sortListOverlays_.clear();
sortListOverlays_.reserve(numOverlayObjects);
// init sorted objects array
for (size_t i = 0; i < renderObjects_.size(); ++i)
{
if (renderObjects_[i].overlay)
{
overlayObjects_.push_back(&renderObjects_[i]);
sortListOverlays_.push_back(i);
}
else if (enableLineThicknessGL42_ && numLineObjects && renderObjects_[i].isDefaultLineObject())
{
renderObjects_[i].shaderDesc.geometryTemplateFile = "Wireframe/gl42/geometry.tpl";
......@@ -582,7 +599,10 @@ void IRenderer::prepareRenderingPipeline(ACG::GLState* _glState, ACG::SceneGraph
lineGL42Objects_.push_back(&renderObjects_[i]);
}
else
{
sortedObjects_.push_back(&renderObjects_[i]);
sortListObjects_.push_back(i);
}
}
sortRenderObjects();
......@@ -790,16 +810,50 @@ void IRenderer::clearInputFbo( const ACG::Vec4f& clearColor )
namespace {
struct RenderObjectComparator {
bool operator() (ACG::RenderObject *a, ACG::RenderObject * b) {
return (a->priority < b->priority);
RenderObjectComparator(const std::vector<ACG::RenderObject>& _vec) : vec_(_vec) {
}
bool operator() (int a, int b) {
return (vec_[a].priority < vec_[b].priority);
}
const std::vector<ACG::RenderObject>& vec_;
};
}
void IRenderer::sortRenderObjects()
{
std::sort(sortedObjects_.begin(), sortedObjects_.end(), RenderObjectComparator());
std::sort(overlayObjects_.begin(), overlayObjects_.end(), RenderObjectComparator());
size_t numObjs = sortListObjects_.size();
size_t numOverlays = sortListOverlays_.size();
RenderObjectComparator cmpOp(renderObjects_);
std::sort(sortListObjects_.begin(), sortListObjects_.end(), cmpOp);
std::sort(sortListOverlays_.begin(), sortListOverlays_.end(), cmpOp);
// apply sorting list
std::vector<ACG::SceneGraph::BaseNode*> temp;
renderObjectSource_.swap(temp);
renderObjectSource_.resize(numObjs, 0);
overlayObjectSource_.resize(numOverlays, 0);
for (size_t i = 0; i < numObjs; ++i)
{
int objID = sortListObjects_[i];
sortedObjects_[i] = &renderObjects_[objID];
renderObjectSource_[i] = temp[objID];
}
for (size_t i = 0; i < numOverlays; ++i)
{
int objID = sortListOverlays_[i];
overlayObjects_[i] = &renderObjects_[objID];
overlayObjectSource_[i] = temp[objID];
}
}
......@@ -1148,6 +1202,18 @@ ACG::RenderObject* IRenderer::getOverlayRenderObject( int i )
return overlayObjects_[i];
}
ACG::SceneGraph::BaseNode* IRenderer::getRenderObjectNode( int i )
{
return renderObjectSource_[i];
}
ACG::SceneGraph::BaseNode* IRenderer::getOverlayRenderObjectNode( int i )
{
return overlayObjectSource_[i];
}
ACG::RenderObject* IRenderer::getLineGL42RenderObject( int i )
{
if (lineGL42Objects_.empty())
......
......@@ -446,6 +446,14 @@ protected:
const ACG::Vec3f& getGlobalAmbientScale() const {return globalLightModelAmbient_;}
/// Get node that emitted the render object in the sorted list by index (not including overlay objects)
ACG::SceneGraph::BaseNode* getRenderObjectNode(int i);
/// Get node that emitted the render object in the sorted list by index (only overlay objects)
ACG::SceneGraph::BaseNode* getOverlayRenderObjectNode(int i);
/** Enable/disable line thickness rendering with opengl4.2
*
* Instead of quad extrusion in a geometry shader, thick lines are manually rasterized in a load/store image.
......@@ -498,6 +506,10 @@ protected:
/// array of renderobjects, filled by addRenderObject()
std::vector<ACG::RenderObject> renderObjects_;
/// map sortedID -> original renderObjectID
std::vector<int> sortListObjects_;
/// map sortedID -> original renderObjectID
std::vector<int> sortListOverlays_;
/// sorted list of renderobjects without overlay objects (sorted in rendering order)
std::vector<ACG::RenderObject*> sortedObjects_;
......@@ -508,6 +520,12 @@ protected:
/// active render object modifiers
std::vector<ACG::RenderObjectModifier*> renderObjectModifiers_;
/// source node that added the render object (map renderObjectID -> scenegraph node)
std::vector<ACG::SceneGraph::BaseNode*> renderObjectSource_;
/// source node that added the overlay render object (map renderObjectID -> scenegraph node)
std::vector<ACG::SceneGraph::BaseNode*> overlayObjectSource_;
/**
* Stores fbo containing a depth map for each viewport.
* The depth map is computed in a z-prepass if at least one RenderObject makes use of the scene depth map.
......
......@@ -65,7 +65,7 @@
#if defined(ARCH_DARWIN)
#include <gl/glew.h>
#include <GL/glew.h>
#elif defined(WIN32)
......
......@@ -863,7 +863,7 @@ void CoordsysNode::boundingCircle(std::vector<Vec2f> &_in, Vec2f &_center, float
for (unsigned int i = 0; i < _in.size () - 1; i++)
for (unsigned int j = i + 1; j < _in.size (); j++)
{
Vec2f cen = (_in[i] + _in[j]) * 0.5;
Vec2f cen = (_in[i] + _in[j]) * 0.5f;
float rad = (_in[i] - cen).length ();
bool allin = true;
......
......@@ -301,9 +301,9 @@ add_primitive(GlutPrimitiveType _type, Vec3d _pos, Vec3d _axis, ACG::Vec4f _colo
//----------------------------------------------------------------------------
void
GlutPrimitiveNode::draw_obj(int _idx) const
GlutPrimitiveNode::draw_obj(size_t _idx) const
{
if (_idx < 0 || _idx >= (int)primitives_.size()) // range check
if ( _idx >= primitives_.size()) // range check
return;
Vec3d axis = primitives_[_idx].axis;
......@@ -390,7 +390,7 @@ pick(GLState& _state , PickTarget _target)
case PICK_ANYTHING:
case PICK_FACE:
{
for (int i = 0; i < (int)primitives_.size(); ++i)
for (size_t i = 0; i < primitives_.size(); ++i)
{
_state.pick_set_name(i);
glPushMatrix();
......
......@@ -217,7 +217,7 @@ public:
/// drawing the primitive
void draw(GLState& _state, const DrawModes::DrawMode& _drawMode);
void draw_obj(int _idx) const;
void draw_obj(size_t _idx) const;
/// picking
void pick(GLState& _state, PickTarget _target);
......
......@@ -372,7 +372,7 @@ void LineNode::pick(GLState& _state , PickTarget _target)
ACG::GLState::vertexPointer( &(points_)[0] );
ACG::GLState::enableClientState(GL_VERTEX_ARRAY);
const unsigned int n_edges = n_points() - 1;
const size_t n_edges = n_points() - 1;
switch (_target)
{
......@@ -414,25 +414,25 @@ void LineNode::pick_edges(GLState& _state, unsigned int _offset)
if (line_mode_ == PolygonMode)
{
const unsigned int n_edges = n_points() - 1;
for (unsigned int i = 0; i < n_edges; ++i)
const size_t n_edges = n_points() - 1;
for (size_t i = 0; i < n_edges; ++i)
{
_state.pick_set_name(i + _offset);
glBegin(GL_LINES);
glArrayElement(i);
glArrayElement(i + 1);
glArrayElement(static_cast<GLint>(i));
glArrayElement(static_cast<GLint>(i + 1));
glEnd();
}
}
else if (line_mode_ == LineSegmentsMode)
{
const unsigned int n_edges = n_points() / 2;
for (unsigned int i = 0; i < n_edges; ++i)
const size_t n_edges = n_points() / 2;
for (size_t i = 0; i < n_edges; ++i)
{
_state.pick_set_name(i + _offset);
glBegin(GL_LINES);
glArrayElement(2*i);
glArrayElement(2*i + 1);
glArrayElement(static_cast<GLint>(2*i));
glArrayElement(static_cast<GLint>(2*i + 1));
glEnd();
}
}
......
......@@ -183,7 +183,7 @@ public:
/** \brief get the internal mesh
*/
const Mesh& mesh() const { return mesh_; }
const Mesh& mesh() const { return mesh_; }
private:
/// The mesh this node works on
......
......@@ -266,7 +266,7 @@ enter(GLState& _state, const DrawModes::DrawMode& /*_drawmode*/) {
ACG::GLState::enable(GL_TEXTURE_2D);
ACG::GLState::enable(GL_BLEND);
ACG::GLState::enable(GL_ALPHA_TEST);
ACG::GLState::alphaFunc(GL_GREATER, 0.2);
ACG::GLState::alphaFunc(GL_GREATER, 0.2f);
ACG::GLState::blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (alwaysOnTop_)
ACG::GLState::disable(GL_DEPTH_TEST);
......
......@@ -818,6 +818,8 @@ void TranslationManipulatorNode::getRenderObjects(IRenderer* _renderer,
ro.blending = false;
ro.depthFunc = GL_LEQUAL;
ro.depthWrite = true;
ro.alpha = 1.0f;
addManipulatorToRenderer(_renderer, &ro, true);
}
}
......@@ -871,12 +873,14 @@ void TranslationManipulatorNode::addManipulatorToRenderer (IRenderer* _renderer,
//================================================================================================
// gluCylinder draws into z direction so z-Axis first
_baseRO->debugName = "TranslationManipulatorNode.z";
addAxisToRenderer(_renderer, _baseRO, _active, ZAxis);
//================================================================================================
// Y-Axis
//================================================================================================
_baseRO->debugName = "TranslationManipulatorNode.y";
_baseRO->modelview.rotate(-90, 1.0, 0.0, 0.0);
addAxisToRenderer(_renderer, _baseRO, _active, YAxis);
......@@ -884,6 +888,7 @@ void TranslationManipulatorNode::addManipulatorToRenderer (IRenderer* _renderer,
// X-Axis
//================================================================================================
_baseRO->debugName = "TranslationManipulatorNode.x";
_baseRO->modelview.rotate(90, 0.0, 1.0, 0.0);
addAxisToRenderer(_renderer, _baseRO, _active, XAxis);
......@@ -891,6 +896,8 @@ void TranslationManipulatorNode::addManipulatorToRenderer (IRenderer* _renderer,
// Sphere
//=================================================================================================
_baseRO->debugName = "TranslationManipulatorNode.sphere";
for (int i = 0; i < 3; ++i)
_baseRO->emissive[i] = _active ? (element_[Origin].active_current_color_[i]) : (element_[Origin].inactive_current_color_[i]);
......@@ -908,6 +915,8 @@ void TranslationManipulatorNode::addManipulatorToRenderer (IRenderer* _renderer,
if ( activeRotations_ & X_AXIS)
{
_baseRO->name = "TranslationManipulatorNode.x_ring";
for (int i = 0; i < 3; ++i)
_baseRO->emissive[i] = _active ? (element_[XRing].active_current_color_[i]) : (element_[XRing].inactive_current_color_[i]);
......@@ -918,6 +927,8 @@ void TranslationManipulatorNode::addManipulatorToRenderer (IRenderer* _renderer,
_baseRO->modelview.rotate(90, 0.0, 1.0, 0.0);
if ( activeRotations_ & Y_AXIS)
{
_baseRO->debugName = "TranslationManipulatorNode.y_ring";
for (int i = 0; i < 3; ++i)
_baseRO->emissive[i] = _active ? (element_[YRing].active_current_color_[i]) : (element_[YRing].inactive_current_color_[i]);
circle_->addToRenderer_primitive(_renderer, _baseRO);
......@@ -926,6 +937,8 @@ void TranslationManipulatorNode::addManipulatorToRenderer (IRenderer* _renderer,
_baseRO->modelview.rotate(90, 1.0, 0.0, 0.0);
if ( activeRotations_ & Z_AXIS)
{
_baseRO->debugName = "TranslationManipulatorNode.z_ring";
for (int i = 0; i < 3; ++i)
_baseRO->emissive[i] = _active ? (element_[ZRing].active_current_color_[i]) : (element_[ZRing].inactive_current_color_[i]);
circle_->addToRenderer_primitive(_renderer, _baseRO);
......
......@@ -83,6 +83,11 @@ namespace GLSL {
clear();
}
void UniformPool::operator =(const UniformPool& _other) {
addPool(_other);
}
void UniformPool::clear() {
// Delete the uniforms in that pool
for (UniformListIt it = pool_.begin(); it != pool_.end(); ++it)
......@@ -311,7 +316,6 @@ namespace GLSL {
checkGLError2(id.c_str());
}
/** \brief Creates a copy of input data
*/
UniformPool::UniformBuf::UniformBuf()
......
......@@ -121,6 +121,11 @@ namespace GLSL {
*/
bool empty() const;
/** \brief copy
*
*/
void operator =(const UniformPool& _other);
private:
struct UniformBase {
std::string id;
......
......@@ -39,70 +39,92 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* *
\*===========================================================================*/
#ifndef ACG_UTILS_SMARTPOINTER_HH
#define ACG_UTILS_SMARTPOINTER_HH
#ifndef SMARTPOINTER_HH
#define SMARTPOINTER_HH
//== FORWARDDECLARATIONS ======================================================
//== NAMESPACES ===============================================================
//== DEFINITION =========================================================
/** This set of defines maps the pointer namespaces to the namespace ptr depending on
* the current architecture and compilers.
*/
#if ( (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 201112L) )
// C++11:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
// C++11 via -std=c++0x on gcc:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#else
// C++98 and TR1:
#if (_MSC_VER >= 1600)
// VStudio 2010 supports some C++11 features
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif (_MSC_VER >= 1500)
// hope for TR1 equivalents
#if(_HAS_TR1)
#include <memory>
namespace ptr = std::tr1;
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#else
#pragma warning "TR1 not available! Please install Visual Studio Service Pack 1!"
#endif
#else
// hope for TR1 equivalents
// check for clang5 but switch to tr1 if clang uses libstdc++
#if defined(__clang_major__) && (__clang_major__ >= 5) && !defined(__GLIBCXX__ )
// Mavericks special treatment
#include <memory>
namespace ptr = std;
/*************************************************
* Warning! This header file is duplicated in *
* OpenVolumeMesh with the same header guard, *
* as src/OpenVolumeMesh/System/MemoryInclude.hh.*
* If you change this file, you should change *
* that file as well. *
*************************************************/
#include <memory>
// Default for C++ 11 and higher
#if ((defined(_MSC_VER) && (_MSC_VER >= 1900)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
// legacy code may depend on this define:
#define ACG_UNIQUE_POINTER_SUPPORTED 1
namespace ptr {
using std::shared_ptr;
using std::make_shared;
using std::unique_ptr;
#if __cplusplus >= 201402L
using std::make_unique;
#else
template<typename T, typename... Args>
std::unique_ptr<T>
make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif // C++14
} // namespace ptr
#else // deprecated things
/** This set of defines maps the pointer namespaces to the namespace ptr depending on
* the current architecture and compilers.
*/
#if ( (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 201112L) )
// C++11:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif defined(__GXX_EXPERIMENTAL_CXX0X__)
// C++11 via -std=c++0x on gcc:
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#else
#include <tr1/memory>
namespace ptr = std::tr1;
// C++98 and TR1:
#if (_MSC_VER >= 1600)
// VStudio 2010 supports some C++11 features
#include <memory>
namespace ptr = std;
#define ACG_UNIQUE_POINTER_SUPPORTED 1
#elif (_MSC_VER >= 1500)
// hope for TR1 equivalents
#if(_HAS_TR1)
#include <memory>
namespace ptr = std::tr1;
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#else
#pragma warning "TR1 not available! Please install Visual Studio Service Pack 1!"
#endif
#else
// hope for TR1 equivalents
// check for clang5 but switch to tr1 if clang uses libstdc++
#if defined(__clang_major__) && (__clang_major__ >= 5) && !defined(__GLIBCXX__ )
// Mavericks special treatment
#include <memory>
namespace ptr = std;
#else
#include <tr1/memory>
namespace ptr = std::tr1;
#endif
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#endif
#endif
#define ACG_UNIQUE_POINTER_SUPPORTED 0
#endif
#endif
//=============================================================================
#endif // SMARTPOINTER_HH defined
//=============================================================================
#endif // ACG_UTILS_SMARTPOINTER_HH
########################################
# Fetch submodules
########################################
git submodule init
git submodule update --remote
########################################
# Fetch test data
########################################
rm -rf TestData
git clone git@roosevelt:moebius/OpenFlipper-Test-Data.git TestData
########################################
# Build
########################################
if [ ! -d build-release ]; then
mkdir build-release
fi
cd build-release
# Build without ports to avoid qt4 collision
/opt/local/bin/cmake ../ -DCMAKE_CXX_FLAGS='-std=c++11' -DQWT6_INCLUDE_DIR=/Users/jenkins/sw/qwt-6.1.2-Qt5-installed/lib/qwt.framework/Headers -DQWT6_LIBRARY=/Users/jenkins/sw/qwt-6.1.2-Qt5-installed/lib/qwt.framework -DQT5_INSTALL_PATH=/Qt/Qt5.5.1/5.5/clang_64 -DGLEW_INCLUDE_DIR=/Users/jenkins/sw/glew-1.10.0-installed/include/ -DGLEW_LIBRARY=/Users/jenkins/sw/glew-1.10.0-installed/lib/libGLEW.dylib
make
# Required for the tests to build, if a package was generated
make fixbundle
########################################
# Test
########################################
# Run tests
cd tests
bash run_tests.sh
cd ..
########################################
# Doc
########################################
make doc >> ../Doxygen-warning.log 2> ../Doxygen-error.log
########################################
# Package
########################################
rm -f *.dmg
make OpenFlipper_package