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:
authorClément Foucault <foucault.clem@gmail.com>2022-01-27 23:35:36 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-01-27 23:35:43 +0300
commit423bbbbaaec7673f11fe69bef56d377fc532f531 (patch)
tree19262a51721952eb63323235ee03e32c03de6c8e /source/blender/blenlib
parent3775615aeaf9d7f821053c9c19ee317233e9bd0a (diff)
BLI_float4x4: Add operator[]
This makes porting existing code using `float[4][4]` easier.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_float4x4.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float4x4.hh b/source/blender/blenlib/BLI_float4x4.hh
index 81c969d02d0..f451f58f6cf 100644
--- a/source/blender/blenlib/BLI_float4x4.hh
+++ b/source/blender/blenlib/BLI_float4x4.hh
@@ -107,6 +107,20 @@ struct float4x4 {
return &values[0][0];
}
+ float *operator[](const int64_t index)
+ {
+ BLI_assert(index >= 0);
+ BLI_assert(index < 4);
+ return &values[index][0];
+ }
+
+ const float *operator[](const int64_t index) const
+ {
+ BLI_assert(index >= 0);
+ BLI_assert(index < 4);
+ return &values[index][0];
+ }
+
using c_style_float4x4 = float[4][4];
c_style_float4x4 &ptr()
{