MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / applySamplerWrapS

Function applySamplerWrapS

CesiumGltf/src/SamplerUtility.cpp:11–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10namespace CesiumGltf {
11double applySamplerWrapS(const double u, const int32_t wrapS) {
12 if (wrapS == Sampler::WrapS::REPEAT) {
13 double integral = 0;
14 double fraction = std::modf(u, &integral);
15 return fraction < 0 ? fraction + 1.0 : fraction;
16 }
17
18 if (wrapS == Sampler::WrapS::MIRRORED_REPEAT) {
19 double integral = 0;
20 double fraction = std::abs(std::modf(u, &integral));
21 int64_t integer = static_cast<int64_t>(std::abs(integral));
22 // If the integer part is odd, the direction is reversed.
23 return integer % 2 == 1 ? 1.0 - fraction : fraction;
24 }
25
26 return glm::clamp(u, 0.0, 1.0);
27}
28
29double applySamplerWrapT(const double v, const int32_t wrapT) {
30 if (wrapT == Sampler::WrapT::REPEAT) {

Callers 1

sampleNearestPixelMethod · 0.85

Calls 1

clampFunction · 0.85

Tested by

no test coverage detected