diff options
author | Marius Kintel <marius@kintel.net> | 2013-08-20 03:26:05 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-08-20 03:26:05 (GMT) |
commit | 154c65dee2ccb77c9e7fc576c36067a24632fa30 (patch) | |
tree | 1f61d1f944152df00800017223845a4cb9a1d899 /src | |
parent | fe7fb45019affbf683930d6368fe38524bdd2649 (diff) | |
parent | 61e6178d1b71d78832aab4fbe7bd2d3550626b87 (diff) |
Merge branch 'master' of git://github.com/ivoknutsel/openscad into ivoknutsel-master
Diffstat (limited to 'src')
-rw-r--r-- | src/GLView.cc | 1 | ||||
-rw-r--r-- | src/OpenCSGRenderer.cc | 2 | ||||
-rw-r--r-- | src/control.cc | 1 | ||||
-rw-r--r-- | src/import.cc | 4 | ||||
-rw-r--r-- | src/lexer.l | 2 | ||||
-rw-r--r-- | src/mathc99.cc | 6 | ||||
-rw-r--r-- | src/mathc99.h | 1 |
7 files changed, 13 insertions, 4 deletions
diff --git a/src/GLView.cc b/src/GLView.cc index b4fb8d6..822a246 100644 --- a/src/GLView.cc +++ b/src/GLView.cc @@ -2,6 +2,7 @@ #include "stdio.h" #include "rendersettings.h" +#include "mathc99.h" #ifdef _WIN32 #include <GL/wglew.h> diff --git a/src/OpenCSGRenderer.cc b/src/OpenCSGRenderer.cc index b4acf82..e65a259 100644 --- a/src/OpenCSGRenderer.cc +++ b/src/OpenCSGRenderer.cc @@ -77,8 +77,8 @@ void OpenCSGRenderer::renderCSGChain(CSGChain *chain, GLint *shaderinfo, std::vector<OpenCSG::Primitive*> primitives; size_t j = 0; for (size_t i = 0;; i++) { - const CSGChainObject &i_obj = chain->objects[i]; bool last = i == chain->objects.size(); + const CSGChainObject &i_obj = last ? chain->objects[i-1] : chain->objects[i]; if (last || i_obj.type == CSGTerm::TYPE_UNION) { if (j+1 != i) { OpenCSG::render(primitives); diff --git a/src/control.cc b/src/control.cc index c5ad09b..50e5eae 100644 --- a/src/control.cc +++ b/src/control.cc @@ -31,6 +31,7 @@ #include "builtin.h" #include "printutils.h" #include <sstream> +#include "mathc99.h" enum control_type_e { CHILD, diff --git a/src/import.cc b/src/import.cc index b5d67d2..3897331 100644 --- a/src/import.cc +++ b/src/import.cc @@ -212,7 +212,9 @@ PolySet *ImportNode::evaluate_polyset(class PolySetEvaluator *) const #ifdef BOOST_BIG_ENDIAN uint32_byte_swap( facenum ); #endif - if (file_size == 80 + 4 + 50*facenum) binary = true; + if (file_size == static_cast<std::streamoff>(80 + 4 + 50*facenum)) { + binary = true; + } } f.seekg(0); diff --git a/src/lexer.l b/src/lexer.l index 3dd3b6b..e08c6c7 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -30,7 +30,7 @@ #include "handle_dep.h" #include "printutils.h" #include "parsersettings.h" -#include "parser_yacc.h" +#include "parser_yacc.hpp" #include "module.h" #include <assert.h> #include <boost/foreach.hpp> diff --git a/src/mathc99.cc b/src/mathc99.cc index 335446e..13f4c64 100644 --- a/src/mathc99.cc +++ b/src/mathc99.cc @@ -3,8 +3,12 @@ #ifdef WIN32
#include <algorithm>
+double trunc(double a) {
+ return (a >= 0) ? floor(a) : ceil(a);
+}
+
double round(double a) {
- return a > 0 ? floor(a+0.5) : ceil(a-0.5);
+ return a < 0 ? ceil(a - 0.5f) : floor(a + 0.5f);
}
float fmin(float a, float b) {
diff --git a/src/mathc99.h b/src/mathc99.h index ebc2d66..ae31a22 100644 --- a/src/mathc99.h +++ b/src/mathc99.h @@ -5,6 +5,7 @@ #include <cmath>
//for native win32 builds we need to provide C99 math functions by ourselves
+double trunc(double a);
double round(double a);
float fmin(float a, float b);
float fmax(float a, float b);
|