Forráskód Böngészése

Merge branch 'alecjacobson' of https://github.com/libigl/libigl into alecjacobson

Former-commit-id: c6d246ba1e853151c03217d128c2532999d38cae
Alec Jacobson 8 éve
szülő
commit
d4e377a085

+ 0 - 42
include/igl/opengl/compile_and_link_program.cpp

@@ -1,42 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#include "compile_and_link_program.h"
-#include "compile_shader.h"
-#include "report_gl_error.h"
-#include <iostream>
-#include <cassert>
-
-
-IGL_INLINE GLuint igl::opengl::compile_and_link_program(
-  const char * v_str, const char * f_str)
-{
-  GLuint vid = compile_shader(GL_VERTEX_SHADER,v_str);
-  GLuint fid = compile_shader(GL_FRAGMENT_SHADER,f_str);
-
-  GLuint prog_id = glCreateProgram();
-  assert(prog_id != 0 && "Failed to create shader.");
-  glAttachShader(prog_id,vid);
-  report_gl_error("glAttachShader (vid): ");
-  glAttachShader(prog_id,fid);
-  report_gl_error("glAttachShader (fid): ");
-
-  glLinkProgram(prog_id);
-  report_gl_error("glLinkProgram: ");
-
-  GLint status;
-  glGetProgramiv(prog_id, GL_LINK_STATUS, &status);
-  if (status != GL_TRUE)
-  {
-    char buffer[512];
-    glGetProgramInfoLog(prog_id, 512, NULL, buffer);
-    std::cerr << "Linker error: " << std::endl << buffer << std::endl;
-    prog_id = 0;
-  }
-  return prog_id;
-}
-

+ 0 - 32
include/igl/opengl/compile_and_link_program.h

@@ -1,32 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_OPENGL_COMPILE_AND_LINK_PROGRAM_H
-#define IGL_OPENGL_COMPILE_AND_LINK_PROGRAM_H
-#include "../igl_inline.h"
-#include "gl.h"
-namespace igl
-{
-  namespace opengl
-  {
-    // Compile and link very simple vertex/fragment shaders
-    //
-    // Inputs:
-    //   v_str  string of vertex shader contents
-    //   f_str  string of fragment shader contents
-    // Returns id of program
-    //
-    // Known bugs: this seems to duplicate `create_shader_program` with less
-    // functionality.
-    IGL_INLINE GLuint compile_and_link_program(
-      const char * v_str, const char * f_str);
-  }
-}
-#ifndef IGL_STATIC_LIBRARY
-#  include "compile_and_link_program.cpp"
-#endif
-#endif

+ 0 - 36
include/igl/opengl/compile_shader.cpp

@@ -1,36 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#include "compile_shader.h"
-#include "report_gl_error.h"
-#include <iostream>
-
-IGL_INLINE GLuint igl::opengl::compile_shader(
-  const GLint type, const char * str)
-{
-  GLuint id = glCreateShader(type);
-  report_gl_error("glCreateShader: ");
-  glShaderSource(id,1,&str,NULL);
-  report_gl_error("glShaderSource: ");
-  glCompileShader(id);
-  report_gl_error("glCompileShader: ");
-
-  GLint status;
-  glGetShaderiv(id, GL_COMPILE_STATUS, &status);
-  if (status != GL_TRUE)
-  {
-    char buffer[512];
-    if (type == GL_VERTEX_SHADER)
-      std::cerr << "Vertex shader:" << std::endl;
-    else if (type == GL_FRAGMENT_SHADER)
-      std::cerr << "Fragment shader:" << std::endl;
-    std::cerr << str << std::endl << std::endl;
-    glGetShaderInfoLog(id, 512, NULL, buffer);
-    std::cerr << "Error: " << std::endl << buffer << std::endl;
-  }
-  return id;
-}

+ 0 - 38
include/igl/opengl/compile_shader.h

@@ -1,38 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_OPENGL_COMPILE_SHADER_H
-#define IGL_OPENGL_COMPILE_SHADER_H
-#include "../igl_inline.h"
-#include "gl.h"
-namespace igl
-{
-  namespace opengl
-  {
-    // Compile a shader given type and string of shader code
-    //
-    // Inputs:
-    //   type  either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER
-    //   str  contents of shader code
-    // Returns result of glCreateShader (id of shader)
-    //
-    // Example:
-    //     GLuint vid = compile_shader(GL_VERTEX_SHADER,vertex_shader.c_str());
-    //     GLuint fid = compile_shader(GL_FRAGMENT_SHADER,fragment_shader.c_str());
-    //     GLuint prog_id = glCreateProgram();
-    //     glAttachShader(prog_id,vid);
-    //     glAttachShader(prog_id,fid);
-    //     glLinkProgram(prog_id);
-    //
-    // Known bugs: seems to be duplicate of `load_shader`
-    IGL_INLINE GLuint compile_shader(const GLint type, const char * str);
-  }
-}
-#ifndef IGL_STATIC_LIBRARY
-#  include "compile_shader.cpp"
-#endif
-#endif

+ 6 - 0
scripts/make.sh

@@ -55,6 +55,7 @@ else
   PROJECTS=`echo "$@" | tr ' ' '\n'`
   PROJECTS=`echo "$@" | tr ' ' '\n'`
 fi
 fi
 
 
+ret=0
 for PROJECT in $PROJECTS
 for PROJECT in $PROJECTS
 do
 do
 
 
@@ -100,5 +101,10 @@ do
     done
     done
     #echo -e "\033[0;35mHanding off to make $TARGET\033[0m"
     #echo -e "\033[0;35mHanding off to make $TARGET\033[0m"
     make -j$NUM_THREADS -f "${TARGET_DIR}/build.make" "${TARGET_DIR}/build" 
     make -j$NUM_THREADS -f "${TARGET_DIR}/build.make" "${TARGET_DIR}/build" 
+    make_ret="$?"
+    if [ $make_ret -ne 0 ] ; then
+      ret="$make_ret"
+    fi
   done
   done
 done
 done
+exit $ret

+ 7 - 7
style-guidelines.md

@@ -177,7 +177,7 @@ Eigen::SparseMatrix<Atype> adjacency_matrix(const ... & F);
 ## Templating with Eigen
 ## Templating with Eigen
 
 
 Functions taking Eigen dense matrices/arrays as inputs and outputs (but **not**
 Functions taking Eigen dense matrices/arrays as inputs and outputs (but **not**
-return arguments), should template on top of `Eigen::PlainObjectBase`. **Each
+return arguments), should template on top of `Eigen::MatrixBase`. **Each
 parameter** should be derived using its own template.
 parameter** should be derived using its own template.
 
 
 For example,
 For example,
@@ -185,9 +185,9 @@ For example,
 ```cpp
 ```cpp
 template <typename DerivedV, typename DerivedF, typename DerivedBC>
 template <typename DerivedV, typename DerivedF, typename DerivedBC>
 void barycenter(
 void barycenter(
-  const Eigen::PlainObjectBase<DerivedV> & V,
-  const Eigen::PlainObjectBase<DerivedF> & F,
-  const Eigen::PlainObjectBase<DerivedBC> & BC);
+  const Eigen::MatrixBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedF> & F,
+  const Eigen::MatrixBase<DerivedBC> & BC);
 ```
 ```
 
 
 The `Derived*` template encodes the scalar type (e.g. `double`, `int`), the
 The `Derived*` template encodes the scalar type (e.g. `double`, `int`), the
@@ -214,7 +214,7 @@ In `igl/fit_in_unit_cube.h`:
 ```cpp
 ```cpp
 template <typename DerivedV, typename DerivedW>
 template <typename DerivedV, typename DerivedW>
 void fit_to_unit_cube(
 void fit_to_unit_cube(
-  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedV> & V,
   Eigen::PlainObjectBase<DerivedW> & W);
   Eigen::PlainObjectBase<DerivedW> & W);
 template <typename DerivedV>
 template <typename DerivedV>
 void DerivedV fit_to_unit_cube(const Eigen::PlainObjectBase<DerivedV> & V);
 void DerivedV fit_to_unit_cube(const Eigen::PlainObjectBase<DerivedV> & V);
@@ -225,7 +225,7 @@ In `igl/fit_in_unit_cube.cpp`:
 ```
 ```
 template <typename DerivedV, typename DerivedW>
 template <typename DerivedV, typename DerivedW>
 void fit_to_unit_cube(
 void fit_to_unit_cube(
-  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::MatrixBase<DerivedV> & V,
   Eigen::PlainObjectBase<DerivedW> & W)
   Eigen::PlainObjectBase<DerivedW> & W)
 {
 {
   W = (V.rowwise()-V.colwise().minCoeff()).array() /
   W = (V.rowwise()-V.colwise().minCoeff()).array() /
@@ -233,7 +233,7 @@ void fit_to_unit_cube(
 }
 }
 
 
 template <typename DerivedV>
 template <typename DerivedV>
-void DerivedV fit_to_unit_cube(const Eigen::PlainObjectBase<DerivedV> & V)
+void DerivedV fit_to_unit_cube(const Eigen::MatrixBase<DerivedV> & V)
 {
 {
   DerivedV W;
   DerivedV W;
   fit_to_unit_cube(V,W);
   fit_to_unit_cube(V,W);