Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Jolly <charlie>2021-10-15 17:27:16 +0300
committerCharlie Jolly <mistajolly@gmail.com>2021-10-15 17:28:20 +0300
commit104887800c0f221fbcffa84bb360dd9ff001d7f1 (patch)
tree743a308c6eda1918e4e97df0d8ba32b7046bedf7 /source/blender/blenlib/BLI_float3.hh
parent6e4ab5b761b03b52177985ecbeb2c2f576159c74 (diff)
Geometry Nodes: Add Voronoi Texture
Port shader Voronoi to GN Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D12725
Diffstat (limited to 'source/blender/blenlib/BLI_float3.hh')
-rw-r--r--source/blender/blenlib/BLI_float3.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh
index 04aae375889..8263ef72584 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -80,6 +80,11 @@ struct float3 {
return {-a.x, -a.y, -a.z};
}
+ friend float3 operator-(const float3 &a, const float &b)
+ {
+ return {a.x - b, a.y - b, a.z - b};
+ }
+
float3 &operator-=(const float3 &b)
{
this->x -= b.x;
@@ -218,6 +223,16 @@ struct float3 {
return result;
}
+ static float3 safe_divide(const float3 &a, const float b)
+ {
+ return (b != 0.0f) ? a / b : float3(0.0f);
+ }
+
+ static float3 floor(const float3 &a)
+ {
+ return float3(floorf(a.x), floorf(a.y), floorf(a.z));
+ }
+
void invert()
{
x = -x;