Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions cmake/MaterialxShadersLinkOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
8 changes: 4 additions & 4 deletions dso/map/adjustment/colorcorrect/colorcorrect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dso/map/adjustment/rgbtohsv/rgbtohsv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion dso/map/math/two_operands/two_operands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions dso/map/procedural/cellnoise2d/ND_cellnoise2d_float.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(floor(texcoord.x));
const int iy = static_cast<int>(floor(texcoord.y));
const int ix = static_cast<int>(std::floor(texcoord.x));
const int iy = static_cast<int>(std::floor(texcoord.y));

// Generate a unique cell ID using the noise permutation table
// Hash the cell coordinates through the permutation table
Expand Down
6 changes: 3 additions & 3 deletions dso/map/procedural/cellnoise3d/ND_cellnoise3d_float.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(floor(position.x));
const int iy = static_cast<int>(floor(position.y));
const int iz = static_cast<int>(floor(position.z));
const int ix = static_cast<int>(std::floor(position.x));
const int iy = static_cast<int>(std::floor(position.y));
const int iz = static_cast<int>(std::floor(position.z));

// Generate a unique cell ID using the noise permutation table
// Hash the cell coordinates through the permutation table
Expand Down
2 changes: 1 addition & 1 deletion dso/map/procedural/checkerboard/ND_checkerboard_color3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

6 changes: 3 additions & 3 deletions dso/map/procedural/crosshatch/ND_crosshatch_color3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions dso/map/procedural/grid/ND_grid_color3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion dso/map/procedural/randomcolor/randomcolor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(floor(evalFloat(me, inAttr, tls, state) * kFloatScale));
const int in = static_cast<int>(std::floor(evalFloat(me, inAttr, tls, state) * kFloatScale));
#endif

Color hsvLow, hsvHigh;
Expand Down
2 changes: 1 addition & 1 deletion dso/map/procedural/randomfloat/randomfloat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(floor(evalFloat(me, inAttr, tls, state) * kFloatScale));
const int in = static_cast<int>(std::floor(evalFloat(me, inAttr, tls, state) * kFloatScale));
#endif

const float lo = evalFloat(me, minAttr, tls, state);
Expand Down
8 changes: 4 additions & 4 deletions dso/map/procedural/tiledcircles/ND_tiledcircles_color3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions dso/map/procedural/tiledhexagons/ND_tiledhexagons_color3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dso/map/procedural/trianglewave/ND_trianglewave_float.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ND_trianglewave_float::sample(const Map* self, moonray::shading::TLState *tls,
{
const ND_trianglewave_float* me = static_cast<const ND_trianglewave_float*>(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);
}
Expand Down
6 changes: 3 additions & 3 deletions dso/map/procedural/unifiednoise2d/ND_unifiednoise2d_float.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(floor(transformedPos.x));
const int iy = static_cast<int>(floor(transformedPos.y));
const int iz = static_cast<int>(floor(transformedPos.z));
const int ix = static_cast<int>(std::floor(transformedPos.x));
const int iy = static_cast<int>(std::floor(transformedPos.y));
const int iz = static_cast<int>(std::floor(transformedPos.z));

// Generate a unique cell ID using the noise permutation table
const ispc::NOISE_Noise* noise = me->mCellNoise->getIspc();
Expand Down
6 changes: 3 additions & 3 deletions dso/map/procedural/unifiednoise3d/ND_unifiednoise3d_float.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(floor(transformedPos.x));
const int iy = static_cast<int>(floor(transformedPos.y));
const int iz = static_cast<int>(floor(transformedPos.z));
const int ix = static_cast<int>(std::floor(transformedPos.x));
const int iy = static_cast<int>(std::floor(transformedPos.y));
const int iz = static_cast<int>(std::floor(transformedPos.z));

// Generate a unique cell ID using the noise permutation table
const ispc::NOISE_Noise* noise = me->mCellNoise->getIspc();
Expand Down
Loading