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:
authorJacques Lucke <jacques@blender.org>2021-01-14 20:02:59 +0300
committerJacques Lucke <jacques@blender.org>2021-01-14 20:02:59 +0300
commit5c1b740f1ee254ba30be4c39d5222ad3eb8b0871 (patch)
tree2c8c01e9008a7d69fc5015a2330747256cd1d3c2 /source/blender/blenlib/BLI_float2.hh
parent406d74769597e318117ad5b3837e7283d9fd2aa5 (diff)
Geometry Nodes: add implicit conversions for float2 and others
Some of these conversions are arbitrary to some degree. However, the user experience is better when at least something happens when converting between types, instead of just getting zeros. I left out a few conversions that I wasn't sure about yet. I also added conversions for float2.
Diffstat (limited to 'source/blender/blenlib/BLI_float2.hh')
-rw-r--r--source/blender/blenlib/BLI_float2.hh13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index 2a5320e4c35..84dd0e358a2 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -29,6 +29,14 @@ struct float2 {
{
}
+ explicit float2(float value) : x(value), y(value)
+ {
+ }
+
+ explicit float2(int value) : x(value), y(value)
+ {
+ }
+
float2(float x, float y) : x(x), y(y)
{
}
@@ -52,6 +60,11 @@ struct float2 {
return len_v2(*this);
}
+ float length_squared() const
+ {
+ return len_squared_v2(*this);
+ }
+
float2 &operator+=(const float2 &other)
{
x += other.x;