24 return (
x << k) | (
x >> (32 - k));
70 a =
b =
c = 0xdeadbeef + (1 << 2) + 13;
81 a =
b =
c = 0xdeadbeef + (2 << 2) + 13;
93 a =
b =
c = 0xdeadbeef + (3 << 2) + 13;
106 a =
b =
c = 0xdeadbeef + (4 << 2) + 13;
153 return static_cast<float>(k) /
static_cast<float>(0xFFFFFFFFu);
254 return (1 -
x) * v0 +
x *
v1;
271 return (1.0 -
y) * (v0 * x1 +
v1 *
x) +
y * (
v2 * x1 + v3 *
x);
307 return z1 * (
y1 * (v0 * x1 +
v1 *
x) +
y * (
v2 * x1 + v3 *
x)) +
308 z * (
y1 * (v4 * x1 + v5 *
x) +
y * (v6 * x1 + v7 *
x));
333 return mix(
mix(v0,
v1,
v2, v3, v4, v5, v6, v7,
x,
y,
z),
334 mix(v8, v9, v10, v11, v12, v13, v14, v15,
x,
y,
z),
340 return t *
t *
t * (
t * (
t * 6.0 - 15.0) + 10.0);
345 return (condition != 0u) ? -value : value;
351 float g = 1u + (h & 7u);
358 float u = h < 4u ?
x :
y;
359 float v = 2.0 * (h < 4u ?
y :
x);
366 float u = h < 8u ?
x :
y;
367 float vt =
ELEM(h, 12u, 14u) ?
x :
z;
368 float v = h < 4u ?
y : vt;
375 float u = h < 24u ?
x :
y;
376 float v = h < 16u ?
y :
z;
377 float s = h < 8u ?
z :
w;
383 i = (int)
x - ((
x < 0) ? 1 : 0);
477 noise_grad(
hash(
X + 1,
Y + 1,
Z + 1, W + 1), fx - 1.0, fy - 1.0, fz - 1.0, fw - 1.0),
539 octaves =
CLAMPIS(octaves, 0.0f, 15.0f);
540 int n =
static_cast<int>(octaves);
541 for (
int i = 0; i <= n; i++) {
542 float t =
perlin(fscale * position);
553 float t =
perlin(fscale * position);
554 float sum2 =
sum +
t * amp;
556 sum2 /= maxamp + amp;
557 return (1.0f - rmd) *
sum + rmd * sum2;
722 const float lacunarity,
723 const float octaves_unclamped)
730 const float pwHL =
std::pow(lacunarity, -
H);
731 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
733 for (
int i = 0; i < (int)octaves; i++) {
739 float rmd = octaves -
floorf(octaves);
749 const float lacunarity,
750 const float octaves_unclamped)
755 const float pwHL =
std::pow(lacunarity, -
H);
756 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
758 for (
int i = 0; i < (int)octaves; i++) {
764 const float rmd = octaves -
floorf(octaves);
774 const float lacunarity,
775 const float octaves_unclamped,
779 const float pwHL =
std::pow(lacunarity, -
H);
781 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
787 for (
int i = 1; i < (int)octaves; i++) {
794 const float rmd = octaves -
floorf(octaves);
797 value += rmd * increment;
805 const float lacunarity,
806 const float octaves_unclamped,
811 const float pwHL =
std::pow(lacunarity, -
H);
817 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
819 for (
int i = 0; (weight > 0.001f) && (i < (
int)octaves); i++) {
826 value += weight * signal;
827 weight *= gain * signal;
831 const float rmd = octaves -
floorf(octaves);
832 if ((rmd != 0.0f) && (weight > 0.001f)) {
837 value += rmd * weight * signal;
845 const float lacunarity,
846 const float octaves_unclamped,
851 const float pwHL =
std::pow(lacunarity, -
H);
856 float value = signal;
859 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
861 for (
int i = 1; i < (int)octaves; i++) {
863 weight =
CLAMPIS(signal * gain, 0.0f, 1.0f);
867 value += signal * pwr;
876 const float lacunarity,
877 const float octaves_unclamped)
884 const float pwHL =
std::pow(lacunarity, -
H);
885 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
887 for (
int i = 0; i < (int)octaves; i++) {
893 const float rmd = octaves -
floorf(octaves);
903 const float lacunarity,
904 const float octaves_unclamped)
909 const float pwHL =
std::pow(lacunarity, -
H);
910 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
912 for (
int i = 0; i < (int)octaves; i++) {
918 const float rmd = octaves -
floorf(octaves);
928 const float lacunarity,
929 const float octaves_unclamped,
933 const float pwHL =
std::pow(lacunarity, -
H);
940 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
942 for (
int i = 1; i < (int)octaves; i++) {
949 const float rmd = octaves -
floorf(octaves);
952 value += rmd * increment;
960 const float lacunarity,
961 const float octaves_unclamped,
966 const float pwHL =
std::pow(lacunarity, -
H);
972 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
974 for (
int i = 0; (weight > 0.001f) && (i < (
int)octaves); i++) {
981 value += weight * signal;
982 weight *= gain * signal;
986 const float rmd = octaves -
floorf(octaves);
987 if ((rmd != 0.0f) && (weight > 0.001f)) {
992 value += rmd * weight * signal;
1000 const float lacunarity,
1001 const float octaves_unclamped,
1006 const float pwHL =
std::pow(lacunarity, -
H);
1011 float value = signal;
1012 float weight = 1.0f;
1014 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1016 for (
int i = 1; i < (int)octaves; i++) {
1018 weight =
CLAMPIS(signal * gain, 0.0f, 1.0f);
1022 value += signal * pwr;
1031 const float lacunarity,
1032 const float octaves_unclamped)
1039 const float pwHL =
std::pow(lacunarity, -
H);
1041 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1043 for (
int i = 0; i < (int)octaves; i++) {
1049 const float rmd = octaves -
floorf(octaves);
1059 const float lacunarity,
1060 const float octaves_unclamped)
1065 const float pwHL =
std::pow(lacunarity, -
H);
1067 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1069 for (
int i = 0; i < (int)octaves; i++) {
1075 const float rmd = octaves -
floorf(octaves);
1085 const float lacunarity,
1086 const float octaves_unclamped,
1090 const float pwHL =
std::pow(lacunarity, -
H);
1097 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1099 for (
int i = 1; i < (int)octaves; i++) {
1106 const float rmd = octaves -
floorf(octaves);
1109 value += rmd * increment;
1117 const float lacunarity,
1118 const float octaves_unclamped,
1123 const float pwHL =
std::pow(lacunarity, -
H);
1127 float weight = 1.0f;
1129 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1131 for (
int i = 0; (weight > 0.001f) && (i < (
int)octaves); i++) {
1132 if (weight > 1.0f) {
1138 value += weight * signal;
1139 weight *= gain * signal;
1143 const float rmd = octaves -
floorf(octaves);
1144 if ((rmd != 0.0f) && (weight > 0.001f)) {
1145 if (weight > 1.0f) {
1149 value += rmd * weight * signal;
1157 const float lacunarity,
1158 const float octaves_unclamped,
1163 const float pwHL =
std::pow(lacunarity, -
H);
1168 float value = signal;
1169 float weight = 1.0f;
1171 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1173 for (
int i = 1; i < (int)octaves; i++) {
1175 weight =
CLAMPIS(signal * gain, 0.0f, 1.0f);
1179 value += signal * pwr;
1188 const float lacunarity,
1189 const float octaves_unclamped)
1196 const float pwHL =
std::pow(lacunarity, -
H);
1198 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1200 for (
int i = 0; i < (int)octaves; i++) {
1206 const float rmd = octaves -
floorf(octaves);
1216 const float lacunarity,
1217 const float octaves_unclamped)
1222 const float pwHL =
std::pow(lacunarity, -
H);
1224 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1226 for (
int i = 0; i < (int)octaves; i++) {
1232 const float rmd = octaves -
floorf(octaves);
1242 const float lacunarity,
1243 const float octaves_unclamped,
1247 const float pwHL =
std::pow(lacunarity, -
H);
1254 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1256 for (
int i = 1; i < (int)octaves; i++) {
1263 const float rmd = octaves -
floorf(octaves);
1266 value += rmd * increment;
1274 const float lacunarity,
1275 const float octaves_unclamped,
1280 const float pwHL =
std::pow(lacunarity, -
H);
1284 float weight = 1.0f;
1286 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1288 for (
int i = 0; (weight > 0.001f) && (i < (
int)octaves); i++) {
1289 if (weight > 1.0f) {
1295 value += weight * signal;
1296 weight *= gain * signal;
1300 const float rmd = octaves -
floorf(octaves);
1301 if ((rmd != 0.0f) && (weight > 0.001f)) {
1302 if (weight > 1.0f) {
1306 value += rmd * weight * signal;
1314 const float lacunarity,
1315 const float octaves_unclamped,
1320 const float pwHL =
std::pow(lacunarity, -
H);
1325 float value = signal;
1326 float weight = 1.0f;
1328 const float octaves =
CLAMPIS(octaves_unclamped, 0.0f, 15.0f);
1330 for (
int i = 1; i < (int)octaves; i++) {
1332 weight =
CLAMPIS(signal * gain, 0.0f, 1.0f);
1336 value += signal * pwr;
1381 const float w,
const float randomness,
float *r_distance,
float3 *r_color,
float *r_w)
1383 const float cellPosition =
floorf(
w);
1384 const float localPosition =
w - cellPosition;
1386 float minDistance = 8.0f;
1387 float targetOffset = 0.0f;
1388 float targetPosition = 0.0f;
1389 for (
int i = -1; i <= 1; i++) {
1390 const float cellOffset = i;
1391 const float pointPosition = cellOffset +
1393 const float distanceToPoint =
voronoi_distance(pointPosition, localPosition);
1394 if (distanceToPoint < minDistance) {
1395 targetOffset = cellOffset;
1396 minDistance = distanceToPoint;
1397 targetPosition = pointPosition;
1400 if (r_distance !=
nullptr) {
1401 *r_distance = minDistance;
1403 if (r_color !=
nullptr) {
1406 if (r_w !=
nullptr) {
1407 *r_w = targetPosition + cellPosition;
1412 const float smoothness,
1413 const float randomness,
1418 const float cellPosition =
floorf(
w);
1419 const float localPosition =
w - cellPosition;
1420 const float smoothness_clamped =
max_ff(smoothness, FLT_MIN);
1422 float smoothDistance = 8.0f;
1423 float smoothPosition = 0.0f;
1425 for (
int i = -2; i <= 2; i++) {
1426 const float cellOffset = i;
1427 const float pointPosition = cellOffset +
1429 const float distanceToPoint =
voronoi_distance(pointPosition, localPosition);
1431 0.0f, 1.0f, 0.5f + 0.5f * (smoothDistance - distanceToPoint) / smoothness_clamped);
1432 float correctionFactor = smoothness * h * (1.0f - h);
1433 smoothDistance =
mix(smoothDistance, distanceToPoint, h) - correctionFactor;
1434 if (r_color !=
nullptr || r_w !=
nullptr) {
1435 correctionFactor /= 1.0f + 3.0f * smoothness;
1436 if (r_color !=
nullptr) {
1440 if (r_w !=
nullptr) {
1441 smoothPosition =
mix(smoothPosition, pointPosition, h) - correctionFactor;
1445 if (r_distance !=
nullptr) {
1446 *r_distance = smoothDistance;
1448 if (r_color !=
nullptr) {
1449 *r_color = smoothColor;
1451 if (r_w !=
nullptr) {
1452 *r_w = cellPosition + smoothPosition;
1457 const float w,
const float randomness,
float *r_distance,
float3 *r_color,
float *r_w)
1459 const float cellPosition =
floorf(
w);
1460 const float localPosition =
w - cellPosition;
1462 float distanceF1 = 8.0f;
1463 float distanceF2 = 8.0f;
1464 float offsetF1 = 0.0f;
1465 float positionF1 = 0.0f;
1466 float offsetF2 = 0.0f;
1467 float positionF2 = 0.0f;
1468 for (
int i = -1; i <= 1; i++) {
1469 const float cellOffset = i;
1470 const float pointPosition = cellOffset +
1472 const float distanceToPoint =
voronoi_distance(pointPosition, localPosition);
1473 if (distanceToPoint < distanceF1) {
1474 distanceF2 = distanceF1;
1475 distanceF1 = distanceToPoint;
1476 offsetF2 = offsetF1;
1477 offsetF1 = cellOffset;
1478 positionF2 = positionF1;
1479 positionF1 = pointPosition;
1481 else if (distanceToPoint < distanceF2) {
1482 distanceF2 = distanceToPoint;
1483 offsetF2 = cellOffset;
1484 positionF2 = pointPosition;
1487 if (r_distance !=
nullptr) {
1488 *r_distance = distanceF2;
1490 if (r_color !=
nullptr) {
1493 if (r_w !=
nullptr) {
1494 *r_w = positionF2 + cellPosition;
1500 const float cellPosition =
floorf(
w);
1501 const float localPosition =
w - cellPosition;
1504 const float leftPointPosition = -1.0f +
hash_float_to_float(cellPosition - 1.0f) * randomness;
1505 const float rightPointPosition = 1.0f +
hash_float_to_float(cellPosition + 1.0f) * randomness;
1506 const float distanceToMidLeft =
std::abs((midPointPosition + leftPointPosition) / 2.0f -
1508 const float distanceToMidRight =
std::abs((midPointPosition + rightPointPosition) / 2.0f -
1511 *r_distance =
std::min(distanceToMidLeft, distanceToMidRight);
1516 const float cellPosition =
floorf(
w);
1517 const float localPosition =
w - cellPosition;
1519 float closestPoint = 0.0f;
1520 float closestPointOffset = 0.0f;
1521 float minDistance = 8.0f;
1522 for (
int i = -1; i <= 1; i++) {
1523 const float cellOffset = i;
1524 const float pointPosition = cellOffset +
1526 const float distanceToPoint =
std::abs(pointPosition - localPosition);
1527 if (distanceToPoint < minDistance) {
1528 minDistance = distanceToPoint;
1529 closestPoint = pointPosition;
1530 closestPointOffset = cellOffset;
1535 float closestPointToClosestPoint = 0.0f;
1536 for (
int i = -1; i <= 1; i++) {
1540 const float cellOffset = i + closestPointOffset;
1541 const float pointPosition = cellOffset +
1543 const float distanceToPoint =
std::abs(closestPoint - pointPosition);
1544 if (distanceToPoint < minDistance) {
1545 minDistance = distanceToPoint;
1546 closestPointToClosestPoint = pointPosition;
1549 *r_radius =
std::abs(closestPointToClosestPoint - closestPoint) / 2.0f;
1557 const float exponent)
1578 const float exponent,
1579 const float randomness,
1586 const float2 localPosition = coord - cellPosition;
1588 float minDistance = 8.0f;
1591 for (
int j = -1; j <= 1; j++) {
1592 for (
int i = -1; i <= 1; i++) {
1594 const float2 pointPosition = cellOffset +
1596 float distanceToPoint =
voronoi_distance(pointPosition, localPosition, metric, exponent);
1597 if (distanceToPoint < minDistance) {
1598 targetOffset = cellOffset;
1599 minDistance = distanceToPoint;
1600 targetPosition = pointPosition;
1604 if (r_distance !=
nullptr) {
1605 *r_distance = minDistance;
1607 if (r_color !=
nullptr) {
1610 if (r_position !=
nullptr) {
1611 *r_position = targetPosition + cellPosition;
1616 const float smoothness,
1617 const float exponent,
1618 const float randomness,
1625 const float2 localPosition = coord - cellPosition;
1626 const float smoothness_clamped =
max_ff(smoothness, FLT_MIN);
1628 float smoothDistance = 8.0f;
1631 for (
int j = -2; j <= 2; j++) {
1632 for (
int i = -2; i <= 2; i++) {
1634 const float2 pointPosition = cellOffset +
1637 pointPosition, localPosition, metric, exponent);
1639 0.0f, 1.0f, 0.5f + 0.5f * (smoothDistance - distanceToPoint) / smoothness_clamped);
1640 float correctionFactor = smoothness * h * (1.0f - h);
1641 smoothDistance =
mix(smoothDistance, distanceToPoint, h) - correctionFactor;
1642 if (r_color !=
nullptr || r_position !=
nullptr) {
1643 correctionFactor /= 1.0f + 3.0f * smoothness;
1644 if (r_color !=
nullptr) {
1648 if (r_position !=
nullptr) {
1649 smoothPosition =
math::interpolate(smoothPosition, pointPosition, h) - correctionFactor;
1654 if (r_distance !=
nullptr) {
1655 *r_distance = smoothDistance;
1657 if (r_color !=
nullptr) {
1658 *r_color = smoothColor;
1660 if (r_position !=
nullptr) {
1661 *r_position = cellPosition + smoothPosition;
1666 const float exponent,
1667 const float randomness,
1674 const float2 localPosition = coord - cellPosition;
1676 float distanceF1 = 8.0f;
1677 float distanceF2 = 8.0f;
1682 for (
int j = -1; j <= 1; j++) {
1683 for (
int i = -1; i <= 1; i++) {
1685 const float2 pointPosition = cellOffset +
1688 pointPosition, localPosition, metric, exponent);
1689 if (distanceToPoint < distanceF1) {
1690 distanceF2 = distanceF1;
1691 distanceF1 = distanceToPoint;
1692 offsetF2 = offsetF1;
1693 offsetF1 = cellOffset;
1694 positionF2 = positionF1;
1695 positionF1 = pointPosition;
1697 else if (distanceToPoint < distanceF2) {
1698 distanceF2 = distanceToPoint;
1699 offsetF2 = cellOffset;
1700 positionF2 = pointPosition;
1704 if (r_distance !=
nullptr) {
1705 *r_distance = distanceF2;
1707 if (r_color !=
nullptr) {
1710 if (r_position !=
nullptr) {
1711 *r_position = positionF2 + cellPosition;
1718 const float2 localPosition = coord - cellPosition;
1721 float minDistance = 8.0f;
1722 for (
int j = -1; j <= 1; j++) {
1723 for (
int i = -1; i <= 1; i++) {
1725 const float2 vectorToPoint = cellOffset +
1728 const float distanceToPoint =
math::dot(vectorToPoint, vectorToPoint);
1729 if (distanceToPoint < minDistance) {
1730 minDistance = distanceToPoint;
1731 vectorToClosest = vectorToPoint;
1737 for (
int j = -1; j <= 1; j++) {
1738 for (
int i = -1; i <= 1; i++) {
1740 const float2 vectorToPoint = cellOffset +
1743 const float2 perpendicularToEdge = vectorToPoint - vectorToClosest;
1744 if (
math::dot(perpendicularToEdge, perpendicularToEdge) > 0.0001f) {
1745 const float distanceToEdge =
math::dot((vectorToClosest + vectorToPoint) / 2.0f,
1747 minDistance =
std::min(minDistance, distanceToEdge);
1751 *r_distance = minDistance;
1757 const float2 localPosition = coord - cellPosition;
1761 float minDistance = 8.0f;
1762 for (
int j = -1; j <= 1; j++) {
1763 for (
int i = -1; i <= 1; i++) {
1765 const float2 pointPosition = cellOffset +
1767 const float distanceToPoint =
math::distance(pointPosition, localPosition);
1768 if (distanceToPoint < minDistance) {
1769 minDistance = distanceToPoint;
1770 closestPoint = pointPosition;
1771 closestPointOffset = cellOffset;
1777 float2 closestPointToClosestPoint =
float2(0.0f, 0.0f);
1778 for (
int j = -1; j <= 1; j++) {
1779 for (
int i = -1; i <= 1; i++) {
1780 if (i == 0 && j == 0) {
1783 const float2 cellOffset =
float2(i, j) + closestPointOffset;
1784 const float2 pointPosition = cellOffset +
1786 const float distanceToPoint =
math::distance(closestPoint, pointPosition);
1787 if (distanceToPoint < minDistance) {
1788 minDistance = distanceToPoint;
1789 closestPointToClosestPoint = pointPosition;
1793 *r_radius =
math::distance(closestPointToClosestPoint, closestPoint) / 2.0f;
1801 const float exponent)
1823 const float exponent,
1824 const float randomness,
1831 const float3 localPosition = coord - cellPosition;
1833 float minDistance = 8.0f;
1836 for (
int k = -1; k <= 1; k++) {
1837 for (
int j = -1; j <= 1; j++) {
1838 for (
int i = -1; i <= 1; i++) {
1840 const float3 pointPosition = cellOffset +
1843 pointPosition, localPosition, metric, exponent);
1844 if (distanceToPoint < minDistance) {
1845 targetOffset = cellOffset;
1846 minDistance = distanceToPoint;
1847 targetPosition = pointPosition;
1852 if (r_distance !=
nullptr) {
1853 *r_distance = minDistance;
1855 if (r_color !=
nullptr) {
1858 if (r_position !=
nullptr) {
1859 *r_position = targetPosition + cellPosition;
1864 const float smoothness,
1865 const float exponent,
1866 const float randomness,
1873 const float3 localPosition = coord - cellPosition;
1874 const float smoothness_clamped =
max_ff(smoothness, FLT_MIN);
1876 float smoothDistance = 8.0f;
1879 for (
int k = -2; k <= 2; k++) {
1880 for (
int j = -2; j <= 2; j++) {
1881 for (
int i = -2; i <= 2; i++) {
1883 const float3 pointPosition = cellOffset +
1886 pointPosition, localPosition, metric, exponent);
1888 0.0f, 1.0f, 0.5f + 0.5f * (smoothDistance - distanceToPoint) / smoothness_clamped);
1889 float correctionFactor = smoothness * h * (1.0f - h);
1890 smoothDistance =
mix(smoothDistance, distanceToPoint, h) - correctionFactor;
1891 if (r_color !=
nullptr || r_position !=
nullptr) {
1892 correctionFactor /= 1.0f + 3.0f * smoothness;
1893 if (r_color !=
nullptr) {
1897 if (r_position !=
nullptr) {
1905 if (r_distance !=
nullptr) {
1906 *r_distance = smoothDistance;
1908 if (r_color !=
nullptr) {
1909 *r_color = smoothColor;
1911 if (r_position !=
nullptr) {
1912 *r_position = cellPosition + smoothPosition;
1917 const float exponent,
1918 const float randomness,
1925 const float3 localPosition = coord - cellPosition;
1927 float distanceF1 = 8.0f;
1928 float distanceF2 = 8.0f;
1933 for (
int k = -1; k <= 1; k++) {
1934 for (
int j = -1; j <= 1; j++) {
1935 for (
int i = -1; i <= 1; i++) {
1937 const float3 pointPosition = cellOffset +
1940 pointPosition, localPosition, metric, exponent);
1941 if (distanceToPoint < distanceF1) {
1942 distanceF2 = distanceF1;
1943 distanceF1 = distanceToPoint;
1944 offsetF2 = offsetF1;
1945 offsetF1 = cellOffset;
1946 positionF2 = positionF1;
1947 positionF1 = pointPosition;
1949 else if (distanceToPoint < distanceF2) {
1950 distanceF2 = distanceToPoint;
1951 offsetF2 = cellOffset;
1952 positionF2 = pointPosition;
1957 if (r_distance !=
nullptr) {
1958 *r_distance = distanceF2;
1960 if (r_color !=
nullptr) {
1963 if (r_position !=
nullptr) {
1964 *r_position = positionF2 + cellPosition;
1971 const float3 localPosition = coord - cellPosition;
1974 float minDistance = 8.0f;
1975 for (
int k = -1; k <= 1; k++) {
1976 for (
int j = -1; j <= 1; j++) {
1977 for (
int i = -1; i <= 1; i++) {
1979 const float3 vectorToPoint = cellOffset +
1982 const float distanceToPoint =
math::dot(vectorToPoint, vectorToPoint);
1983 if (distanceToPoint < minDistance) {
1984 minDistance = distanceToPoint;
1985 vectorToClosest = vectorToPoint;
1992 for (
int k = -1; k <= 1; k++) {
1993 for (
int j = -1; j <= 1; j++) {
1994 for (
int i = -1; i <= 1; i++) {
1996 const float3 vectorToPoint = cellOffset +
1999 const float3 perpendicularToEdge = vectorToPoint - vectorToClosest;
2000 if (
math::dot(perpendicularToEdge, perpendicularToEdge) > 0.0001f) {
2001 const float distanceToEdge =
math::dot((vectorToClosest + vectorToPoint) / 2.0f,
2003 minDistance =
std::min(minDistance, distanceToEdge);
2008 *r_distance = minDistance;
2014 const float3 localPosition = coord - cellPosition;
2018 float minDistance = 8.0f;
2019 for (
int k = -1; k <= 1; k++) {
2020 for (
int j = -1; j <= 1; j++) {
2021 for (
int i = -1; i <= 1; i++) {
2023 const float3 pointPosition = cellOffset +
2025 const float distanceToPoint =
math::distance(pointPosition, localPosition);
2026 if (distanceToPoint < minDistance) {
2027 minDistance = distanceToPoint;
2028 closestPoint = pointPosition;
2029 closestPointOffset = cellOffset;
2036 float3 closestPointToClosestPoint =
float3(0.0f, 0.0f, 0.0f);
2037 for (
int k = -1; k <= 1; k++) {
2038 for (
int j = -1; j <= 1; j++) {
2039 for (
int i = -1; i <= 1; i++) {
2040 if (i == 0 && j == 0 && k == 0) {
2043 const float3 cellOffset =
float3(i, j, k) + closestPointOffset;
2044 const float3 pointPosition = cellOffset +
2046 const float distanceToPoint =
math::distance(closestPoint, pointPosition);
2047 if (distanceToPoint < minDistance) {
2048 minDistance = distanceToPoint;
2049 closestPointToClosestPoint = pointPosition;
2054 *r_radius =
math::distance(closestPointToClosestPoint, closestPoint) / 2.0f;
2062 const float exponent)
2086 const float exponent,
2087 const float randomness,
2094 const float4 localPosition = coord - cellPosition;
2096 float minDistance = 8.0f;
2098 float4 targetPosition =
float4(0.0f, 0.0f, 0.0f, 0.0f);
2099 for (
int u = -1; u <= 1; u++) {
2100 for (
int k = -1; k <= 1; k++) {
2101 for (
int j = -1; j <= 1; j++) {
2102 for (
int i = -1; i <= 1; i++) {
2104 const float4 pointPosition = cellOffset +
2108 pointPosition, localPosition, metric, exponent);
2109 if (distanceToPoint < minDistance) {
2110 targetOffset = cellOffset;
2111 minDistance = distanceToPoint;
2112 targetPosition = pointPosition;
2118 if (r_distance !=
nullptr) {
2119 *r_distance = minDistance;
2121 if (r_color !=
nullptr) {
2124 if (r_position !=
nullptr) {
2125 *r_position = targetPosition + cellPosition;
2130 const float smoothness,
2131 const float exponent,
2132 const float randomness,
2139 const float4 localPosition = coord - cellPosition;
2140 const float smoothness_clamped =
max_ff(smoothness, FLT_MIN);
2142 float smoothDistance = 8.0f;
2144 float4 smoothPosition =
float4(0.0f, 0.0f, 0.0f, 0.0f);
2145 for (
int u = -2; u <= 2; u++) {
2146 for (
int k = -2; k <= 2; k++) {
2147 for (
int j = -2; j <= 2; j++) {
2148 for (
int i = -2; i <= 2; i++) {
2150 const float4 pointPosition = cellOffset +
2154 pointPosition, localPosition, metric, exponent);
2156 0.0f, 1.0f, 0.5f + 0.5f * (smoothDistance - distanceToPoint) / smoothness_clamped);
2157 float correctionFactor = smoothness * h * (1.0f - h);
2158 smoothDistance =
mix(smoothDistance, distanceToPoint, h) - correctionFactor;
2159 if (r_color !=
nullptr || r_position !=
nullptr) {
2160 correctionFactor /= 1.0f + 3.0f * smoothness;
2161 if (r_color !=
nullptr) {
2165 if (r_position !=
nullptr) {
2174 if (r_distance !=
nullptr) {
2175 *r_distance = smoothDistance;
2177 if (r_color !=
nullptr) {
2178 *r_color = smoothColor;
2180 if (r_position !=
nullptr) {
2181 *r_position = cellPosition + smoothPosition;
2186 const float exponent,
2187 const float randomness,
2194 const float4 localPosition = coord - cellPosition;
2196 float distanceF1 = 8.0f;
2197 float distanceF2 = 8.0f;
2202 for (
int u = -1; u <= 1; u++) {
2203 for (
int k = -1; k <= 1; k++) {
2204 for (
int j = -1; j <= 1; j++) {
2205 for (
int i = -1; i <= 1; i++) {
2207 const float4 pointPosition = cellOffset +
2211 pointPosition, localPosition, metric, exponent);
2212 if (distanceToPoint < distanceF1) {
2213 distanceF2 = distanceF1;
2214 distanceF1 = distanceToPoint;
2215 offsetF2 = offsetF1;
2216 offsetF1 = cellOffset;
2217 positionF2 = positionF1;
2218 positionF1 = pointPosition;
2220 else if (distanceToPoint < distanceF2) {
2221 distanceF2 = distanceToPoint;
2222 offsetF2 = cellOffset;
2223 positionF2 = pointPosition;
2229 if (r_distance !=
nullptr) {
2230 *r_distance = distanceF2;
2232 if (r_color !=
nullptr) {
2235 if (r_position !=
nullptr) {
2236 *r_position = positionF2 + cellPosition;
2243 const float4 localPosition = coord - cellPosition;
2245 float4 vectorToClosest =
float4(0.0f, 0.0f, 0.0f, 0.0f);
2246 float minDistance = 8.0f;
2247 for (
int u = -1; u <= 1; u++) {
2248 for (
int k = -1; k <= 1; k++) {
2249 for (
int j = -1; j <= 1; j++) {
2250 for (
int i = -1; i <= 1; i++) {
2252 const float4 vectorToPoint = cellOffset +
2256 const float distanceToPoint =
math::dot(vectorToPoint, vectorToPoint);
2257 if (distanceToPoint < minDistance) {
2258 minDistance = distanceToPoint;
2259 vectorToClosest = vectorToPoint;
2267 for (
int u = -1; u <= 1; u++) {
2268 for (
int k = -1; k <= 1; k++) {
2269 for (
int j = -1; j <= 1; j++) {
2270 for (
int i = -1; i <= 1; i++) {
2272 const float4 vectorToPoint = cellOffset +
2276 const float4 perpendicularToEdge = vectorToPoint - vectorToClosest;
2277 if (
math::dot(perpendicularToEdge, perpendicularToEdge) > 0.0001f) {
2278 const float distanceToEdge =
math::dot((vectorToClosest + vectorToPoint) / 2.0f,
2280 minDistance =
std::min(minDistance, distanceToEdge);
2286 *r_distance = minDistance;
2292 const float4 localPosition = coord - cellPosition;
2295 float4 closestPointOffset =
float4(0.0f, 0.0f, 0.0f, 0.0f);
2296 float minDistance = 8.0f;
2297 for (
int u = -1; u <= 1; u++) {
2298 for (
int k = -1; k <= 1; k++) {
2299 for (
int j = -1; j <= 1; j++) {
2300 for (
int i = -1; i <= 1; i++) {
2302 const float4 pointPosition = cellOffset +
2305 const float distanceToPoint =
math::distance(pointPosition, localPosition);
2306 if (distanceToPoint < minDistance) {
2307 minDistance = distanceToPoint;
2308 closestPoint = pointPosition;
2309 closestPointOffset = cellOffset;
2317 float4 closestPointToClosestPoint =
float4(0.0f, 0.0f, 0.0f, 0.0f);
2318 for (
int u = -1; u <= 1; u++) {
2319 for (
int k = -1; k <= 1; k++) {
2320 for (
int j = -1; j <= 1; j++) {
2321 for (
int i = -1; i <= 1; i++) {
2322 if (i == 0 && j == 0 && k == 0 && u == 0) {
2325 const float4 cellOffset =
float4(i, j, k, u) + closestPointOffset;
2326 const float4 pointPosition = cellOffset +
2329 const float distanceToPoint =
math::distance(closestPoint, pointPosition);
2330 if (distanceToPoint < minDistance) {
2331 minDistance = distanceToPoint;
2332 closestPointToClosestPoint = pointPosition;
2338 *r_radius =
math::distance(closestPointToClosestPoint, closestPoint) / 2.0f;
#define BLI_assert_unreachable()
MINLINE float max_ff(float a, float b)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static T sum(const btAlignedObjectArray< T > &items)
static unsigned long seed
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
MINLINE float smoothstep(float edge0, float edge1, float x)
ccl_device_inline float3 pow(float3 v, float e)
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
T distance(const T &a, const T &b)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)
T interpolate(const T &a, const T &b, const FactorT &t)
void voronoi_n_sphere_radius(float w, float randomness, float *r_radius)
void voronoi_smooth_f1(float w, float smoothness, float randomness, float *r_distance, float3 *r_color, float *r_w)
float perlin_fractal_distorted(float position, float octaves, float roughness, float distortion)
BLI_INLINE float negate_if(float value, uint32_t condition)
float perlin_fractal(float position, float octaves, float roughness)
BLI_INLINE float uint_to_float_01(uint32_t k)
void voronoi_distance_to_edge(float w, float randomness, float *r_distance)
BLI_INLINE float mix(float v0, float v1, float x)
uint32_t hash_float(float kx)
BLI_INLINE float perlin_distortion(float position, float strength)
float hash_float_to_float(float k)
float perlin_signed(float position)
BLI_INLINE void hash_bit_mix(uint32_t &a, uint32_t &b, uint32_t &c)
BLI_INLINE float voronoi_distance(const float a, const float b)
BLI_INLINE float fade(float t)
float perlin(float position)
BLI_INLINE float random_float_offset(float seed)
BLI_INLINE float floor_fraction(float x, int &i)
BLI_INLINE uint32_t float_as_uint(float f)
BLI_INLINE float3 random_float3_offset(float seed)
float musgrave_multi_fractal(float co, float H, float lacunarity, float octaves)
float musgrave_ridged_multi_fractal(float co, float H, float lacunarity, float octaves, float offset, float gain)
BLI_INLINE float2 random_float2_offset(float seed)
float musgrave_fBm(float co, float H, float lacunarity, float octaves)
float musgrave_hybrid_multi_fractal(float co, float H, float lacunarity, float octaves, float offset, float gain)
float3 hash_float_to_float3(float k)
uint32_t hash(uint32_t kx)
BLI_INLINE float4 random_float4_offset(float seed)
BLI_INLINE float perlin_noise(float position)
float musgrave_hetero_terrain(float co, float H, float lacunarity, float octaves, float offset)
BLI_INLINE void hash_bit_final(uint32_t &a, uint32_t &b, uint32_t &c)
float4 hash_float_to_float4(float4 k)
float perlin_fractal_template(T position, float octaves, float roughness)
void voronoi_f1(float w, float randomness, float *r_distance, float3 *r_color, float *r_w)
BLI_INLINE float noise_grad(uint32_t hash, float x)
float3 perlin_float3_fractal_distorted(float position, float octaves, float roughness, float distortion)
BLI_INLINE uint32_t hash_bit_rotate(uint32_t x, uint32_t k)
@ NOISE_SHD_VORONOI_MANHATTAN
@ NOISE_SHD_VORONOI_MINKOWSKI
@ NOISE_SHD_VORONOI_EUCLIDEAN
@ NOISE_SHD_VORONOI_CHEBYCHEV
float2 hash_float_to_float2(float2 k)
void voronoi_f2(float w, float randomness, float *r_distance, float3 *r_color, float *r_w)
float hash_to_float(uint32_t kx)
vec_base< float, 3 > float3
vec_base< float, 4 > float4
vec_base< float, 2 > float2
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
static const pxr::TfToken roughness("roughness", pxr::TfToken::Immortal)