Commit b835f85f authored by Max Lyon's avatar Max Lyon

Merge branch 'master' into OVMv2betacompatibility

parents badbac66 231a17cf
Pipeline #2273 canceled with stage
in 11 minutes and 28 seconds
......@@ -47,3 +47,6 @@ cppcheck:
tags:
- Linux
- MultiThreads
artifacts:
paths:
- cppcheck.log
......@@ -27,12 +27,17 @@ endif ()
acg_openmp ()
# check for OpenGL and GLUT as our required dependencies
# check for OpenGL, GLEW and GLUT as our required dependencies
find_package (OpenGL)
if (NOT OPENGL_FOUND)
message (FATAL_ERROR "OpengGL not found!")
endif ()
find_package (GLEW)
if (NOT GLEW_FOUND)
message (FATAL_ERROR "GLEW not found!")
endif ()
find_package (GLUT)
if (NOT GLUT_FOUND)
message (FATAL_ERROR "GLUT not found!")
......@@ -48,6 +53,7 @@ set(INCLUDE_DIRS ${OPENMESH_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/ShaderUtils
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR} )
set(ADDITIONAL_LINK_LIBRARIES "" )
......@@ -84,6 +90,7 @@ include_directories (
)
link_directories (
${GLEW_LIBRARY_DIR}
${GLUT_LIBRARY_DIR}
)
......@@ -149,9 +156,12 @@ endif ()
# display results
acg_print_configure_header (ACG "ACG")
RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries ( ACG ${OPENMESH_LIBRARIES}
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
${ADDITIONAL_LINK_LIBRARIES} )
......
......@@ -126,13 +126,10 @@ MSFilterWeights::MSFilterWeights(int _numSamples) : numSamples_(_numSamples) {
//=============================================================================
#if defined(GL_ARB_texture_buffer_object)
void MSFilterWeights::asTextureBuffer( TextureBuffer& out ) {
if (numSamples_)
out.setBufferData(numSamples_ * 4, &weights_[0], GL_R32F, GL_STATIC_DRAW);
}
#endif
//=============================================================================
......
......@@ -125,6 +125,7 @@ void FBO::del()
void FBO::attachTexture( GLenum _attachment, GLuint _texture, GLuint _level )
{
#ifdef GL_VERSION_3_2
// bind fbo
bind();
......@@ -154,6 +155,9 @@ void FBO::attachTexture( GLenum _attachment, GLuint _texture, GLuint _level )
// track texture id
attachments_[_attachment] = intID;
#else
std::cerr << "error: FBO::attachTexture unsupported - update glew headers and rebuild" << std::endl;
#endif
}
//-----------------------------------------------------------------------------
......
......@@ -47,7 +47,6 @@
* *
\*===========================================================================*/
#include <ACG/GL/acg_glew.hh>
#include <ACG/GL/GLFormatInfo.hh>
#include <iostream>
#include <QString>
......@@ -82,6 +81,7 @@ GLFormatInfo::GLFormatInfo( GLenum _internalFormat )
registerFmt(GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 24, 8, 0, 0, UnsignedInt, false);
registerFmt(GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 24, 8, 0, 0, UnsignedInt, false);
#ifdef GL_VERSION_3_0
// single channel formats
registerFmt(GL_R8, GL_RED, GL_UNSIGNED_BYTE, 8, 0, 0, 0, UnsignedInt, true);
registerFmt(GL_R8_SNORM, GL_RED, GL_BYTE, 8, 0, 0, 0, SignedInt, true);
......@@ -130,18 +130,19 @@ GLFormatInfo::GLFormatInfo( GLenum _internalFormat )
registerFmt(GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, 32, 32, 32, 32, SignedInt, false);
registerFmt(GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, 32, 32, 32, 32, UnsignedInt, false);
registerFmt(GL_RGBA32F, GL_RGBA, GL_FLOAT, 32, 32, 32, 32, FloatingPt, false);
#endif // GL_VERSION_3_0
// depth
registerFmt(GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 24, 0, 0, 0, UnsignedInt, false);
registerFmt(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 16, 0, 0, 0, UnsignedInt, false);
#ifdef GL_DEPTH_COMPONENT32F
#ifdef GL_ARB_depth_buffer_float
registerFmt(GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, 32, 0, 0, 0, FloatingPt, false);
registerFmt(GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 32, 8, -24, 0, FloatingPt, false);
#endif
#endif // GL_ARB_depth_buffer_float
#ifdef GL_STENCIL_INDEX8
#ifdef GL_ARB_texture_stencil8
registerFmt(GL_STENCIL_INDEX8, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, 8, 0, 0, 0, UnsignedInt, false);
#endif
#endif // GL_ARB_texture_stencil8
}
std::map<GLenum, GLFormatInfo>::iterator f = formatMap_.find(_internalFormat);
......
......@@ -1327,7 +1327,7 @@ void GLState::syncFromGL()
GLint getparam;
#ifdef GL_BLEND_SRC_RGB
#ifdef GL_VERSION_1_4
glGetIntegerv(GL_BLEND_SRC_RGB, &getparam);
stateStack_.back().blendFuncState_[0] = getparam;
......@@ -1611,7 +1611,7 @@ void GLState::blendFuncSeparate(GLenum _srcRGB, GLenum _dstRGB, GLenum _srcAlpha
stateStack_.back().blendFuncState_[2] != _srcAlpha || stateStack_.back().blendFuncState_[3] != _dstAlpha)
#endif
{
#ifdef GL_BLEND_SRC_RGB
#ifdef GL_VERSION_1_4
// check if glew has loaded glBlendFuncSeparate already
if (glBlendFuncSeparate)
glBlendFuncSeparate(_srcRGB, _dstRGB, _srcAlpha, _dstAlpha);
......
......@@ -316,7 +316,7 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
p->internalFlags_ = 0;
// precompile shader
#ifdef GL_GEOMETRY_INPUT_TYPE
#ifdef GL_VERSION_3_2
GLSL::Program* shaderProg = ACG::ShaderCache::getInstance()->getProgram(&p->shaderDesc);
#endif
......@@ -324,7 +324,7 @@ void IRenderer::addRenderObject(ACG::RenderObject* _renderObject)
// check primitive type and geometry shader
if (errorDetectionLevel_ > 1 && p->shaderDesc.geometryTemplateFile.length())
{
#ifdef GL_GEOMETRY_INPUT_TYPE
#ifdef GL_VERSION_3_2
GLint geomInputType = 0;
glGetProgramiv(shaderProg->getProgramId(), GL_GEOMETRY_INPUT_TYPE, &geomInputType);
......
......@@ -371,10 +371,10 @@ public:
inline void glDrawArrays(GLenum mode, GLint first, GLsizei count)
{
this->glDrawArraysInstanced(mode, first, count, 0);
this->glDrawInstancedArrays(mode, first, count, 0);
}
inline void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
inline void glDrawInstancedArrays(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
{
indexBuffer = 0;
sysmemIndexBuffer = 0;
......
......@@ -188,7 +188,14 @@ void ScreenQuad::intDraw (GLSL::Program* _prog, int _numInstances)
if (_numInstances < 1)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
else
{
#ifdef GL_VERSION_3_1
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, _numInstances);
#else
std::cerr << "error: instanced ScreenQuad draw - outdated glew version" << std::endl;
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
#endif
}
if (_prog)
decl_->deactivateShaderPipeline(_prog);
......
......@@ -62,13 +62,20 @@
#include <cstdlib>
#include <sstream>
#ifndef __APPLE__
#include "gl_compat_4_4.hh"
#else
#include <qgl>
#endif
#if defined(ARCH_DARWIN)
#include <gl/glew.h>
#elif defined(WIN32)
#include <gl/glew.h>
#else // Unix
#include <GL/glew.h>
#endif
//=============================================================================
......
......@@ -69,8 +69,11 @@
#elif defined(WIN32)
#include "acg_glew.hh"
#include <windows.h>
// Dont do this anymore! Use dll version. No problems with plugins and dll
// but a lot with static linking
// # define GLEW_STATIC 1
#include <gl/glew.h>
#include <gl/glut.h>
#else
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -47,7 +47,6 @@
* *
\*===========================================================================*/
#include <ACG/GL/acg_glew.hh>
#include <ACG/GL/globjects.hh>
#include <ACG/GL/GLFormatInfo.hh>
......
......@@ -1128,8 +1128,7 @@ void QtBaseViewer::initializeGL()
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
//glewInit();
ogl_LoadFunctions();
glewInit();
#endif
......@@ -1243,8 +1242,7 @@ void QtBaseViewer::paintGL()
// we use GLEW to manage extensions
// initialize it first
#ifndef __APPLE__
//glewInit();
ogl_LoadFunctions();
glewInit();
#endif
// lock update
......
......@@ -126,8 +126,8 @@ QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
ui_.shininessSlider->setValue((int)shine_);
ui_.shininessBox->setValue((int)shine_);
ui_.pointSizeSpinBox->setValue((int)point_size_);
ui_.lineWidthSpinBox->setValue((int)line_width_);
ui_.pointSizeSpinBox->setValue(point_size_);
ui_.lineWidthSpinBox->setValue(line_width_);
ui_.roundPointsCheckBox->setChecked(round_points_);
ui_.lineSmoothCheckBox->setChecked(line_smooth_);
ui_.backfaceCulling->setChecked( backfaceCulling_ );
......@@ -166,8 +166,8 @@ QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
connect( ui_.overlayColorButton, SIGNAL( clicked() ), this, SLOT( enableProperty() ) );
connect( ui_.shininessSlider, SIGNAL( sliderPressed() ), this, SLOT( enableProperty() ) );
connect( ui_.shininessBox, SIGNAL( valueChanged(int) ), this, SLOT( enableProperty(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( enableProperty(int) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( enableProperty(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(double) ), this, SLOT( enableProperty(double) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(double) ), this, SLOT( enableProperty(double) ) );
connect( ui_.roundPointsCheckBox, SIGNAL( pressed() ), this, SLOT( enableProperty() ) );
connect( ui_.lineSmoothCheckBox, SIGNAL( pressed() ), this, SLOT( enableProperty() ) );
connect( ui_.backfaceCulling, SIGNAL( pressed() ), this, SLOT( enableProperty() ) );
......@@ -189,10 +189,10 @@ QtMaterialDialog::QtMaterialDialog( QWidget * _parent,
connect( ui_.shininessSlider, SIGNAL( valueChanged(int) ),
this, SLOT( changeShine(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(int) ),
this, SLOT( changePointSize(int) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(int) ),
this, SLOT( changeLineWidth(int) ) );
connect( ui_.pointSizeSpinBox, SIGNAL( valueChanged(double) ),
this, SLOT( changePointSize(double) ) );
connect( ui_.lineWidthSpinBox, SIGNAL( valueChanged(double) ),
this, SLOT( changeLineWidth(double) ) );
connect( ui_.roundPointsCheckBox, SIGNAL( toggled(bool) ),
this, SLOT( changeRoundPoints(bool) ) );
connect( ui_.lineSmoothCheckBox, SIGNAL( toggled(bool) ),
......@@ -531,9 +531,9 @@ QtMaterialDialog::changeShine(int _new)
void
QtMaterialDialog::changePointSize(int _new)
QtMaterialDialog::changePointSize(double _new)
{
point_size_ = _new;
point_size_ = float(_new);
applyChanges();
}
......@@ -542,9 +542,9 @@ QtMaterialDialog::changePointSize(int _new)
void
QtMaterialDialog::changeLineWidth(int _new)
QtMaterialDialog::changeLineWidth(double _new)
{
line_width_ = _new;
line_width_ = float(_new);
applyChanges();
}
......@@ -749,6 +749,32 @@ QtMaterialDialog::enableProperty(int /*i*/)
else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked( true );
}
//-----------------------------------------------------------------------------
void
QtMaterialDialog::enableProperty(double d)
{
if (sender() == ui_.baseColorButton) ui_.baseColorActive->setChecked(true);
else if (sender() == ui_.ambientColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.diffuseColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.specularColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.overlayColorButton) ui_.materialActive->setChecked(true);
else if (sender() == ui_.shininessSlider) ui_.materialActive->setChecked(true);
else if (sender() == ui_.shininessBox) ui_.materialActive->setChecked(true);
else if (sender() == ui_.pointSizeSpinBox) ui_.pointSizeActive->setChecked(true);
else if (sender() == ui_.lineWidthSpinBox) ui_.lineWidthActive->setChecked(true);
else if (sender() == ui_.roundPointsCheckBox) ui_.roundPointsActive->setChecked(true);
else if (sender() == ui_.lineSmoothCheckBox) ui_.lineSmoothActive->setChecked(true);
else if (sender() == ui_.backfaceCulling) ui_.backfaceCullingActive->setChecked(true);
else if (sender() == ui_.alphaTest) ui_.alphaTestActive->setChecked(true);
else if (sender() == ui_.blending) ui_.blendingActive->setChecked(true);
else if (sender() == ui_.colorMaterial) ui_.colorMaterialActive->setChecked(true);
else if (sender() == ui_.multiSampling) ui_.multiSamplingActive->setChecked(true);
}
//-----------------------------------------------------------------------------
void
......
......@@ -125,8 +125,8 @@ private slots:
void changeSpecularColor(QColor _newColor);
void changeOverlayColor(QColor _newColor);
void changeShine(int _new);
void changePointSize(int _new);
void changeLineWidth(int _new);
void changePointSize(double _new);
void changeLineWidth(double _new);
void changeRoundPoints(bool _b);
void changeLineSmooth(bool _b);
void changeBackfaceCulling(bool _b);
......@@ -142,6 +142,7 @@ private slots:
void enableProperty();
void enableProperty(int i);
void enableProperty(double d);
QString paramToStr(GLenum param);
......
......@@ -34,7 +34,16 @@
<string>Material</string>
</property>
<layout class="QGridLayout" name="MaterialBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
......@@ -68,7 +77,16 @@
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="ColorButtonLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
......@@ -295,7 +313,16 @@
<string>Thickness</string>
</property>
<layout class="QGridLayout" name="ThicknessBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
......@@ -306,29 +333,53 @@
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="PointLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QSpinBox" name="pointSizeSpinBox">
<widget class="QDoubleSpinBox" name="pointSizeSpinBox">
<property name="alignment">
<set>Qt::AlignRight</set>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QSpinBox" name="lineWidthSpinBox">
<widget class="QDoubleSpinBox" name="lineWidthSpinBox">
<property name="alignment">
<set>Qt::AlignRight</set>
</property>
<property name="minimum">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
......@@ -772,7 +823,16 @@ back is visible should be rendered.</string>
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......
......@@ -706,12 +706,6 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
// 1. setup drawMesh based on property source
if (props->flatShaded())
drawMesh_->setFlatShading();
else
drawMesh_->setSmoothShading();
ro.shaderDesc.vertexColors = true;
switch (props->colorSource())
......@@ -725,13 +719,23 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
} break;
}
switch (props->normalSource())
// only the polygon primitives can set the normal source
if (props->primitive() == DrawModes::PRIMITIVE_POLYGON)
{
case DrawModes::NORMAL_PER_VERTEX: drawMesh_->usePerVertexNormals(); break;
case DrawModes::NORMAL_PER_HALFEDGE: drawMesh_->usePerHalfedgeNormals(); break;
default: break;
switch (props->normalSource())
{
case DrawModes::NORMAL_PER_VERTEX: drawMesh_->usePerVertexNormals(); break;
case DrawModes::NORMAL_PER_HALFEDGE: drawMesh_->usePerHalfedgeNormals(); break;
default: break;
}
if (props->flatShaded())
drawMesh_->setFlatShading();
else
drawMesh_->setSmoothShading();
}
ro.shaderDesc.addTextureType(GL_TEXTURE_2D,false,0);
switch (props->texcoordSource())
......@@ -772,6 +776,8 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
if (props->primitive() == DrawModes::PRIMITIVE_WIREFRAME)
{
ro.debugName = "MeshNode.Wireframe";
ro.shaderDesc.shadeMode = SG_SHADE_UNLIT;
drawMesh_->disableColors();
......@@ -812,6 +818,8 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
// disable color write
ro.glColorMask(0,0,0,0);
ro.debugName = "MeshNode.HiddenLine.faces";
add_face_RenderObjects(_renderer, &ro);
}
......@@ -825,6 +833,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
applyRenderObjectSettings(DrawModes::PRIMITIVE_HIDDENLINE, &ro);
ro.debugName = "MeshNode.HiddenLine.lines";
add_line_RenderObjects(_renderer, &ro);
}
......@@ -845,6 +854,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
ro.setupLineRendering(_state.line_width(), Vec2f((float)_state.viewport_width(), (float)_state.viewport_height()));
applyRenderObjectSettings(props->primitive(), &ro);
ro.debugName = "MeshNode.Edges";
_renderer->addRenderObject(&ro);
// skip other edge primitives for this drawmode layer
......@@ -872,6 +882,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
ro.setupLineRendering(_state.line_width(), Vec2f((float)_state.viewport_width(), (float)_state.viewport_height()));
applyRenderObjectSettings(props->primitive(), &ro);
ro.debugName = "MeshNode.HalfEdges";
_renderer->addRenderObject(&ro);
}
......@@ -898,6 +909,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
ro.setupPointRendering(_mat->pointSize(), Vec2f((float)_state.viewport_width(), (float)_state.viewport_height()));
applyRenderObjectSettings(props->primitive(), &ro);
ro.debugName = "MeshNode.Points";
add_point_RenderObjects(_renderer, &ro);
} break;
case DrawModes::PRIMITIVE_EDGE:
......@@ -909,6 +921,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
ro.setupLineRendering(_state.line_width(), Vec2f((float)_state.viewport_width(), (float)_state.viewport_height()));
applyRenderObjectSettings(props->primitive(), &ro);
ro.debugName = "MeshNode.Edges";
add_line_RenderObjects(_renderer, &ro);
} break;
case DrawModes::PRIMITIVE_POLYGON:
......@@ -922,6 +935,7 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
if (!useNonIndexed && props->colorSource() == DrawModes::COLOR_PER_FACE)
ro.shaderDesc.vertexColorsInterpolator = "flat";
ro.debugName = "MeshNode.Faces";
add_face_RenderObjects(_renderer, &ro, useNonIndexed);
ro.shaderDesc.vertexColorsInterpolator.clear();
......@@ -1618,6 +1632,9 @@ MeshNodeT<Mesh>::
update_textures() {
drawMesh_->updateTextures();
updateVertexPicking_ = true;
updateFacePicking_ = true;
updateAnyPicking_ = true;
}
......
......@@ -555,7 +555,10 @@ void TextureNode::leavePick(GLState& /*_state*/, PickTarget /*_target*/, const D
GLuint TextureNode::activeTexture()
{
return textures_[activeTexture_].tex->id();
if (0 <= activeTexture_ && activeTexture_ < int(textures_.size()))
return textures_[activeTexture_].tex->id();
return 0;
}
//----------------------------------------------------------------------------
......
......@@ -361,7 +361,8 @@ TEST_F(BSP_CUBE_BASE, RayIntersectionAboveSurface_NonDirectionalFunction_1 ) {
Mesh::Point yDirection(0.0,1.0,0.0);
Mesh::Point p1(-0.5,-2.0,0.0);
BSP::RayCollision rc = bsp_->raycollision(p1,yDirection);
BSP::RayCollision rc;
rc = bsp_->raycollision(p1,yDirection);
EXPECT_EQ(2u, rc.size() ) << "Wrong number of hit faces in ray collision test 1";
if ( rc.size() == 2u ) { // Don't crash on wrong size
......@@ -394,7 +395,8 @@ TEST_F(BSP_CUBE_BASE, RayIntersectionAboveSurface_NonDirectionalFunction_Negativ
Mesh::Point nyDirection(0.0,-1.0,0.0);
Mesh::Point p1(-0.5,-2.0,0.0);
BSP::RayCollision rc = bsp_->raycollision(p1,nyDirection);
BSP::RayCollision rc;
rc = bsp_->raycollision(p1,nyDirection);
EXPECT_EQ(2u, rc.size() ) << "Wrong number of hit faces in ray collision test 1";
if ( rc.size() == 2u ) { // Don't crash on wrong size
......@@ -422,7 +424,8 @@ TEST_F(BSP_CUBE_BASE, RayIntersectionAboveSurface_NonDirectionalFunction_2 ) {
Mesh::Point yDirection(0.0,1.0,0.0);
Mesh::Point p1(0.5,-2.0,0.0);
BSP::RayCollision rc = bsp_->raycollision(p1,yDirection);
BSP::RayCollision rc;
rc = bsp_->raycollision(p1,yDirection);
EXPECT_EQ(2u, rc.size() ) << "Wrong number of hit faces in ray collision test 2";
if ( rc.size() == 2u ) { // Don't crash on wrong size
......@@ -452,7 +455,8 @@ TEST_F(BSP_CUBE_BASE, RayIntersectionAboveSurface_NonDirectionalFunction_Negativ
Mesh::Point nyDirection(0.0,-1.0,0.0);
Mesh::Point p1(0.5,-2.0,0.0);
BSP::RayCollision rc = bsp_->raycollision(p1,nyDirection);
BSP::RayCollision rc;
rc = bsp_->raycollision(p1,nyDirection);
EXPECT_EQ(2u, rc.size() ) << "Wrong number of hit faces in ray collision test 2";
if ( rc.size() == 2u ) { // Don't crash on wrong size
......@@ -489,7 +493,8 @@ TEST_F(BSP_CUBE_BASE, RayIntersectionAboveSurface_DirectionalFunction_1 ) {
Mesh::Point yDirection(0.0,1.0,0.0);
Mesh::Point origin(-0.5,-2.0,0.0);
BSP::RayCollision rc = bsp_->directionalRaycollision(origin,yDirection);
BSP::RayCollision rc;
rc = bsp_->directionalRaycollision(origin,yDirection);
EXPECT_EQ(2u, rc.size() ) << "Wrong number of hit faces in ray collision test 1";
if ( rc.size() == 2u ) { // Don't crash on wrong size
......@@ -545,7 +550,8 @@ TEST_F(BSP_CUBE_BASE, RayIntersectionAboveSurface_DirectionalFunction_NegativeDi