Commit 10d60820 authored by untereiner's avatar untereiner

Merge branch 'develop' of icube-forge.unistra.fr:untereiner/cgogn into develop

parents 0709b5d0 ae8b21b5
# ignore QtCreator files
CMakeLists.txt.user
\ No newline at end of file
cmake_minimum_required(VERSION 2.8)
project(examples)
project(benches)
SET(CMAKE_BUILD_TYPE Release)
#SET(CMAKE_BUILD_TYPE Release)
#SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
# define includes path
......@@ -17,18 +15,18 @@ include_directories(
)
# define libs path
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/$(ConfigurationName) ${Boost_LIBRARY_DIRS} )
ELSE(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF(WIN32)
#IF(WIN32)
# link_directories( ${CGoGN_ROOT_DIR}/lib/$(ConfigurationName) ${Boost_LIBRARY_DIRS} )
#ELSE(WIN32)
# link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
#ENDIF(WIN32)
add_executable(bench_trav bench_trav.cpp )
target_link_libraries( bench_trav ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
target_link_libraries( bench_trav ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
add_executable(bench_remesh bench_remesh.cpp )
target_link_libraries( bench_remesh ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
target_link_libraries( bench_remesh ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
add_executable(bench_compact bench_compact.cpp )
target_link_libraries( bench_compact ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
target_link_libraries( bench_compact ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin)
IF (ONELIB)
SET(CGoGN_LIBS_R cgogn)
SET(CGoGN_LIBS cgogn)
ELSE (ONELIB)
SET(CGoGN_LIBS_R topology algo container utils)
SET(CGoGN_LIBS topology algo container utils)
ENDIF (ONELIB)
IF(WIN32)
# libs have same name but in different place in Visual
IF (ONELIB)
SET(CGoGN_LIBS_D cgogn)
ELSE (ONELIB)
SET(CGoGN_LIBS_D topology algo container utils)
ENDIF (ONELIB)
ELSE(WIN32)
IF (ONELIB)
SET(CGoGN_LIBS_D cgognD)
ELSE (ONELIB)
SET(CGoGN_LIBS_D topologyD algoD containerD utilsD)
ENDIF (ONELIB)
IF (WITH_QT)
add_subdirectory(Examples/Debug)
ENDIF (WITH_QT)
ENDIF(WIN32)
IF (WITH_QT)
IF (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/${ConfigurationName} ${Boost_LIBRARY_DIRS})
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/) # Release/Debug added automatically by visual
ELSE()
link_directories( ${CGoGN_ROOT_DIR}/lib/${CMAKE_BUILD_TYPE} )
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/${CMAKE_BUILD_TYPE} )
ENDIF()
include_directories(
${CGoGN_ROOT_DIR}/include
${CGoGN_EXT_INCLUDES})
IF (COMPILE_SANDBOX)
add_subdirectory(SandBox)
ENDIF()
IF (COMPILE_EXAMPLES AND WITH_QT)
add_subdirectory(Examples)
ENDIF()
IF (COMPILE_TUTOS)
add_subdirectory(Tuto)
add_subdirectory(Examples/Release)
IF (NOT DONOT_COMPILE_SANDBOX)
add_subdirectory(SandBox)
ENDIF (NOT DONOT_COMPILE_SANDBOX)
ENDIF (WITH_QT)
ENDIF()
IF (COMPILE_BENCHES)
add_subdirectory(Benches)
ENDIF()
IF (COMPILE_TESTS)
add_subdirectory(Tests)
ENDIF()
add_subdirectory(Tests)
#IF (WITH_QT)
# add_subdirectory(Tuto)
# add_subdirectory(Examples)
# IF (NOT DONOT_COMPILE_SANDBOX)
# add_subdirectory(SandBox)
# ENDIF (NOT DONOT_COMPILE_SANDBOX)
#ENDIF (WITH_QT)
add_subdirectory(Benches)
#add_subdirectory(Tests)
#add_subdirectory(Benches)
add_subdirectory(Tuto/Traversals)
add_subdirectory(Tuto/Attributes)
add_subdirectory(Tuto/Markers)
add_subdirectory(Tuto/Boundary)
add_subdirectory(Tuto/Modelling)
#add_subdirectory(Tuto/Traversals)
#add_subdirectory(Tuto/Attributes)
#add_subdirectory(Tuto/Markers)
#add_subdirectory(Tuto/Boundary)
#add_subdirectory(Tuto/Modelling)
cmake_minimum_required(VERSION 2.8)
project(examples)
#SET(CMAKE_BUILD_TYPE Release)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
# define includes path
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# define libs path
#IF(WIN32)
# link_directories( ${CGoGN_ROOT_DIR}/lib/$(ConfigurationName) ${Boost_LIBRARY_DIRS} )
#ELSE(WIN32)
# link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
#ENDIF(WIN32)
#define exec to compile
QT4_WRAP_CPP( frame_manip_moc frame_manip.h )
add_executable( frame_manip frame_manip.cpp ${frame_manip_moc} )
target_link_libraries( frame_manip ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( texturesExample_moc texturesExample.h )
add_executable( texturesExample texturesExample.cpp ${texturesExample_moc} )
target_link_libraries( texturesExample ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(simpleMap3_moc simpleMap3.h)
add_executable( simpleMap3 simpleMap3.cpp ${simpleMap3_moc} )
target_link_libraries( simpleMap3 ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( simpleGMap2_moc simpleGMap2.h )
add_executable( simpleGMap2 simpleGMap2.cpp ${simpleGMap2_moc} )
target_link_libraries( simpleGMap2 ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( simpleGMap3_moc simpleGMap3.h )
add_executable( simpleGMap3 simpleGMap3.cpp ${simpleGMap3_moc} )
target_link_libraries( simpleGMap3 ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( extrusionView_moc extrusionView.h )
add_executable( extrusionView extrusionView.cpp ${extrusionView_moc} )
target_link_libraries( extrusionView ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( viewer_ui viewer.ui )
QT4_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} )
QT4_WRAP_UI( clipping_ui clipping.ui )
QT4_WRAP_CPP( clipping_moc clipping.h )
add_executable( clipping clipping.cpp ${clipping_ui} ${clipping_moc} )
target_link_libraries( clipping ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( volumeExplorer_ui volumeExplorer.ui )
QT4_WRAP_CPP( volumeExplorer_moc volumeExplorer.h )
add_executable( volumeExplorer volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc} )
target_link_libraries( volumeExplorer ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( mcmesh_ui mcmesh.ui )
QT4_WRAP_CPP( mcmesh_moc mcmesh.h )
add_executable( mcmesh mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
target_link_libraries( mcmesh ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( concave_rendering_moc concave_rendering.h )
add_executable( concave_rendering concave_rendering.cpp ${concave_rendering_moc} ${concave_rendering_ui} )
target_link_libraries( concave_rendering ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( viewerOBJ_moc viewerOBJ.h )
add_executable( viewerOBJ viewerOBJ.cpp ${viewerOBJ_moc} )
target_link_libraries( viewerOBJ ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
cmake_minimum_required(VERSION 2.8)
project(examplesD)
SET(CMAKE_BUILD_TYPE Debug)
# define includes path
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CGoGN_ROOT_DIR}/include
${CGoGN_EXT_INCLUDES}
)
# define libs path
link_directories(
${CGoGN_ROOT_DIR}/lib/Debug
${CGoGN_ROOT_DIR}/lib/Release
${Boost_LIBRARY_DIRS}
)
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/$(ConfigurationName)
${Boost_LIBRARY_DIRS})
ELSE(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Debug ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF(WIN32)
#define exec to compile
QT4_WRAP_CPP(frame_manip_moc ../frame_manip.h)
add_executable( frame_manipD ../frame_manip.cpp ${frame_manip_moc})
target_link_libraries( frame_manipD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(texturesExample_moc ../texturesExample.h)
add_executable( texturesExampleD ../texturesExample.cpp ${texturesExample_moc} )
target_link_libraries( texturesExampleD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(simpleMap3_moc ../simpleMap3.h)
add_executable( simpleMap3D ../simpleMap3.cpp ${simpleMap3_moc} )
target_link_libraries( simpleMap3D ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(simpleGMap2_moc ../simpleGMap2.h)
add_executable( simpleGMap2D ../simpleGMap2.cpp ${simpleGMap2_moc} )
target_link_libraries( simpleGMap2D ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(simpleGMap3_moc ../simpleGMap3.h)
add_executable( simpleGMap3D ../simpleGMap3.cpp ${simpleGMap3_moc} )
target_link_libraries( simpleGMap3D ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(extrusionView_moc ../extrusionView.h)
add_executable( extrusionViewD ../extrusionView.cpp ${extrusionView_moc})
target_link_libraries( extrusionViewD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( viewer_ui ../viewer.ui )
QT4_WRAP_CPP( viewer_moc ../viewer.h )
add_executable( viewerD ../viewer.cpp ${viewer_moc} ${viewer_ui})
target_link_libraries( viewerD ${CGoGN_LIBS_D} ${NUMERICAL_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( clipping_ui ../clipping.ui )
QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable( clippingD ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clippingD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( volumeExplorer_ui ../volumeExplorer.ui )
QT4_WRAP_CPP( volumeExplorer_moc ../volumeExplorer.h )
add_executable( volumeExplorerD ../volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc})
target_link_libraries( volumeExplorerD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
add_executable( mcmeshD ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
target_link_libraries( mcmeshD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( concave_rendering_moc ../concave_rendering.h )
add_executable( concave_renderingD ../concave_rendering.cpp ${concave_rendering_moc} ${concave_rendering_ui} )
target_link_libraries( concave_renderingD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( viewerOBJ_moc ../viewerOBJ.h )
add_executable( viewerOBJD ../viewerOBJ.cpp ${viewerOBJ_moc} )
target_link_libraries( viewerOBJD ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
cmake_minimum_required(VERSION 2.8)
project(examples)
SET(CMAKE_BUILD_TYPE Release)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
# define includes path
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CGoGN_ROOT_DIR}/include
${CGoGN_EXT_INCLUDES}
)
# define libs path
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/$(ConfigurationName) ${Boost_LIBRARY_DIRS} )
ELSE(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF(WIN32)
#define exec to compile
QT4_WRAP_CPP( frame_manip_moc ../frame_manip.h )
add_executable( frame_manip ../frame_manip.cpp ${frame_manip_moc} )
target_link_libraries( frame_manip ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( texturesExample_moc ../texturesExample.h )
add_executable( texturesExample ../texturesExample.cpp ${texturesExample_moc} )
target_link_libraries( texturesExample ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(simpleMap3_moc ../simpleMap3.h)
add_executable( simpleMap3 ../simpleMap3.cpp ${simpleMap3_moc} )
target_link_libraries( simpleMap3 ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( simpleGMap2_moc ../simpleGMap2.h )
add_executable( simpleGMap2 ../simpleGMap2.cpp ${simpleGMap2_moc} )
target_link_libraries( simpleGMap2 ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( simpleGMap3_moc ../simpleGMap3.h )
add_executable( simpleGMap3 ../simpleGMap3.cpp ${simpleGMap3_moc} )
target_link_libraries( simpleGMap3 ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( extrusionView_moc ../extrusionView.h )
add_executable( extrusionView ../extrusionView.cpp ${extrusionView_moc} )
target_link_libraries( extrusionView ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( viewer_ui ../viewer.ui )
QT4_WRAP_CPP( viewer_moc ../viewer.h )
add_executable( viewer ../viewer.cpp ${viewer_moc} ${viewer_ui} )
target_link_libraries( viewer ${CGoGN_LIBS_R} ${NUMERICAL_LIBS} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( clipping_ui ../clipping.ui )
QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable( clipping ../clipping.cpp ${clipping_ui} ${clipping_moc} )
target_link_libraries( clipping ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( volumeExplorer_ui ../volumeExplorer.ui )
QT4_WRAP_CPP( volumeExplorer_moc ../volumeExplorer.h )
add_executable( volumeExplorer ../volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc} )
target_link_libraries( volumeExplorer ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
add_executable( mcmesh ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
target_link_libraries( mcmesh ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( concave_rendering_moc ../concave_rendering.h )
add_executable( concave_rendering ../concave_rendering.cpp ${concave_rendering_moc} ${concave_rendering_ui} )
target_link_libraries( concave_rendering ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( viewerOBJ_moc ../viewerOBJ.h )
add_executable( viewerOBJ ../viewerOBJ.cpp ${viewerOBJ_moc} )
target_link_libraries( viewerOBJ ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
......@@ -3,53 +3,58 @@ cmake_minimum_required(VERSION 2.8)
project(SandBox)
SET (CMAKE_BUILD_TYPE Debug)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
#SET (CMAKE_BUILD_TYPE Debug)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CGoGN_ROOT_DIR}/include
${CGoGN_EXT_INCLUDES}
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# ${CGoGN_ROOT_DIR}/include
# ${CGoGN_EXT_INCLUDES})
# define libs path
IF(WIN32)
link_directories(${CGoGN_ROOT_DIR}/lib/$(ConfigurationName)
${Boost_LIBRARY_DIRS})
ELSE(WIN32)
link_directories(${CGoGN_ROOT_DIR}/lib/Release ${CGoGN_ROOT_DIR}/lib/Debug)
ENDIF(WIN32)
#IF(WIN32)
# link_directories(${CGoGN_ROOT_DIR}/lib/$(ConfigurationName)
# ${Boost_LIBRARY_DIRS})
#ELSE(WIN32)
# link_directories(${CGoGN_ROOT_DIR}/lib/Release ${CGoGN_ROOT_DIR}/lib/Debug)
#ENDIF(WIN32)
#define exec to compile
add_executable(multi_att multi_att.cpp)
target_link_libraries(multi_att ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
target_link_libraries(multi_att ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
QT4_WRAP_CPP(tilings_moc tilings.h)
add_executable(tilings tilings.cpp ${tilings_moc})
target_link_libraries(tilings ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
IF (WITH_QT)
QT4_WRAP_CPP(tilings_moc tilings.h)
add_executable(tilings tilings.cpp ${tilings_moc})
target_link_libraries(tilings ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
QT4_WRAP_UI( test_traversor2_ui test_traversor2.ui )
QT4_WRAP_CPP(test_traversor2_moc test_traversor2.h)
add_executable(test_traversor2 test_traversor2.cpp ${test_traversor2_ui} ${test_traversor2_moc})
target_link_libraries(test_traversor2 ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
QT4_WRAP_UI( test_traversor2_ui test_traversor2.ui )
QT4_WRAP_CPP(test_traversor2_moc test_traversor2.h)
add_executable(test_traversor2 test_traversor2.cpp ${test_traversor2_ui} ${test_traversor2_moc})
target_link_libraries(test_traversor2 ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
QT4_WRAP_UI( testPlaneCutting_ui testPlaneCutting.ui )
QT4_WRAP_CPP(testPlaneCutting_moc testPlaneCutting.h)
add_executable(testPlaneCutting testPlaneCutting.cpp ${testPlaneCutting_ui} ${testPlaneCutting_moc})
target_link_libraries(testPlaneCutting ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
QT4_WRAP_UI( testPlaneCutting_ui testPlaneCutting.ui )
QT4_WRAP_CPP(testPlaneCutting_moc testPlaneCutting.h)
add_executable(testPlaneCutting testPlaneCutting.cpp ${testPlaneCutting_ui} ${testPlaneCutting_moc})
target_link_libraries(testPlaneCutting ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
QT4_WRAP_CPP(wallPaper_moc wallPaper.h)
add_executable(wallPaper wallPaper.cpp ${wallPaper_moc})
target_link_libraries(wallPaper ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
ENDIF()
# Example with Qt
#
#QT4_WRAP_CPP(tuto1_moc tuto1.h)
#add_executable( tuto1 tuto1.cpp ${tuto1_moc})
#target_link_libraries( tuto1 ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#target_link_libraries( tuto1 ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_CPP(tuto_mt_moc tuto_mt.h)
#add_executable( tuto_mt tuto_mt.cpp ${tuto_mt_moc})
#target_link_libraries( tuto_mt
# ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} ${Boost_THREAD_LIBRARY})
# ${CGoGN_LIBS} ${CGoGN_EXT_LIBS} ${Boost_THREAD_LIBRARY})
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "wallPaper.h"
#include "Algo/Tiling/Surface/square.h"
using namespace CGoGN ;
void MyQT::cb_initGL()
{
position = myMap.addAttribute<PFP::VEC3, VERTEX, MAP>("position");
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,50,50);
c.embedIntoCylinder(position,0.5,0.7,1.0);
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
setParamObject(lWidthObj,lPosObj.data());
Utils::GLSLShader::setCurrentOGLVersion(2);
// create the render
m_render = new Algo::Render::GL2::MapRender();
// create VBO for position
m_positionVBO = new Utils::VBO();
m_positionVBO->updateData(position);
m_shader = new Utils::ShaderSimpleColor();
m_shader->setAttributePosition(m_positionVBO);
m_shader->setColor(Geom::Vec4f(1.0,0.0,0.0,0.));
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES);
registerShader(m_shader);
// FOR WALL PAPER
m_textureWP = new Utils::Texture<2,Geom::Vec3uc>(GL_UNSIGNED_BYTE);
if (!m_textureWP->load("../SCHNApps/resources/cgogn/cgogn2.png"))
computeTexture();
m_textureWP->update();
m_textureWP->setWrapping(GL_CLAMP_TO_EDGE);
m_shaderWP = new Utils::ShaderWallPaper();
m_shaderWP->setTextureUnit(GL_TEXTURE0);
m_shaderWP->setTexture(m_textureWP);
registerShader(m_shaderWP);
glEnable(GL_TEXTURE_2D);
}
void MyQT::cb_redraw()
{
// FOR WALL PAPER
m_render->draw(m_shader, Algo::Render::GL2::LINES);
m_shaderWP->draw();
}
void MyQT::cb_keyPress(int keycode)
{
switch(keycode)
{
case 'l' :
if (m_textureWP->load("../SCHNApps/resources/cgogn/cgogn2.png"))
m_textureWP->update();
m_textureWP->setWrapping(GL_CLAMP_TO_EDGE);
break;
case 'c' :
computeTexture();
m_textureWP->update();
m_textureWP->setWrapping(GL_CLAMP_TO_EDGE);
break;
}
updateGL();
}
void MyQT::computeTexture()
{
std::vector<Geom::Vec3f> colorTable;
colorTable.push_back(Geom::Vec3uc(255,0,0));
colorTable.push_back(Geom::Vec3uc(0,255,0));
colorTable.push_back(Geom::Vec3uc(0,0,255));
colorTable.push_back(Geom::Vec3uc(255,255,0));
colorTable.push_back(Geom::Vec3uc(255,0,255));
colorTable.push_back(Geom::Vec3uc(0,255,255));
colorTable.push_back(Geom::Vec3uc(255,255,255));
m_textureWP->create(Geom::Vec2ui(16,16));
#define WIDTHCHECKER 2
for (unsigned int ki = 0; ki < m_textureWP->size()[0]; ++ki)
{
for (unsigned int kj = 0; kj < m_textureWP->size()[1]; ++kj)
{
unsigned int kc = ((kj/WIDTHCHECKER)*m_textureWP->size()[0] + (ki/WIDTHCHECKER))%7;
(*m_textureWP)(ki,kj) =colorTable[kc];
}
}
#undef WIDTHCHECKER
}
int main(int argc, char **argv)
{
// interface:
QApplication app(argc, argv);
MyQT sqt;