From 9d6ca56d5ac15634958f773e991d41a977f909bf Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 17 Dec 2017 09:23:05 +0000 Subject: Making simplegame and travis --- .dir-locals.el | 41 +++-------------------------------------- .travis.yml | 9 +++------ tests/simplegame.cpp | 3 +-- yage/core/glslprogram.cpp | 4 ++++ yage/core/glslprogram.h | 22 ++++++++++++---------- yage/math/matrix.h | 2 +- 6 files changed, 24 insertions(+), 57 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index ef9a1a46..db723df8 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,38 +1,3 @@ -((nil . ((eval . (progn - (require 'projectile) - (setq company-clang-arguments (delete-dups (append - company-clang-arguments - (list (concat "-I" (projectile-project-root) "yage"))))) - (setq company-clang-arguments (delete-dups (append - company-clang-arguments - (list (concat "-I" (projectile-project-root)))))) - (setq company-clang-arguments (delete-dups (append - company-clang-arguments - (list (concat "-I" (projectile-project-root) "lib/googletest/googletest/include"))))) - (setq company-clang-arguments (delete-dups (append - company-clang-arguments - (list (concat "-I" (projectile-project-root) "lib/rapidjson/include"))))) - (setq company-clang-arguments (delete-dups (append - company-clang-arguments - (list (concat "-I" (projectile-project-root) "lib/glfw/include"))))) - (setq company-clang-arguments (delete-dups (append - company-clang-arguments - (list (concat "-I" (projectile-project-root) "lib/glad/include"))))) - (setq flycheck-clang-include-path (delete-dups (append - flycheck-clang-include-path - (list (concat (projectile-project-root) "yage"))))) - (setq flycheck-clang-include-path (delete-dups (append - flycheck-clang-include-path - (list (concat (projectile-project-root)))))) - (setq flycheck-clang-include-path (delete-dups (append - flycheck-clang-include-path - (list (concat (projectile-project-root) "lib/googletest/googletest/include"))))) - (setq flycheck-clang-include-path (delete-dups (append - flycheck-clang-include-path - (list (concat (projectile-project-root) "lib/glfw/include"))))) - (setq flycheck-clang-include-path (delete-dups (append - flycheck-clang-include-path - (list (concat (projectile-project-root) "lib/glad/include"))))) - (setq flycheck-clang-include-path (delete-dups (append - flycheck-clang-include-path - (list (concat (projectile-project-root) "lib/rapidjson/include")))))))))) +((nil . ((projectile-project-compilation-cmd . "mkdir -p build && cd build && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DUNIT_TESTS=ON .. && make -j9") + (projectile-project-test-cmd . "cd build && ctest") + (projectile-project-run-cmd . "./bin/simplegame")))) diff --git a/.travis.yml b/.travis.yml index 2a142f41..264768ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,7 @@ addons: apt: packages: - - g++-6 - gcc-6 - - g++-7 - gcc-7 - libegl1-mesa-dev - libgles2-mesa-dev @@ -21,7 +19,7 @@ branches: dist: trusty env: global: - secure: NGWn7hJAd/iYfJQmr8oDjTlwttldj8zB+X0gk2TqDhAJ2gLiZ2+b8Bp5FSzBlNIyhcbuhzRU+rzkbo03XSwXZXFRZK/gyPMGaB75ay8MLQBrN3L7THXbjQm1SZg2mO17/MKT+rJH/NvhmqPoUoJaYnoki1G6AZfhnDx+3bW4MNp5/g3u8trk1HNvXWTvjdqS99OH36bvoq8BsOi53Po1veeCIWza6JO61n2nRHzCC2sYWtsZyTQSi3B//iie5zF3gvuRorbzjA/ayc8lLmhUsTmoA1t9HJP52fKzv/q3mxllXzyzpWNRmUJCzf7I1wY9jp1FVwojfl0umofzYPCCjwSrKlRtmwQfi0peg7VOJVCCJx7Eh/i0hamGUnDEu0aZnfhgwzkqDDIgO1AwcEv5i9egt/73kK4mdm22sEDa3dWVu37tnj5dItaQesMm6TXKMy9+r7v0aaVJbQB2atvBaf3RlW71P9iy8mOZ+geKNwVFRuBdu5g3oQe5QrqXRi4inMv0bjN8HwOVs/f8ZTGZePnbHnxOnYRErxLnha/bsu7btfDT8Q8nmZ/Rhcu7QkMRNTm5L3+YHFUngiIygOs8wrH6HECtSYwmi9WejRuPgU2GnYR0Rzyi5dyaFok1iN+jsYsY9YFx5tRgxuX4H9CnUlfDabdFSLzqbmKRlbP79as= + secure: NGWn7hJAd/iYfJQmr8oDjTlwttldj8zB+X0gk2TqDhAJ2gLiZ2+b8Bp5FSzBlNIyhcbuhzRU+rzkbo03XSwXZXFRZK/gyPMGaB75ay8MLQBrN3L7THXbjQm1SZg2mO17/MKT+rJH/NvhmqPoUoJaYnoki1G6AZfhnDx+3bW4MNp5/g3u8trk1HNvXWTvjdqS99OH36bvoq8BsOi53Po1veeCIWza6JO61n2nRHzCC2sYWtsZyTQSi3B//iie5zF3gvuRorbzjA/ayc8lLmhUsTmoA1t9HJP52fKzv/q3mxllXzyzpWNRmUJCzf7I1wY9jp1FVwojfl0umofzYPCCjwSrKlRtmwQfi0peg7VOJVCCJx7Eh/i0hamGUnDEu0aZnfhgwzkqDDIgO1AwcEv5i9egt/73kK4mdm22sEDa3dWVu37tnj5dItaQesMm6TXKMy9+r7v0aaVJbQB2atvBaf3RlW71P9iy8mOZ+geKNwVFRuBdu5g3oQe5QrqXRi4inMv0bjN8HwOVs/f8ZTGZ ePnbHnxOnYRErxLnha/bsu7btfDT8Q8nmZ/Rhcu7QkMRNTm5L3+YHFUngiIygOs8wrH6HECtSYwmi9WejRuPgU2GnYR0Rzyi5dyaFok1iN+jsYsY9YFx5tRgxuX4H9CnUlfDabdFSLzqbmKRlbP79as= git: depth: 1 language: cpp @@ -29,20 +27,19 @@ matrix: include: - compiler: g++-6 - env: UNIT_TESTS=1 os: linux - compiler: g++-7 - env: UNIT_TESTS=1 os: linux notifications: email: false script: - "g++-6 --version" + - "g++-7 --version" - "cd $TRAVIS_BUILD_DIR" - "mkdir -p build" - "cd build" - - "cmake .." + - "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DUNIT_TESTS=ON .." - make - ctest - "cd .. && ./scripts/update_docs" diff --git a/tests/simplegame.cpp b/tests/simplegame.cpp index 2968f4ba..99796f08 100644 --- a/tests/simplegame.cpp +++ b/tests/simplegame.cpp @@ -49,8 +49,7 @@ int main() GLint texture_location = program.getUniformLocation("texture_sampler"); glUniform1i(texture_location, 0); - sp.draw(std::vector({0, 0, 64, 64}), - std::vector({0, 0, 1, 1}), fountain.id, Colour(), 0); + sp.draw({0.f, 0.f, 64.f, 64.f}, {0, 0, 1, 1}, fountain.id, Colour(), 0); sp.render(); glBindTexture(GL_TEXTURE_2D, 0); diff --git a/yage/core/glslprogram.cpp b/yage/core/glslprogram.cpp index 542afc6f..4772d50e 100644 --- a/yage/core/glslprogram.cpp +++ b/yage/core/glslprogram.cpp @@ -159,4 +159,8 @@ void GlslProgram::unuse() glUseProgram(0); } +void GlslProgram::defaultSetup() +{ +} + } // namespace yage diff --git a/yage/core/glslprogram.h b/yage/core/glslprogram.h index d4bbe093..50b2a7de 100644 --- a/yage/core/glslprogram.h +++ b/yage/core/glslprogram.h @@ -18,16 +18,6 @@ namespace yage class GlslProgram { -private: - /// compiled shader program id - GLuint program_id_ = 0; - GLuint vertex_shader_id_ = 0; - GLuint fragment_shader_id_ = 0; - int attribute_index_ = 0; - - /// compiles one shader - void compileShader(const GLuint &shader, const std::string &file_path); - public: GlslProgram() = default; GlslProgram(const GlslProgram &) = delete; @@ -45,6 +35,18 @@ public: GLint getUniformLocation(const std::string &uniform_name); void use(); void unuse(); + + void defaultSetup(); + +private: + /// compiled shader program id + GLuint program_id_ = 0; + GLuint vertex_shader_id_ = 0; + GLuint fragment_shader_id_ = 0; + int attribute_index_ = 0; + + /// compiles one shader + void compileShader(const GLuint &shader, const std::string &file_path); }; } // namespace yage diff --git a/yage/math/matrix.h b/yage/math/matrix.h index e7e82651..90a763cf 100644 --- a/yage/math/matrix.h +++ b/yage/math/matrix.h @@ -388,7 +388,7 @@ public: Vector4(Type x_in, Type y_in, Type z_in, Type w_in) : Vector<4, Type>({x_in, y_in, z_in, w_in}), x(this->data_[0]), - y(this->data_[1]), z(this->data_[2]), w(this->data[3]) + y(this->data_[1]), z(this->data_[2]), w(this->data_[3]) { } }; -- cgit