From c12cd91f9baac2e1c8874558ce5b904aaec386fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 9 Dec 2015 00:32:29 +0100 Subject: [PATCH 1/3] Removed header inlining of Vector3 and Color methods This made cross-platform compiling and profiling more complicated --- src/basics/Color.cpp | 148 +++++++++++++++- src/basics/Color.inline.cpp | 158 ------------------ src/basics/InfiniteCylinder.cpp | 1 + src/basics/InfinitePlane.cpp | 1 + src/basics/SpaceSegment.cpp | 1 + src/basics/Sphere.cpp | 1 + src/basics/Vector3.cpp | 48 +++++- src/basics/Vector3.h | 7 - src/basics/Vector3.inline.cpp | 55 ------ src/definition/AtmosphereDefinition.cpp | 1 + .../software/CloudBasicLayerRenderer.cpp | 4 +- src/render/software/Rasterizer.cpp | 1 + src/render/software/SkyRasterizer.cpp | 1 + src/render/software/TerrainRasterizer.cpp | 1 + src/render/software/TerrainRayWalker.cpp | 1 + src/render/software/TexturesRenderer.cpp | 1 + src/render/software/WaterRasterizer.cpp | 1 + src/render/software/WaterRenderer.cpp | 1 + src/system/system_global.h | 1 - src/tests/CappedCylinder_Test.cpp | 1 + src/tests/GodRaysSampler_Test.cpp | 1 + 21 files changed, 210 insertions(+), 225 deletions(-) delete mode 100644 src/basics/Color.inline.cpp delete mode 100644 src/basics/Vector3.inline.cpp diff --git a/src/basics/Color.cpp b/src/basics/Color.cpp index 321275c..5225763 100644 --- a/src/basics/Color.cpp +++ b/src/basics/Color.cpp @@ -1,6 +1,7 @@ -#include "Color.inline.cpp" +#include "Color.h" #include +#include #include "PackStream.h" const Color paysages::basics::COLOR_TRANSPARENT = {0.0, 0.0, 0.0, 0.0}; @@ -11,6 +12,12 @@ const Color paysages::basics::COLOR_BLUE = {0.0, 0.0, 1.0, 1.0}; const Color paysages::basics::COLOR_WHITE = {1.0, 1.0, 1.0, 1.0}; const Color paysages::basics::COLOR_GREY = {0.5, 0.5, 0.5, 1.0}; +Color::Color(double r, double g, double b, double a) : r(r), g(g), b(b), a(a) { +} + +Color::Color(const Color &col) : r(col.r), g(col.g), b(col.b), a(col.a) { +} + void Color::save(PackStream *stream) const { stream->write(&r); stream->write(&g); @@ -24,3 +31,142 @@ void Color::load(PackStream *stream) { stream->read(&b); stream->read(&a); } + +unsigned int Color::to32BitRGBA() const { + return (((unsigned int)(a * 255.0)) << 24) | (((unsigned int)(b * 255.0)) << 16) | + (((unsigned int)(g * 255.0)) << 8) | ((unsigned int)(r * 255.0)); +} + +unsigned int Color::to32BitBGRA() const { + return (((unsigned int)(a * 255.0)) << 24) | (((unsigned int)(r * 255.0)) << 16) | + (((unsigned int)(g * 255.0)) << 8) | ((unsigned int)(b * 255.0)); +} + +unsigned int Color::to32BitARGB() const { + return (((unsigned int)(b * 255.0)) << 24) | (((unsigned int)(g * 255.0)) << 16) | + (((unsigned int)(r * 255.0)) << 8) | ((unsigned int)(a * 255.0)); +} + +unsigned int Color::to32BitABGR() const { + return (((unsigned int)(r * 255.0)) << 24) | (((unsigned int)(g * 255.0)) << 16) | + (((unsigned int)(b * 255.0)) << 8) | ((unsigned int)(a * 255.0)); +} + +Color Color::from32BitRGBA(unsigned int col) { + return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, + ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); +} + +Color Color::from32BitBGRA(unsigned int col) { + return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, + ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); +} + +Color Color::from32BitARGB(unsigned int col) { + return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, + ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); +} + +Color Color::from32BitABGR(unsigned int col) { + return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, + ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); +} + +void Color::mask(const Color &mask) { + double new_a; + new_a = a + mask.a - (a * mask.a); + r = (mask.r * mask.a + r * a - r * a * mask.a) / new_a; + g = (mask.g * mask.a + g * a - g * a * mask.a) / new_a; + b = (mask.b * mask.a + b * a - b * a * mask.a) / new_a; + a = new_a; + + /*double mask_weight = mask->a; + double base_weight = 1.0 - mask_weight; + + base->r = mask->r * mask_weight + base->r * base_weight; + base->g = mask->g * mask_weight + base->g * base_weight; + base->b = mask->b * mask_weight + base->b * base_weight; + base->a = base->a + mask_weight * (1.0 - base->a);*/ +} + +double Color::normalize() { +#ifndef NDEBUG + assert(r >= 0.0); + assert(g >= 0.0); + assert(b >= 0.0); + assert(a >= 0.0); +#ifdef isnan + assert(!isnan(r)); + assert(!isnan(g)); + assert(!isnan(b)); + assert(!isnan(a)); +#endif +#ifdef isfinite + assert(isfinite(r)); + assert(isfinite(g)); + assert(isfinite(b)); + assert(isfinite(a)); +#endif +#endif + + if (r > 1.0) { + r = 1.0; + } + if (g > 1.0) { + g = 1.0; + } + if (b > 1.0) { + b = 1.0; + } + return 1.0; + /*double max = colorGetValue(col); + + assert(max >= 0.0); + + if (max > 1.0) + { + col->r /= max; + col->g /= max; + col->b /= max; + } + return max;*/ +} + +double Color::getValue() const { + double max; + + max = r; + if (g > max) { + max = g; + } + if (b > max) { + max = b; + } + return max; +} + +double Color::getPower() const { + return r + g + b; +} + +void Color::limitPower(double max_power) { + double power = r + g + b; + + if (power > max_power) { + double factor = max_power / power; + + r *= factor; + g *= factor; + b *= factor; + } +} + +Color Color::add(const Color &other) const { + return Color(r + other.r, g + other.g, b + other.b, a); +} + +Color Color::lerp(const Color &other, double f) const { + Color result(r * (1.0 - f) + other.r * f, g * (1.0 - f) + other.g * f, b * (1.0 - f) + other.b * f, + a * (1.0 - f) + other.a * f); + return result; +} diff --git a/src/basics/Color.inline.cpp b/src/basics/Color.inline.cpp deleted file mode 100644 index 5e1cfcd..0000000 --- a/src/basics/Color.inline.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#define COLOR_INLINE_CPP - -#ifndef NDEBUG -#include -#include -#endif - -#ifdef COLOR_H -#define METHSPEC inline -#else -#include "Color.h" -#define METHSPEC -#endif - -METHSPEC Color::Color(double r, double g, double b, double a) : r(r), g(g), b(b), a(a) { -} - -METHSPEC Color::Color(const Color &col) : r(col.r), g(col.g), b(col.b), a(col.a) { -} - -METHSPEC unsigned int Color::to32BitRGBA() const { - return (((unsigned int)(a * 255.0)) << 24) | (((unsigned int)(b * 255.0)) << 16) | - (((unsigned int)(g * 255.0)) << 8) | ((unsigned int)(r * 255.0)); -} - -METHSPEC unsigned int Color::to32BitBGRA() const { - return (((unsigned int)(a * 255.0)) << 24) | (((unsigned int)(r * 255.0)) << 16) | - (((unsigned int)(g * 255.0)) << 8) | ((unsigned int)(b * 255.0)); -} - -METHSPEC unsigned int Color::to32BitARGB() const { - return (((unsigned int)(b * 255.0)) << 24) | (((unsigned int)(g * 255.0)) << 16) | - (((unsigned int)(r * 255.0)) << 8) | ((unsigned int)(a * 255.0)); -} - -METHSPEC unsigned int Color::to32BitABGR() const { - return (((unsigned int)(r * 255.0)) << 24) | (((unsigned int)(g * 255.0)) << 16) | - (((unsigned int)(b * 255.0)) << 8) | ((unsigned int)(a * 255.0)); -} - -METHSPEC Color Color::from32BitRGBA(unsigned int col) { - return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, - ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); -} - -METHSPEC Color Color::from32BitBGRA(unsigned int col) { - return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, - ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); -} - -METHSPEC Color Color::from32BitARGB(unsigned int col) { - return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, - ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); -} - -METHSPEC Color Color::from32BitABGR(unsigned int col) { - return Color(((double)(col & 0x000000FF)) / 255.0, ((double)((col & 0x0000FF00) >> 8)) / 255.0, - ((double)((col & 0x00FF0000) >> 16)) / 255.0, ((double)((col & 0xFF000000) >> 24)) / 255.0); -} - -METHSPEC void Color::mask(const Color &mask) { - double new_a; - new_a = a + mask.a - (a * mask.a); - r = (mask.r * mask.a + r * a - r * a * mask.a) / new_a; - g = (mask.g * mask.a + g * a - g * a * mask.a) / new_a; - b = (mask.b * mask.a + b * a - b * a * mask.a) / new_a; - a = new_a; - - /*double mask_weight = mask->a; - double base_weight = 1.0 - mask_weight; - - base->r = mask->r * mask_weight + base->r * base_weight; - base->g = mask->g * mask_weight + base->g * base_weight; - base->b = mask->b * mask_weight + base->b * base_weight; - base->a = base->a + mask_weight * (1.0 - base->a);*/ -} - -METHSPEC double Color::normalize() { -#ifndef NDEBUG - assert(r >= 0.0); - assert(g >= 0.0); - assert(b >= 0.0); - assert(a >= 0.0); -#ifdef isnan - assert(!isnan(r)); - assert(!isnan(g)); - assert(!isnan(b)); - assert(!isnan(a)); -#endif -#ifdef isfinite - assert(isfinite(r)); - assert(isfinite(g)); - assert(isfinite(b)); - assert(isfinite(a)); -#endif -#endif - - if (r > 1.0) { - r = 1.0; - } - if (g > 1.0) { - g = 1.0; - } - if (b > 1.0) { - b = 1.0; - } - return 1.0; - /*double max = colorGetValue(col); - - assert(max >= 0.0); - - if (max > 1.0) - { - col->r /= max; - col->g /= max; - col->b /= max; - } - return max;*/ -} - -METHSPEC double Color::getValue() const { - double max; - - max = r; - if (g > max) { - max = g; - } - if (b > max) { - max = b; - } - return max; -} - -METHSPEC double Color::getPower() const { - return r + g + b; -} - -METHSPEC void Color::limitPower(double max_power) { - double power = r + g + b; - - if (power > max_power) { - double factor = max_power / power; - - r *= factor; - g *= factor; - b *= factor; - } -} - -METHSPEC Color Color::add(const Color &other) const { - return Color(r + other.r, g + other.g, b + other.b, a); -} - -METHSPEC Color Color::lerp(const Color &other, double f) const { - Color result(r * (1.0 - f) + other.r * f, g * (1.0 - f) + other.g * f, b * (1.0 - f) + other.b * f, - a * (1.0 - f) + other.a * f); - return result; -} diff --git a/src/basics/InfiniteCylinder.cpp b/src/basics/InfiniteCylinder.cpp index 4a7ae64..4b52262 100644 --- a/src/basics/InfiniteCylinder.cpp +++ b/src/basics/InfiniteCylinder.cpp @@ -1,5 +1,6 @@ #include "InfiniteCylinder.h" +#include #include "PackStream.h" #define EPS 1E-8 diff --git a/src/basics/InfinitePlane.cpp b/src/basics/InfinitePlane.cpp index eed1a7a..4bd46b4 100644 --- a/src/basics/InfinitePlane.cpp +++ b/src/basics/InfinitePlane.cpp @@ -1,5 +1,6 @@ #include "InfinitePlane.h" +#include #include "PackStream.h" #include "InfiniteRay.h" diff --git a/src/basics/SpaceSegment.cpp b/src/basics/SpaceSegment.cpp index 0eb6595..1fe2d4c 100644 --- a/src/basics/SpaceSegment.cpp +++ b/src/basics/SpaceSegment.cpp @@ -1,5 +1,6 @@ #include "SpaceSegment.h" +#include #include #include "SpaceGridIterator.h" diff --git a/src/basics/Sphere.cpp b/src/basics/Sphere.cpp index b1cda67..fe48179 100644 --- a/src/basics/Sphere.cpp +++ b/src/basics/Sphere.cpp @@ -1,5 +1,6 @@ #include "Sphere.h" +#include #include "PackStream.h" #include "InfiniteRay.h" diff --git a/src/basics/Vector3.cpp b/src/basics/Vector3.cpp index 57e72f4..1902d14 100644 --- a/src/basics/Vector3.cpp +++ b/src/basics/Vector3.cpp @@ -1,4 +1,4 @@ -#include "Vector3.inline.cpp" +#include "Vector3.h" #include #include "PackStream.h" @@ -16,6 +16,10 @@ Vector3::Vector3(const VectorSpherical &v) : x(v.r * cos(v.phi) * cos(v.theta)), y(v.r * sin(v.theta)), z(-v.r * sin(v.phi) * cos(v.theta)) { } +Vector3::Vector3(double x, double y, double z) : x(x), y(y), z(z) { +} + + void Vector3::save(PackStream *stream) const { stream->write(&x); stream->write(&y); @@ -27,6 +31,48 @@ void Vector3::load(PackStream *stream) { stream->read(&z); } +Vector3 Vector3::add(double x, double y, double z) const { + return Vector3(this->x + x, this->y + y, this->z + z); +} + +Vector3 Vector3::add(const Vector3 &other) const { + return Vector3(x + other.x, y + other.y, z + other.z); +} + +Vector3 Vector3::sub(const Vector3 &other) const { + return Vector3(x - other.x, y - other.y, z - other.z); +} + +Vector3 Vector3::inverse() const { + return Vector3(-x, -y, -z); +} + +Vector3 Vector3::scale(double scaling) const { + return Vector3(x * scaling, y * scaling, z * scaling); +} + +double Vector3::getNorm() const { + return sqrt(x * x + y * y + z * z); +} + +Vector3 Vector3::normalize() const { + double norm = sqrt(x * x + y * y + z * z); + if (norm == 0.0) { + return VECTOR_ZERO; + } else { + norm = 1.0 / norm; + return Vector3(x * norm, y * norm, z * norm); + } +} + +double Vector3::dotProduct(const Vector3 &other) const { + return x * other.x + y * other.y + z * other.z; +} + +Vector3 Vector3::crossProduct(const Vector3 &other) const { + return Vector3(y * other.z - z * other.y, z * other.x - x * other.z, x * other.y - y * other.x); +} + static inline double _euclidGet2DAngle(double x, double y) { // TEMP Copy of old euclid.c double nx, ny, d, ret; diff --git a/src/basics/Vector3.h b/src/basics/Vector3.h index bc77d13..3b87ce3 100644 --- a/src/basics/Vector3.h +++ b/src/basics/Vector3.h @@ -90,11 +90,4 @@ BASICSSHARED_EXPORT extern const Vector3 VECTOR_WEST; } } -// Inlining -#if PAYSAGES_USE_INLINING -#ifndef VECTOR3_INLINE_CPP -#include "Vector3.inline.cpp" -#endif -#endif - #endif // VECTOR3_H diff --git a/src/basics/Vector3.inline.cpp b/src/basics/Vector3.inline.cpp deleted file mode 100644 index a92d61b..0000000 --- a/src/basics/Vector3.inline.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#define VECTOR3_INLINE_CPP - -#ifdef VECTOR3_H -#define METHSPEC inline -#else -#include "Vector3.h" -#define METHSPEC -#endif - -#include - -METHSPEC Vector3::Vector3(double x, double y, double z) : x(x), y(y), z(z) { -} - -METHSPEC Vector3 Vector3::add(double x, double y, double z) const { - return Vector3(this->x + x, this->y + y, this->z + z); -} - -METHSPEC Vector3 Vector3::add(const Vector3 &other) const { - return Vector3(x + other.x, y + other.y, z + other.z); -} - -METHSPEC Vector3 Vector3::sub(const Vector3 &other) const { - return Vector3(x - other.x, y - other.y, z - other.z); -} - -METHSPEC Vector3 Vector3::inverse() const { - return Vector3(-x, -y, -z); -} - -METHSPEC Vector3 Vector3::scale(double scaling) const { - return Vector3(x * scaling, y * scaling, z * scaling); -} - -METHSPEC double Vector3::getNorm() const { - return sqrt(x * x + y * y + z * z); -} - -METHSPEC Vector3 Vector3::normalize() const { - double norm = sqrt(x * x + y * y + z * z); - if (norm == 0.0) { - return VECTOR_ZERO; - } else { - norm = 1.0 / norm; - return Vector3(x * norm, y * norm, z * norm); - } -} - -METHSPEC double Vector3::dotProduct(const Vector3 &other) const { - return x * other.x + y * other.y + z * other.z; -} - -METHSPEC Vector3 Vector3::crossProduct(const Vector3 &other) const { - return Vector3(y * other.z - z * other.y, z * other.x - x * other.z, x * other.y - y * other.x); -} diff --git a/src/definition/AtmosphereDefinition.cpp b/src/definition/AtmosphereDefinition.cpp index 84e6280..08232cc 100644 --- a/src/definition/AtmosphereDefinition.cpp +++ b/src/definition/AtmosphereDefinition.cpp @@ -1,5 +1,6 @@ #include "AtmosphereDefinition.h" +#include #include "PackStream.h" #include "RandomGenerator.h" #include "FloatNode.h" diff --git a/src/render/software/CloudBasicLayerRenderer.cpp b/src/render/software/CloudBasicLayerRenderer.cpp index b728b1d..f686712 100644 --- a/src/render/software/CloudBasicLayerRenderer.cpp +++ b/src/render/software/CloudBasicLayerRenderer.cpp @@ -1,5 +1,7 @@ #include "CloudBasicLayerRenderer.h" +#include +#include #include "CloudLayerDefinition.h" #include "SoftwareRenderer.h" #include "NoiseGenerator.h" @@ -12,8 +14,6 @@ #include "Logs.h" #include "FloatNode.h" -#include - struct CloudSegment { Vector3 start; Vector3 end; diff --git a/src/render/software/Rasterizer.cpp b/src/render/software/Rasterizer.cpp index 0c5dbeb..b525b86 100644 --- a/src/render/software/Rasterizer.cpp +++ b/src/render/software/Rasterizer.cpp @@ -1,5 +1,6 @@ #include "Rasterizer.h" +#include #include "SoftwareRenderer.h" #include "CameraDefinition.h" #include "CanvasPortion.h" diff --git a/src/render/software/SkyRasterizer.cpp b/src/render/software/SkyRasterizer.cpp index ca3f9aa..7bfc79e 100644 --- a/src/render/software/SkyRasterizer.cpp +++ b/src/render/software/SkyRasterizer.cpp @@ -1,5 +1,6 @@ #include "SkyRasterizer.h" +#include #include "Vector3.h" #include "Color.h" #include "SoftwareRenderer.h" diff --git a/src/render/software/TerrainRasterizer.cpp b/src/render/software/TerrainRasterizer.cpp index 80eca27..275fbda 100644 --- a/src/render/software/TerrainRasterizer.cpp +++ b/src/render/software/TerrainRasterizer.cpp @@ -1,5 +1,6 @@ #include "TerrainRasterizer.h" +#include #include "SoftwareRenderer.h" #include "BoundingBox.h" #include "CameraDefinition.h" diff --git a/src/render/software/TerrainRayWalker.cpp b/src/render/software/TerrainRayWalker.cpp index e85146f..b7ab8a8 100644 --- a/src/render/software/TerrainRayWalker.cpp +++ b/src/render/software/TerrainRayWalker.cpp @@ -1,5 +1,6 @@ #include "TerrainRayWalker.h" +#include #include "SoftwareRenderer.h" #include "Scenery.h" #include "TerrainDefinition.h" diff --git a/src/render/software/TexturesRenderer.cpp b/src/render/software/TexturesRenderer.cpp index 22ce4f9..6b9a6a8 100644 --- a/src/render/software/TexturesRenderer.cpp +++ b/src/render/software/TexturesRenderer.cpp @@ -1,5 +1,6 @@ #include "TexturesRenderer.h" +#include #include "Scenery.h" #include "SoftwareRenderer.h" #include "TextureLayerDefinition.h" diff --git a/src/render/software/WaterRasterizer.cpp b/src/render/software/WaterRasterizer.cpp index a1817a9..f5042c1 100644 --- a/src/render/software/WaterRasterizer.cpp +++ b/src/render/software/WaterRasterizer.cpp @@ -1,5 +1,6 @@ #include "WaterRasterizer.h" +#include #include "SoftwareRenderer.h" #include "WaterRenderer.h" #include "CanvasFragment.h" diff --git a/src/render/software/WaterRenderer.cpp b/src/render/software/WaterRenderer.cpp index f5b0eee..4f058f6 100644 --- a/src/render/software/WaterRenderer.cpp +++ b/src/render/software/WaterRenderer.cpp @@ -1,5 +1,6 @@ #include "WaterRenderer.h" +#include #include "SoftwareRenderer.h" #include "TerrainRenderer.h" #include "WaterDefinition.h" diff --git a/src/system/system_global.h b/src/system/system_global.h index e723387..7daa901 100644 --- a/src/system/system_global.h +++ b/src/system/system_global.h @@ -7,7 +7,6 @@ #define Q_DECL_EXPORT __declspec(dllexport) #define Q_DECL_IMPORT __declspec(dllimport) #else -#define PAYSAGES_USE_INLINING 1 #define Q_DECL_EXPORT __attribute__((visibility("default"))) #define Q_DECL_IMPORT __attribute__((visibility("default"))) #endif diff --git a/src/tests/CappedCylinder_Test.cpp b/src/tests/CappedCylinder_Test.cpp index 1a04463..6f13389 100644 --- a/src/tests/CappedCylinder_Test.cpp +++ b/src/tests/CappedCylinder_Test.cpp @@ -1,5 +1,6 @@ #include "BaseTestCase.h" +#include #include "CappedCylinder.h" TEST(CappedCylinder, checkRayIntersection) { diff --git a/src/tests/GodRaysSampler_Test.cpp b/src/tests/GodRaysSampler_Test.cpp index 8ac3de4..466f7cc 100644 --- a/src/tests/GodRaysSampler_Test.cpp +++ b/src/tests/GodRaysSampler_Test.cpp @@ -1,6 +1,7 @@ #include "BaseTestCase.h" #include "GodRaysSampler.h" +#include #include "SpaceSegment.h" #include "Vector3.h" #include "LightingManager.h" From 1f656a6f86e8aca96d8309937e0c74dc3d720885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 9 Dec 2015 00:34:08 +0100 Subject: [PATCH 2/3] Added missing export flag on classes --- src/basics/NoiseFunctionPerlin.h | 2 +- src/basics/NoiseFunctionSimplex.h | 2 +- src/system/Logs.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/basics/NoiseFunctionPerlin.h b/src/basics/NoiseFunctionPerlin.h index 71c38d9..b80bf92 100644 --- a/src/basics/NoiseFunctionPerlin.h +++ b/src/basics/NoiseFunctionPerlin.h @@ -6,7 +6,7 @@ namespace paysages { namespace basics { -class NoiseFunctionPerlin { +class BASICSSHARED_EXPORT NoiseFunctionPerlin { public: NoiseFunctionPerlin(); }; diff --git a/src/basics/NoiseFunctionSimplex.h b/src/basics/NoiseFunctionSimplex.h index 21316c7..7712983 100644 --- a/src/basics/NoiseFunctionSimplex.h +++ b/src/basics/NoiseFunctionSimplex.h @@ -8,7 +8,7 @@ namespace paysages { namespace basics { -class NoiseFunctionSimplex : public FractalNoise { +class BASICSSHARED_EXPORT NoiseFunctionSimplex : public FractalNoise { virtual double getBase2d(double x, double y) const override; virtual double getBase3d(double x, double y, double z) const override; diff --git a/src/system/Logs.h b/src/system/Logs.h index 97c876c..641aeb2 100644 --- a/src/system/Logs.h +++ b/src/system/Logs.h @@ -11,7 +11,7 @@ namespace system { /** * Logger streams */ -class Logs { +class SYSTEMSHARED_EXPORT Logs { public: static std::ostream &debug(); static std::ostream &warning(); From 9c774f3817a2f93e2d1fb3eadec971c71e5925b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 9 Dec 2015 00:34:56 +0100 Subject: [PATCH 3/3] Fixed noise shader function using deprecated "texture2D" --- src/render/opengl/shaders/noise.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/opengl/shaders/noise.frag b/src/render/opengl/shaders/noise.frag index 02995cf..57b81fe 100644 --- a/src/render/opengl/shaders/noise.frag +++ b/src/render/opengl/shaders/noise.frag @@ -9,7 +9,7 @@ vec3 noiseNormal2d(vec2 location, float detail) vec3 normal = vec3(0.0, 0.0, 0.0); for (float scaling = 1.0; scaling < 400.0; scaling *= 1.5) { - normal += texture2D(simplexSampler, location * 0.01 * scaling).xyz; + normal += texture(simplexSampler, location * 0.01 * scaling).xyz; } return normalize(normal); }