diff --git a/cmake/MaterialxShadersLinkOptions.cmake b/cmake/MaterialxShadersLinkOptions.cmake index 2a7e4e3..3c271c3 100644 --- a/cmake/MaterialxShadersLinkOptions.cmake +++ b/cmake/MaterialxShadersLinkOptions.cmake @@ -2,8 +2,12 @@ # Copyright Contributors to the Moonray Project function(${PROJECT_NAME}_link_options target) - target_link_options(${target} - PRIVATE - -Wl,--enable-new-dtags # Use RUNPATH instead of RPATH - ) + if(IsDarwinPlatform) + target_link_options(${target} PRIVATE -Wl,-ld_classic) + else() + target_link_options(${target} + PRIVATE + -Wl,--enable-new-dtags # Use RUNPATH instead of RPATH + ) + endif() endfunction() diff --git a/dso/map/adjustment/colorcorrect/colorcorrect.cc b/dso/map/adjustment/colorcorrect/colorcorrect.cc index 5360492..a79d570 100644 --- a/dso/map/adjustment/colorcorrect/colorcorrect.cc +++ b/dso/map/adjustment/colorcorrect/colorcorrect.cc @@ -146,7 +146,7 @@ colorCorrect(IN_TYPE inValue, // Apply exposure (2^value) if (exposure != 0.0f) { - Float exposureFactor = pow(2.0f, exposure); + Float exposureFactor = std::pow(2.0f, exposure); inColor.r *= exposureFactor; inColor.g *= exposureFactor; inColor.b *= exposureFactor; @@ -162,9 +162,9 @@ colorCorrect(IN_TYPE inValue, // Apply gamma correction if (gamma != 1.0f && gamma > 0.0f) { Float invGamma = 1.0f / gamma; - inColor.r = max(0.0f, pow(max(0.0f, inColor.r), invGamma)); - inColor.g = max(0.0f, pow(max(0.0f, inColor.g), invGamma)); - inColor.b = max(0.0f, pow(max(0.0f, inColor.b), invGamma)); + inColor.r = max(0.0f, std::pow(max(0.0f, inColor.r), invGamma)); + inColor.g = max(0.0f, std::pow(max(0.0f, inColor.g), invGamma)); + inColor.b = max(0.0f, std::pow(max(0.0f, inColor.b), invGamma)); } // Apply contrast around pivot diff --git a/dso/map/adjustment/rgbtohsv/rgbtohsv.cc b/dso/map/adjustment/rgbtohsv/rgbtohsv.cc index 523dbbe..1aa4e61 100644 --- a/dso/map/adjustment/rgbtohsv/rgbtohsv.cc +++ b/dso/map/adjustment/rgbtohsv/rgbtohsv.cc @@ -113,7 +113,7 @@ toHSV(const IN_TYPE& rgb) if (diff == 0.f) { h = 0.f; } else if (cmax == rgb.r) { - h = fmod(((rgb.g - rgb.b) / diff + 6.f), 6.f); + h = std::fmod(((rgb.g - rgb.b) / diff + 6.f), 6.f); } else if (cmax == rgb.g) { h = (rgb.b - rgb.r) / diff + 2.f; } else { diff --git a/dso/map/colortransform/adobergb_to_lin_rec709/adobergb_to_lin_rec709.cc b/dso/map/colortransform/adobergb_to_lin_rec709/adobergb_to_lin_rec709.cc index 352e2f7..cec86a8 100644 --- a/dso/map/colortransform/adobergb_to_lin_rec709/adobergb_to_lin_rec709.cc +++ b/dso/map/colortransform/adobergb_to_lin_rec709/adobergb_to_lin_rec709.cc @@ -118,9 +118,9 @@ doAdobergbToLinRec709(IN_TYPE inValue) linearAdobeRgb.g = max(0.0f, inValue.g); linearAdobeRgb.b = max(0.0f, inValue.b); - linearAdobeRgb.r = pow(linearAdobeRgb.r, gamma); - linearAdobeRgb.g = pow(linearAdobeRgb.g, gamma); - linearAdobeRgb.b = pow(linearAdobeRgb.b, gamma); + linearAdobeRgb.r = std::pow(linearAdobeRgb.r, gamma); + linearAdobeRgb.g = std::pow(linearAdobeRgb.g, gamma); + linearAdobeRgb.b = std::pow(linearAdobeRgb.b, gamma); // Adobe RGB and Rec.709 share the same primaries (both D65 white point) // so no matrix transformation is needed, only gamma decode diff --git a/dso/map/colortransform/g18_rec709_to_lin_rec709/g18_rec709_to_lin_rec709.cc b/dso/map/colortransform/g18_rec709_to_lin_rec709/g18_rec709_to_lin_rec709.cc index df4c5dc..3e45679 100644 --- a/dso/map/colortransform/g18_rec709_to_lin_rec709/g18_rec709_to_lin_rec709.cc +++ b/dso/map/colortransform/g18_rec709_to_lin_rec709/g18_rec709_to_lin_rec709.cc @@ -116,9 +116,9 @@ doG18Rec709ToLinRec709(IN_TYPE inValue) outValue.g = max(0.0f, inValue.g); outValue.b = max(0.0f, inValue.b); - outValue.r = pow(outValue.r, 1.8f); - outValue.g = pow(outValue.g, 1.8f); - outValue.b = pow(outValue.b, 1.8f); + outValue.r = std::pow(outValue.r, 1.8f); + outValue.g = std::pow(outValue.g, 1.8f); + outValue.b = std::pow(outValue.b, 1.8f); return outValue; } diff --git a/dso/map/colortransform/g22_ap1_to_lin_rec709/g22_ap1_to_lin_rec709.cc b/dso/map/colortransform/g22_ap1_to_lin_rec709/g22_ap1_to_lin_rec709.cc index fe1c870..fa3ce7b 100644 --- a/dso/map/colortransform/g22_ap1_to_lin_rec709/g22_ap1_to_lin_rec709.cc +++ b/dso/map/colortransform/g22_ap1_to_lin_rec709/g22_ap1_to_lin_rec709.cc @@ -113,9 +113,9 @@ doG22Ap1ToLinRec709(IN_TYPE inValue) linearAp1.g = max(0.0f, inValue.g); linearAp1.b = max(0.0f, inValue.b); - linearAp1.r = pow(linearAp1.r, 2.2f); - linearAp1.g = pow(linearAp1.g, 2.2f); - linearAp1.b = pow(linearAp1.b, 2.2f); + linearAp1.r = std::pow(linearAp1.r, 2.2f); + linearAp1.g = std::pow(linearAp1.g, 2.2f); + linearAp1.b = std::pow(linearAp1.b, 2.2f); // Step 2: Apply ACEScg (AP1) to Linear Rec.709 matrix const float m00 = 1.705050786f; diff --git a/dso/map/colortransform/g22_rec709_to_lin_rec709/g22_rec709_to_lin_rec709.cc b/dso/map/colortransform/g22_rec709_to_lin_rec709/g22_rec709_to_lin_rec709.cc index de78b82..8a886f5 100644 --- a/dso/map/colortransform/g22_rec709_to_lin_rec709/g22_rec709_to_lin_rec709.cc +++ b/dso/map/colortransform/g22_rec709_to_lin_rec709/g22_rec709_to_lin_rec709.cc @@ -115,9 +115,9 @@ doG22Rec709ToLinRec709(IN_TYPE inValue) outValue.g = max(0.0f, inValue.g); outValue.b = max(0.0f, inValue.b); - outValue.r = pow(outValue.r, 2.2f); - outValue.g = pow(outValue.g, 2.2f); - outValue.b = pow(outValue.b, 2.2f); + outValue.r = std::pow(outValue.r, 2.2f); + outValue.g = std::pow(outValue.g, 2.2f); + outValue.b = std::pow(outValue.b, 2.2f); return outValue; } diff --git a/dso/map/colortransform/rec709_display_to_lin_rec709/rec709_display_to_lin_rec709.cc b/dso/map/colortransform/rec709_display_to_lin_rec709/rec709_display_to_lin_rec709.cc index 03b0e83..6c561d8 100644 --- a/dso/map/colortransform/rec709_display_to_lin_rec709/rec709_display_to_lin_rec709.cc +++ b/dso/map/colortransform/rec709_display_to_lin_rec709/rec709_display_to_lin_rec709.cc @@ -115,9 +115,9 @@ doG18Rec709ToLinRec709(IN_TYPE inValue) outValue.g = max(0.0f, inValue.g); outValue.b = max(0.0f, inValue.b); - outValue.r = pow(outValue.r, 2.4f); - outValue.g = pow(outValue.g, 2.4f); - outValue.b = pow(outValue.b, 2.4f); + outValue.r = std::pow(outValue.r, 2.4f); + outValue.g = std::pow(outValue.g, 2.4f); + outValue.b = std::pow(outValue.b, 2.4f); return outValue; } diff --git a/dso/map/colortransform/srgb_displayp3_to_lin_rec709/srgb_displayp3_to_lin_rec709.cc b/dso/map/colortransform/srgb_displayp3_to_lin_rec709/srgb_displayp3_to_lin_rec709.cc index 2cc9acc..827b7e0 100644 --- a/dso/map/colortransform/srgb_displayp3_to_lin_rec709/srgb_displayp3_to_lin_rec709.cc +++ b/dso/map/colortransform/srgb_displayp3_to_lin_rec709/srgb_displayp3_to_lin_rec709.cc @@ -80,7 +80,7 @@ float srgbToLinear(float val) if (val <= threshold) { return val / 12.92f; } else { - return pow(max(0.0f, (val + 0.055f) / 1.055f), 2.4f); + return std::pow(max(0.0f, (val + 0.055f) / 1.055f), 2.4f); } } diff --git a/dso/map/colortransform/srgb_texture_to_lin_rec709/srgb_texture_to_lin_rec709.cc b/dso/map/colortransform/srgb_texture_to_lin_rec709/srgb_texture_to_lin_rec709.cc index 59ca1d9..53227a6 100644 --- a/dso/map/colortransform/srgb_texture_to_lin_rec709/srgb_texture_to_lin_rec709.cc +++ b/dso/map/colortransform/srgb_texture_to_lin_rec709/srgb_texture_to_lin_rec709.cc @@ -113,7 +113,7 @@ srgbToLinear(float val) if (val <= threshold) { return val / 12.92f; } else { - return pow(max(0.0f, (val + 0.055f) / 1.055f), 2.4f); + return std::pow(max(0.0f, (val + 0.055f) / 1.055f), 2.4f); } } diff --git a/dso/map/math/two_operands/two_operands.cc b/dso/map/math/two_operands/two_operands.cc index ea1a00c..51059f7 100644 --- a/dso/map/math/two_operands/two_operands.cc +++ b/dso/map/math/two_operands/two_operands.cc @@ -224,7 +224,7 @@ doOperation(float in1, float in2) #elif STRING_CMP(OPERATION,divide) return in1 / in2; #elif STRING_CMP(OPERATION,modulo) - return fmod(in1, in2); + return std::fmod(in1, in2); #elif STRING_CMP(OPERATION,atan2) return atan2f(in1, in2); #elif STRING_CMP(OPERATION,power) diff --git a/dso/map/procedural/cellnoise2d/ND_cellnoise2d_float.cc b/dso/map/procedural/cellnoise2d/ND_cellnoise2d_float.cc index 0f84c03..752d1c9 100644 --- a/dso/map/procedural/cellnoise2d/ND_cellnoise2d_float.cc +++ b/dso/map/procedural/cellnoise2d/ND_cellnoise2d_float.cc @@ -56,8 +56,8 @@ ND_cellnoise2d_float::sample(const Map* self, moonray::shading::TLState *tls, // Cell noise returns a pseudo-random value for each cell based on texcoord // We use the integer cell coordinates to generate a consistent random value - const int ix = static_cast(floor(texcoord.x)); - const int iy = static_cast(floor(texcoord.y)); + const int ix = static_cast(std::floor(texcoord.x)); + const int iy = static_cast(std::floor(texcoord.y)); // Generate a unique cell ID using the noise permutation table // Hash the cell coordinates through the permutation table diff --git a/dso/map/procedural/cellnoise3d/ND_cellnoise3d_float.cc b/dso/map/procedural/cellnoise3d/ND_cellnoise3d_float.cc index f3a8fdc..fd08652 100644 --- a/dso/map/procedural/cellnoise3d/ND_cellnoise3d_float.cc +++ b/dso/map/procedural/cellnoise3d/ND_cellnoise3d_float.cc @@ -56,9 +56,9 @@ ND_cellnoise3d_float::sample(const Map* self, moonray::shading::TLState *tls, // Cell noise returns a pseudo-random value for each cell based on position // We use the integer cell coordinates to generate a consistent random value - const int ix = static_cast(floor(position.x)); - const int iy = static_cast(floor(position.y)); - const int iz = static_cast(floor(position.z)); + const int ix = static_cast(std::floor(position.x)); + const int iy = static_cast(std::floor(position.y)); + const int iz = static_cast(std::floor(position.z)); // Generate a unique cell ID using the noise permutation table // Hash the cell coordinates through the permutation table diff --git a/dso/map/procedural/checkerboard/ND_checkerboard_color3.cc b/dso/map/procedural/checkerboard/ND_checkerboard_color3.cc index 70b4411..e99593d 100644 --- a/dso/map/procedural/checkerboard/ND_checkerboard_color3.cc +++ b/dso/map/procedural/checkerboard/ND_checkerboard_color3.cc @@ -51,7 +51,7 @@ ND_checkerboard_color3::sample(const Map* self, moonray::shading::TLState *tls, // Do procedural calculation Vec2f uv = texcoordValue * uvtilingValue - uvoffsetValue; - int uvXor = (int)floor(uv.x) ^ (int)floor(uv.y); + int uvXor = (int)std::floor(uv.x) ^ (int)std::floor(uv.y); *sample = (uvXor & 1) ? color1Value : color2Value; } diff --git a/dso/map/procedural/crosshatch/ND_crosshatch_color3.cc b/dso/map/procedural/crosshatch/ND_crosshatch_color3.cc index dfb899e..0cd4e8d 100644 --- a/dso/map/procedural/crosshatch/ND_crosshatch_color3.cc +++ b/dso/map/procedural/crosshatch/ND_crosshatch_color3.cc @@ -54,7 +54,7 @@ ND_crosshatch_color3::sample(const Map* self, moonray::shading::TLState *tls, // Stagger in u direction if v's integer part is odd if (staggered) { - float vFloor = floor(uv.y); + float vFloor = std::floor(uv.y); int vInt = (int)vFloor; if (vInt & 1) uv.x = uv.x + 0.5f; } @@ -64,8 +64,8 @@ ND_crosshatch_color3::sample(const Map* self, moonray::shading::TLState *tls, float y = uv.x - uv.y; // Find fractional coords with a rotated tile centred on the square gap between the crosshatches - float xFrac = x - floor(x); - float yFrac = y - floor(y); + float xFrac = x - std::floor(x); + float yFrac = y - std::floor(y); // Determine axial distances from tile centre float ax = scene_rdl2::math::abs(xFrac - 0.5f); diff --git a/dso/map/procedural/grid/ND_grid_color3.cc b/dso/map/procedural/grid/ND_grid_color3.cc index ff872d2..19ab707 100644 --- a/dso/map/procedural/grid/ND_grid_color3.cc +++ b/dso/map/procedural/grid/ND_grid_color3.cc @@ -54,14 +54,14 @@ ND_grid_color3::sample(const Map* self, moonray::shading::TLState *tls, // Stagger in u direction if v's integer part is odd if (staggered) { - float vFloor = floor(uv.y); + float vFloor = std::floor(uv.y); int vInt = (int)vFloor; if (vInt & 1) uv.x = uv.x + 0.5f; } // Find fractional coords - float uFrac = uv.x - floor(uv.x); - float vFrac = uv.y - floor(uv.y); + float uFrac = uv.x - std::floor(uv.x); + float vFrac = uv.y - std::floor(uv.y); // Determine axial distances from tile centre float au = scene_rdl2::math::abs(uFrac - 0.5f); diff --git a/dso/map/procedural/randomcolor/randomcolor.cc b/dso/map/procedural/randomcolor/randomcolor.cc index 31811b3..12af63a 100644 --- a/dso/map/procedural/randomcolor/randomcolor.cc +++ b/dso/map/procedural/randomcolor/randomcolor.cc @@ -124,7 +124,7 @@ SHADER_NAME::sample(const SHADER_TYPE* self, moonray::shading::TLState *tls, #if STRING_CMP(VARIANT,integer) const int in = evalInt(me, inAttr, tls, state); #else - const int in = static_cast(floor(evalFloat(me, inAttr, tls, state) * kFloatScale)); + const int in = static_cast(std::floor(evalFloat(me, inAttr, tls, state) * kFloatScale)); #endif Color hsvLow, hsvHigh; diff --git a/dso/map/procedural/randomfloat/randomfloat.cc b/dso/map/procedural/randomfloat/randomfloat.cc index 9cec9f9..1f90c00 100644 --- a/dso/map/procedural/randomfloat/randomfloat.cc +++ b/dso/map/procedural/randomfloat/randomfloat.cc @@ -116,7 +116,7 @@ SHADER_NAME::sample(const SHADER_TYPE* self, moonray::shading::TLState *tls, #if STRING_CMP(VARIANT,integer) const int in = evalInt(me, inAttr, tls, state); #else - const int in = static_cast(floor(evalFloat(me, inAttr, tls, state) * kFloatScale)); + const int in = static_cast(std::floor(evalFloat(me, inAttr, tls, state) * kFloatScale)); #endif const float lo = evalFloat(me, minAttr, tls, state); diff --git a/dso/map/procedural/tiledcircles/ND_tiledcircles_color3.cc b/dso/map/procedural/tiledcircles/ND_tiledcircles_color3.cc index bba539e..4584b50 100644 --- a/dso/map/procedural/tiledcircles/ND_tiledcircles_color3.cc +++ b/dso/map/procedural/tiledcircles/ND_tiledcircles_color3.cc @@ -70,9 +70,9 @@ ND_tiledcircles_color3::sample(const Map* map, moonray::shading::TLState *tls, const float d8 = -uv.x - 1.73205080757f * uv.y; // dot uv with 2 * (-1/2, -sqrt(3)/2) // Find floors corresponding to cell boundaries - const float i0 = floor(d0); - const float i4 = floor(d4); - const float i8 = floor(d8); + const float i0 = std::floor(d0); + const float i4 = std::floor(d4); + const float i8 = std::floor(d8); // The other indices (i2, i6, i10) are derived from the above to represent the other directions, in an // efficient way using less arithmetic. These relationships come from the symmetry of the hexagonal lattice. @@ -100,7 +100,7 @@ ND_tiledcircles_color3::sample(const Map* map, moonray::shading::TLState *tls, } else { // Not staggered; use square lattice. // Simply find center of square containing the uv-point. - center = Vec2f(floor(uv.x) + 0.5f, floor(uv.y) + 0.5f); + center = Vec2f(std::floor(uv.x) + 0.5f, std::floor(uv.y) + 0.5f); } const float dSqr = lengthSqr(uv - center); diff --git a/dso/map/procedural/tiledcloverleafs/ND_tiledcloverleafs_color3.cc b/dso/map/procedural/tiledcloverleafs/ND_tiledcloverleafs_color3.cc index 49c141f..338367e 100644 --- a/dso/map/procedural/tiledcloverleafs/ND_tiledcloverleafs_color3.cc +++ b/dso/map/procedural/tiledcloverleafs/ND_tiledcloverleafs_color3.cc @@ -63,13 +63,13 @@ ND_tiledcloverleafs_color3::sample(const Map* map, moonray::shading::TLState *tl const Vec2f uv1 = Vec2f(uv.x + uv.y + 0.5f, uv.x - uv.y + 0.5f); // Round - const Vec2f uv2 = Vec2f(floor(uv1.x), floor(uv1.y)); + const Vec2f uv2 = Vec2f(std::floor(uv1.x), std::floor(uv1.y)); // Undo rotation and scale to give center center = 0.5f * Vec2f(uv2.x + uv2.y, uv2.x - uv2.y); } else { // Not staggered - simply find center of square containing the uv-point. - center = Vec2f(floor(uv.x) + 0.5f, floor(uv.y) + 0.5f); + center = Vec2f(std::floor(uv.x) + 0.5f, std::floor(uv.y) + 0.5f); } // Do procedural calculation: diff --git a/dso/map/procedural/tiledhexagons/ND_tiledhexagons_color3.cc b/dso/map/procedural/tiledhexagons/ND_tiledhexagons_color3.cc index f53fac5..5f2c81f 100644 --- a/dso/map/procedural/tiledhexagons/ND_tiledhexagons_color3.cc +++ b/dso/map/procedural/tiledhexagons/ND_tiledhexagons_color3.cc @@ -69,9 +69,9 @@ ND_tiledhexagons_color3::sample(const Map* map, moonray::shading::TLState *tls, float d8 = -uv.x - 1.73205080757f * uv.y; // dot uv with 2 * (-1/2, -sqrt(3)/2) // Find floors corresponding to cell boundaries - const float i0 = floor(d0); - const float i4 = floor(d4); - const float i8 = floor(d8); + const float i0 = std::floor(d0); + const float i4 = std::floor(d4); + const float i8 = std::floor(d8); // Reduce dot products to their fractional values d0 -= i0; @@ -90,7 +90,7 @@ ND_tiledhexagons_color3::sample(const Map* map, moonray::shading::TLState *tls, } else { // Not staggered; use square lattice. // Simply find center of square containing the uv-point. - const Vec2f center = Vec2f(floor(uv.x) + 0.5f, floor(uv.y) + 0.5f); + const Vec2f center = Vec2f(std::floor(uv.x) + 0.5f, std::floor(uv.y) + 0.5f); // Find position relative to center, and take (scaled) dot products with directions 0, 4, 8 const Vec2f duv = uv - center; diff --git a/dso/map/procedural/trianglewave/ND_trianglewave_float.cc b/dso/map/procedural/trianglewave/ND_trianglewave_float.cc index 375f8b7..dc4f07d 100644 --- a/dso/map/procedural/trianglewave/ND_trianglewave_float.cc +++ b/dso/map/procedural/trianglewave/ND_trianglewave_float.cc @@ -41,7 +41,7 @@ ND_trianglewave_float::sample(const Map* self, moonray::shading::TLState *tls, { const ND_trianglewave_float* me = static_cast(self); float in = evalFloat(me, inAttr, tls, state); - float t = 2.0f * (in - floor(in)); + float t = 2.0f * (in - std::floor(in)); float out = (t < 1.0f) ? t : 2.0f-t; *sample = Color(out); } diff --git a/dso/map/procedural/unifiednoise2d/ND_unifiednoise2d_float.cc b/dso/map/procedural/unifiednoise2d/ND_unifiednoise2d_float.cc index 90fec7b..56966d1 100644 --- a/dso/map/procedural/unifiednoise2d/ND_unifiednoise2d_float.cc +++ b/dso/map/procedural/unifiednoise2d/ND_unifiednoise2d_float.cc @@ -97,9 +97,9 @@ ND_unifiednoise2d_float::sample(const Map* self, moonray::shading::TLState *tls, case 1: { // Cell noise // Cell noise returns a pseudo-random value for each cell based on texcoord - const int ix = static_cast(floor(transformedPos.x)); - const int iy = static_cast(floor(transformedPos.y)); - const int iz = static_cast(floor(transformedPos.z)); + const int ix = static_cast(std::floor(transformedPos.x)); + const int iy = static_cast(std::floor(transformedPos.y)); + const int iz = static_cast(std::floor(transformedPos.z)); // Generate a unique cell ID using the noise permutation table const ispc::NOISE_Noise* noise = me->mCellNoise->getIspc(); diff --git a/dso/map/procedural/unifiednoise3d/ND_unifiednoise3d_float.cc b/dso/map/procedural/unifiednoise3d/ND_unifiednoise3d_float.cc index f03f5ed..a9aaf61 100644 --- a/dso/map/procedural/unifiednoise3d/ND_unifiednoise3d_float.cc +++ b/dso/map/procedural/unifiednoise3d/ND_unifiednoise3d_float.cc @@ -96,9 +96,9 @@ ND_unifiednoise3d_float::sample(const Map* self, moonray::shading::TLState *tls, case 1: { // Cell noise // Cell noise returns a pseudo-random value for each cell based on position - const int ix = static_cast(floor(transformedPos.x)); - const int iy = static_cast(floor(transformedPos.y)); - const int iz = static_cast(floor(transformedPos.z)); + const int ix = static_cast(std::floor(transformedPos.x)); + const int iy = static_cast(std::floor(transformedPos.y)); + const int iz = static_cast(std::floor(transformedPos.z)); // Generate a unique cell ID using the noise permutation table const ispc::NOISE_Noise* noise = me->mCellNoise->getIspc(); diff --git a/lib/map/MtlxHextile.cc b/lib/map/MtlxHextile.cc index a90aa84..84751f3 100644 --- a/lib/map/MtlxHextile.cc +++ b/lib/map/MtlxHextile.cc @@ -29,9 +29,9 @@ mxHextileHash(const Vec2f& p) Vec3f p3 = Vec3f(0.1031f * p.x, 0.1030f * p.y, 0.0973f * p.x); - p3.x -= floor(p3.x); - p3.y -= floor(p3.y); - p3.z -= floor(p3.z); + p3.x -= scene_rdl2::math::floor(p3.x); + p3.y -= scene_rdl2::math::floor(p3.y); + p3.z -= scene_rdl2::math::floor(p3.z); float f = dot(p3, Vec3f(33.33f + p3.y, 33.33f + p3.z, @@ -42,8 +42,8 @@ mxHextileHash(const Vec2f& p) out.y = p3.x + p3.z; out.x *= p3.z; out.y *= p3.y; - out.x -= floor(out.x); - out.y -= floor(out.y); + out.x -= scene_rdl2::math::floor(out.x); + out.y -= scene_rdl2::math::floor(out.y); return out; } @@ -97,7 +97,7 @@ HextileCoord( const Vec2f& dCoordDx, const Vec2f& dCoordDy) { - const float sqrt3_2 = sqrt(3.0f) * 2.0f; + const float sqrt3_2 = scene_rdl2::math::sqrt(3.0f) * 2.0f; // scale coord to maintain the original fit Vec2f st = coord * sqrt3_2; @@ -108,8 +108,8 @@ HextileCoord( // barycentric weights Vec2f stFrac; - stFrac.x = stSkewed.x - floor(stSkewed.x); - stFrac.y = stSkewed.y - floor(stSkewed.y); + stFrac.x = stSkewed.x - scene_rdl2::math::floor(stSkewed.x); + stFrac.y = stSkewed.y - scene_rdl2::math::floor(stSkewed.y); Vec3f temp = Vec3f(stFrac.x, stFrac.y, 0.0); temp.z = 1.0 - temp.x - temp.y; @@ -122,7 +122,7 @@ HextileCoord( float w3 = s - temp.x * s2; // vertex IDs - Vec2f baseID = Vec2f(floor(stSkewed.x), floor(stSkewed.y)); + Vec2f baseID = Vec2f(scene_rdl2::math::floor(stSkewed.x), scene_rdl2::math::floor(stSkewed.y)); Vec2f id1 = baseID + Vec2(s, s); Vec2f id2 = baseID + Vec2(s, 1.0f - s); @@ -144,12 +144,12 @@ HextileCoord( float rr_y = rotationRange.y * sPi / 180.0f; Vec3f rand_x = Vec3f(rand1.x, rand2.x, rand3.x); Vec3f rotations = lerp(Vec3f(rr_x), Vec3f(rr_y), rand_x * rotation); - float sin_r_x = sin(rotations.x); - float sin_r_y = sin(rotations.y); - float sin_r_z = sin(rotations.z); - float cos_r_x = cos(rotations.x); - float cos_r_y = cos(rotations.y); - float cos_r_z = cos(rotations.z); + float sin_r_x = scene_rdl2::math::sin(rotations.x); + float sin_r_y = scene_rdl2::math::sin(rotations.y); + float sin_r_z = scene_rdl2::math::sin(rotations.z); + float cos_r_x = scene_rdl2::math::cos(rotations.x); + float cos_r_y = scene_rdl2::math::cos(rotations.y); + float cos_r_z = scene_rdl2::math::cos(rotations.z); // randomized scale Vec3f rand_y = Vec3f(rand1.y, rand2.y, rand3.y); @@ -188,4 +188,4 @@ HextileCoord( } } -} \ No newline at end of file +} diff --git a/mod/python/shaders/CMakeLists.txt b/mod/python/shaders/CMakeLists.txt index b0449ad..5fc2454 100644 --- a/mod/python/shaders/CMakeLists.txt +++ b/mod/python/shaders/CMakeLists.txt @@ -14,7 +14,7 @@ endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/shaders.py - COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH_WITH_SCENE_RDL2} RDL2_DSO_PATH=${CMAKE_BINARY_DIR}/rdl2dso:$ENV{RDL2_DSO_PATH} ${GENERATE_PYTHON_CREATE_FUNCTIONS} -o ${CMAKE_CURRENT_BINARY_DIR}/shaders.py + COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH_WITH_SCENE_RDL2} RDL2_DSO_PATH=${CMAKE_BINARY_DIR}/rdl2dso:$ENV{RDL2_DSO_PATH} ${Python_EXECUTABLE} ${GENERATE_PYTHON_CREATE_FUNCTIONS} -o ${CMAKE_CURRENT_BINARY_DIR}/shaders.py COMMENT "Generating shaders.py" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../generate_python_create_functions/generate_python_create_functions" )