Commit c6fc84c7 authored by Simon Boyé's avatar Simon Boyé

Vitelotte: Various fix for Windows (VS) compatibility.

parent 2f94e3d0
project(Patate)
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.12.1)
# guard against in-source builds (source: Eigen)
......@@ -33,27 +33,31 @@ add_subdirectory(Patate/Vitelotte EXCLUDE_FROM_ALL)
# TODO: find a more appropriate place for this. #
################################################################################
set(vitelotte_SHADERS
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/vert_common.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/geom_common.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_common.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_linear.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_quadratic.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_wireframe.glsl
)
add_custom_command(
OUTPUT ${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders.hpp
COMMAND python3 ${Patate_SOURCE_DIR}/bin/shader2cpp
-l
-n Vitelotte::VGMeshRendererShaders
-g _VITELOTTE_UTILS_VG_MESH_RENDERER_SHADERS_
-o ${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders.hpp
${vitelotte_SHADERS}
DEPENDS ${vitelotte_SHADERS}
WORKING_DIRECTORY ${Patate_SOURCE_DIR}
VERBATIM
)
find_package(PythonInterp 3.0)
if(PYTHONINTERP_FOUND)
set(vitelotte_SHADERS
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/vert_common.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/geom_common.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_common.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_linear.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_quadratic.glsl
${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders/frag_wireframe.glsl
)
add_custom_command(
OUTPUT ${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders.hpp
COMMAND ${PYTHON_EXECUTABLE} ${Patate_SOURCE_DIR}/bin/shader2cpp
-l
-n Vitelotte::VGMeshRendererShaders
-g _VITELOTTE_UTILS_VG_MESH_RENDERER_SHADERS_
-o ${Patate_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders.hpp
${vitelotte_SHADERS}
DEPENDS ${vitelotte_SHADERS} ${PROJECT_SOURCE_DIR}/bin/shader2cpp
WORKING_DIRECTORY ${Patate_SOURCE_DIR}
VERBATIM
)
endif()
add_custom_target(vitelottes_vg_mesh_renderer_shaders
DEPENDS ${PROJECT_SOURCE_DIR}/Patate/Vitelotte/Utils/vgMeshRendererShaders.hpp)
......
......@@ -4,6 +4,8 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <cctype>
#include "objReader.h"
......
......@@ -31,6 +31,8 @@ options = argparser.parse_args()
namespaces = options.namespace.split('::')
out = open(options.output, 'w') if options.output != '-' else stdout
if options.extern and options.output:
hdr_out = open(options.output.replace(".cpp", ".h"), 'w')
if options.license:
print(license_text, file=out)
......@@ -58,7 +60,7 @@ for shader_file in options.shaders:
with open(shader_file) as shader:
var_name = sub(r'\W', '_', basename(shader_file), flags=ASCII)
if options.extern:
print('extern const char* {};'.format(var_name), file=out)
print('extern const char* {};'.format(var_name), file=hdr_out)
print('const char* {} ='.format(var_name), file=out)
else:
print('static const char* {} ='.format(var_name), file=out)
......
project(VitelotteExamples)
cmake_minimum_required(VERSION 2.8)
add_custom_target(vitelotte_examples)
add_subdirectory(common)
......
......@@ -2,39 +2,53 @@
# Vitelotte Examples common #
########################################################################
project(VitelotteExamplesCommon)
set(vitelotte_examples_SHADERS
shaders/vert_points.glsl
shaders/geom_points.glsl
shaders/frag_points.glsl
shaders/vert_lines.glsl
shaders/geom_lines.glsl
shaders/frag_lines.glsl
)
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/shaders.cpp
COMMAND python3 ${PROJECT_SOURCE_DIR}/../../../bin/shader2cpp -o ${PROJECT_SOURCE_DIR}/shaders.cpp -e -l ${vitelotte_examples_SHADERS}
DEPENDS ${vitelotte_examples_SHADERS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
VERBATIM
)
set(vitelotte_examples_common_SRCS
glLineRenderer.cpp
glPointRenderer.cpp
orthographicCamera.cpp
shaders.cpp
textFormatter.cpp
trackball.cpp
vgNodeRenderer.cpp
)
add_library(vitelotte_examples_common
${vitelotte_examples_common_SRCS}
)
add_dependencies(vitelotte_examples vitelotte_examples_common)
add_dependencies(vitelotte_examples_common vitelottes_vg_mesh_renderer_shaders)
find_package(GLEW)
set(mvg_editor_MISSING "")
if(NOT GLEW_FOUND)
set(mvg_examples_common_MISSING "${mvg_examples_common_MISSING} GLEW")
endif()
if(NOT mvg_examples_common_MISSING)
find_package(PythonInterp 3.0)
if(PYTHONINTERP_FOUND)
set(vitelotte_examples_SHADERS
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders/vert_points.glsl
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders/geom_points.glsl
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders/frag_points.glsl
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders/vert_lines.glsl
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders/geom_lines.glsl
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders/frag_lines.glsl
)
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders.cpp
${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders.h
COMMAND ${PYTHON_EXECUTABLE} ${Patate_SOURCE_DIR}/bin/shader2cpp -o ${PROJECT_SOURCE_DIR}/Vitelotte/common/shaders.cpp -e -l ${vitelotte_examples_SHADERS}
DEPENDS ${vitelotte_examples_SHADERS} ${Patate_SOURCE_DIR}/bin/shader2cpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
VERBATIM
)
endif()
include_directories(
${GLEW_INCLUDE_DIRS}
)
set(vitelotte_examples_common_SRCS
glLineRenderer.cpp
glPointRenderer.cpp
orthographicCamera.cpp
shaders.cpp
textFormatter.cpp
trackball.cpp
vgNodeRenderer.cpp
)
add_library(vitelotte_examples_common
${vitelotte_examples_common_SRCS}
)
add_dependencies(vitelotte_examples vitelotte_examples_common)
add_dependencies(vitelotte_examples_common vitelottes_vg_mesh_renderer_shaders)
endif()
......@@ -6,12 +6,9 @@
#include <GL/glew.h>
#include "glLineRenderer.h"
#include "shaders.h"
extern const char* vert_lines_glsl;
extern const char* geom_lines_glsl;
extern const char* frag_lines_glsl;
#include "glLineRenderer.h"
GLLineRenderer::GLLineRenderer()
......
......@@ -6,12 +6,9 @@
#include <GL/glew.h>
#include "glPointRenderer.h"
#include "shaders.h"
extern char* vert_points_glsl;
extern char* geom_points_glsl;
extern char* frag_points_glsl;
#include "glPointRenderer.h"
GLPointRenderer::GLPointRenderer()
......
......@@ -7,7 +7,6 @@
extern const char* vert_points_glsl;
const char* vert_points_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
......@@ -34,7 +33,6 @@ const char* vert_points_glsl =
"}\n"
"";
extern const char* geom_points_glsl;
const char* geom_points_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
......@@ -92,7 +90,6 @@ const char* geom_points_glsl =
"}\n"
"";
extern const char* frag_points_glsl;
const char* frag_points_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
......@@ -119,7 +116,6 @@ const char* frag_points_glsl =
"}\n"
"";
extern const char* vert_lines_glsl;
const char* vert_lines_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
......@@ -146,7 +142,6 @@ const char* vert_lines_glsl =
"}\n"
"";
extern const char* geom_lines_glsl;
const char* geom_lines_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
......@@ -210,7 +205,6 @@ const char* geom_lines_glsl =
"}\n"
"";
extern const char* frag_lines_glsl;
const char* frag_lines_glsl =
"/*\n"
" This Source Code Form is subject to the terms of the Mozilla Public\n"
......
extern const char* vert_points_glsl;
extern const char* geom_points_glsl;
extern const char* frag_points_glsl;
extern const char* vert_lines_glsl;
extern const char* geom_lines_glsl;
extern const char* frag_lines_glsl;
......@@ -6,6 +6,7 @@
#include <cassert>
#include <cctype>
#include "textFormatter.h"
......
......@@ -2,12 +2,6 @@
# Vitelotte Editor #
########################################################################
project(MvgEditor)
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake)
find_package(OpenGL)
find_package(GLEW)
find_package(Qt5Widgets)
......
......@@ -778,7 +778,7 @@ float Editor::closestPos(Mesh::Curve curve, const Vector& p,
}
void Editor::drawCurve(Mesh::Curve curve, float width, const Eigen::Vector4f color)
void Editor::drawCurve(Mesh::Curve curve, float width, const Eigen::Vector4f& color)
{
Mesh& mesh = m_document->mesh();
......
......@@ -158,7 +158,7 @@ protected:
float closestPos(Mesh::Curve curve, const Vector& p,
unsigned* which=0, float* sqrDist=0);
void drawCurve(Mesh::Curve curve, float width, const Eigen::Vector4f color);
void drawCurve(Mesh::Curve curve, float width, const Eigen::Vector4f& color);
void drawGradientStops(float innerRadius, float outerRadius);
protected:
......
......@@ -2,21 +2,16 @@
# Vitelotte GL Viewer #
###############################################################################
project(MvgViewer)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake)
find_package(X11)
#find_package(X11)
find_package(OpenGL)
find_package(GLEW)
find_package(GLFW3)
set(mvg_viewer_MISSING "")
if(NOT X11_FOUND)
set(mvg_viewer_MISSING "${mvg_viewer_MISSING} X11")
endif()
#if(NOT X11_FOUND)
# set(mvg_viewer_MISSING "${mvg_viewer_MISSING} X11")
#endif()
if(NOT OPENGL_FOUND)
set(mvg_viewer_MISSING "${mvg_viewer_MISSING} OpenGL")
endif()
......
......@@ -2,12 +2,6 @@
# Vitelotte mvgtk #
###############################################################################
project(VitelotteMvgTk)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake)
include_directories(
${EIGEN3_INCLUDE_DIR}
"../../.."
......
......@@ -2,12 +2,6 @@
# Vitelotte mvgtk #
###############################################################################
project(VitelotteTutorial)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake)
find_package(Eigen3 REQUIRED)
include_directories(
......
......@@ -7,6 +7,7 @@
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <ctime>
// Include the obj reader
#include <Patate/common/surface_mesh/objReader.h>
......
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