Commit d5d75bd3 authored by Sylvain Thery's avatar Sylvain Thery Committed by Pierre Kraemer

remove clipping using std::regex for gcc 4.8 (see volumeExplorer for clippig topo)

parent 87ffd3a7
......@@ -40,7 +40,7 @@ qt_wrap_cpp( viewer_moc viewer.h )
add_executable( viewer viewer.cpp ${viewer_moc} ${viewer_ui} )
target_link_libraries( viewer ${CGoGN_LIBS} ${NUMERICAL_LIBS} ${CGoGN_EXT_LIBS} )
IF (HAS_CPP11_REGEX)
IF (CGoGN_GCC_4_9)
qt_wrap_ui( clipping_ui clipping.ui )
qt_wrap_cpp( clipping_moc clipping.h )
add_executable( clipping clipping.cpp ${clipping_ui} ${clipping_moc} )
......
......@@ -67,9 +67,6 @@ public:
unsigned int setAttributePosition(VBO* vbo);
void setClippingPlane(const Geom::Vec4f& plane);
inline void setNoClippingPlane() { setClippingPlane(Geom::Vec4f(0.0f,0.0f,0.0f,0.0f)); }
};
} // namespace Utils
......
......@@ -21,10 +21,10 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#define CGoGN_UTILS_DLL_EXPORT 1
#include "Utils/Shaders/shaderColorPerVertex.h"
namespace CGoGN
{
......@@ -36,7 +36,6 @@ namespace Utils
#include "shaderColorPerVertexClip.vert"
#include "shaderColorPerVertexClip.frag"
ShaderColorPerVertex::ShaderColorPerVertex(bool withClipping, bool black_is_transparent)
{
if (withClipping)
......@@ -45,10 +44,10 @@ ShaderColorPerVertex::ShaderColorPerVertex(bool withClipping, bool black_is_tran
m_nameFS = "ShaderColorPerVertexClip_fs";
m_nameGS = "";
std::string glxvert(GLSLShader::defines_gl());
std::string glxvert(*GLSLShader::DEFINES_GL);
glxvert.append(vertexShaderClipText);
std::string glxfrag(GLSLShader::defines_gl());
std::string glxfrag(*GLSLShader::DEFINES_GL);
if (black_is_transparent)
glxfrag.append("#define BLACK_TRANSPARENCY 1\n");
glxfrag.append(fragmentShaderClipText);
......@@ -65,10 +64,10 @@ ShaderColorPerVertex::ShaderColorPerVertex(bool withClipping, bool black_is_tran
m_nameFS = "ShaderColorPerVertex_fs";
m_nameGS = "ShaderColorPerVertex_gs";
std::string glxvert(GLSLShader::defines_gl());
std::string glxvert(*GLSLShader::DEFINES_GL);
glxvert.append(vertexShaderText);
std::string glxfrag(GLSLShader::defines_gl());
std::string glxfrag(*GLSLShader::DEFINES_GL);
if (black_is_transparent)
glxfrag.append("#define BLACK_TRANSPARENCY 1\n");
glxfrag.append(fragmentShaderText);
......@@ -102,7 +101,6 @@ unsigned int ShaderColorPerVertex::setAttributeColor(VBO* vbo)
return id;
}
void ShaderColorPerVertex::restoreUniformsAttribs()
{
bind();
......@@ -129,8 +127,6 @@ void ShaderColorPerVertex::setClippingPlane(const Geom::Vec4f& plane)
unbind();
}
} // namespace Utils
} // namespace CGoGN
......@@ -46,10 +46,10 @@ ShaderSimpleColor::ShaderSimpleColor(bool withClipping, bool black_is_transparen
// chose GL defines (2 or 3)
// and compile shaders
std::string glxvert(GLSLShader::defines_gl());
std::string glxvert(*GLSLShader::DEFINES_GL);
glxvert.append(vertexShaderClipText);
std::string glxfrag(GLSLShader::defines_gl());
std::string glxfrag(*GLSLShader::DEFINES_GL);
if (black_is_transparent)
glxfrag.append("#define BLACK_TRANSPARENCY 1\n");
glxfrag.append(fragmentShaderClipText);
......@@ -67,10 +67,10 @@ ShaderSimpleColor::ShaderSimpleColor(bool withClipping, bool black_is_transparen
// chose GL defines (2 or 3)
// and compile shaders
std::string glxvert(GLSLShader::defines_gl());
std::string glxvert(*GLSLShader::DEFINES_GL);
glxvert.append(vertexShaderText);
std::string glxfrag(GLSLShader::defines_gl());
std::string glxfrag(*GLSLShader::DEFINES_GL);
if (black_is_transparent)
glxfrag.append("#define BLACK_TRANSPARENCY 1\n");
glxfrag.append(fragmentShaderText);
......@@ -92,7 +92,6 @@ void ShaderSimpleColor::setColor(const Geom::Vec4f& color)
unbind();
}
void ShaderSimpleColor::setClippingPlane(const Geom::Vec4f& plane)
{
m_planeClip = plane;
......@@ -101,7 +100,6 @@ void ShaderSimpleColor::setClippingPlane(const Geom::Vec4f& plane)
unbind();
}
unsigned int ShaderSimpleColor::setAttributePosition(VBO* vbo)
{
m_vboPos = vbo;
......
......@@ -46,6 +46,8 @@ namespace Utils
*
***********************************************/
#ifdef CGOGN_GCC_4_9
ShaderMutator::ShaderMutator(const std:: string& shaderName, const std::string& vertShaderSrc, const std::string& fragShaderSrc, const std::string& geomShaderSrc)
{
......@@ -788,6 +790,106 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionEnd(const std::string& insertedCo
return true;
}
#else
ShaderMutator::ShaderMutator(const std:: string& /*shaderName*/, const std::string& /*vertShaderSrc*/, const std::string& /*fragShaderSrc*/, const std::string& /*geomShaderSrc*/)
{
}
bool ShaderMutator::containsVariableDeclaration(shaderSrcType /*srcType*/, const std::string& /*variableName*/)
{
bool result = false;
return result;
}
bool ShaderMutator::setMinShadingLanguageVersion(shaderSrcType /*srcType*/, int /*version*/)
{
bool result = false;
return result;
}
bool ShaderMutator::changeIntConstantValue(shaderSrcType /*srcType*/, const std::string& /*constantName*/, int /*newVal*/)
{
return true;
}
bool ShaderMutator::changeFloatConstantValue(shaderSrcType /*srcType*/, const std::string& /*constantName*/, float /*newVal*/)
{
return true;
}
bool ShaderMutator::insertCodeBeforeMainFunction(shaderSrcType /*srcType*/, const std::string& /*insertedCode*/)
{
return true;
}
bool ShaderMutator::insertCodeAtMainFunctionBeginning(shaderSrcType /*srcType*/, const std::string& /*insertedCode*/)
{
return true;
}
bool ShaderMutator::insertCodeAtMainFunctionEnd(shaderSrcType /*srcType*/, const std::string& /*insertedCode*/)
{
return true;
}
/***********************************************
*
* Private Section
*
***********************************************/
bool ShaderMutator::srcIsCommented(size_t /*pos*/, const std::string& /*src*/)
{
return false;
}
bool ShaderMutator::srcIsOneLineCommented(size_t /*pos*/, const std::string& /*src*/)
{
return false;
}
bool ShaderMutator::srcContainsVariableDeclaration(const std::string& /*variableName*/, std::string& /*src*/)
{
return false;
}
bool ShaderMutator::srcSetMinShadingLanguageVersion(int /*version*/, std::string& /*modifiedSrc*/)
{
return true;
}
bool ShaderMutator::srcChangeIntConstantValue(int /*newVal*/, const std::string& /*constantName*/, std::string& /*modifiedSrc*/)
{
return false;
}
bool ShaderMutator::srcChangeFloatConstantValue(float /*newVal*/, const std::string& /*constantName*/, std::string& /*modifiedSrc*/)
{
return false;
}
bool ShaderMutator::srcInsertCodeBeforeMainFunction(const std::string& /*insertedCode*/, std::string& /*modifiedSrc*/)
{
return false;
}
bool ShaderMutator::srcInsertCodeAtMainFunctionBeginning(const std::string& /*insertedCode*/, std::string& /*modifiedSrc*/)
{
return false;
}
bool ShaderMutator::srcInsertCodeAtMainFunctionEnd(const std::string& /*insertedCode*/, std::string& /*modifiedSrc*/)
{
return true;
}
#endif
} // namespace Utils
} // namespace CGoGN
......@@ -35,6 +35,12 @@ IF (WIN32)
SET ( CGoGN_WITH_QTCREATOR OFF CACHE BOOL "use QtCreator to compile (Experimental" )
ENDIF()
IF (LINUX)
SET ( CGoGN_GCC_4_9 OFF CACHE BOOL "using gcc version > 4.9 (std::regex ok !)" )
ENDIF()
SET ( BUILD_SHARED_LIBS ON CACHE BOOL "if used all library are build as shared type (.so/.dylib/.dll)" )
checkCpp11Support()
checkCpp11Feature("regex" HAS_CPP11_REGEX "False")
......@@ -166,12 +172,8 @@ IF(WIN32)
ENDIF ()
IF (APPLE)
LIST(APPEND CGoGN_DEFS -DCGOGN_APPLE)
ENDIF ()
IF (HAS_CPP11_REGEX)
LIST(APPEND CGoGN_DEFS -DHAS_CPP11_REGEX)
IF (CGoGN_GCC_4_9)
LIST(APPEND CGoGN_DEFS -DCGOGN_GCC_4_9)
ENDIF ()
......
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