diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-10 08:28:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 08:28:08 +0100 |
commit | 8e056ba2034caa9f69d242eb97eff54ce3760813 (patch) | |
tree | 4fa6ebf28401601e03b0ce2b387f60c32b771fb5 /core/math | |
parent | efc4d217d61f592a16ebab30731ff9f595dee2cf (diff) | |
parent | 0f249f5c0aa2c3a89848f03f155b76e834e4c32a (diff) |
Merge pull request #43417 from akien-mga/variant-default-constructors-docs
Variant: Sync docs with new constructors, fixes to #43403
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/color.h | 15 | ||||
-rw-r--r-- | core/math/color_names.inc | 10 | ||||
-rw-r--r-- | core/math/transform.cpp | 7 | ||||
-rw-r--r-- | core/math/transform.h | 5 |
4 files changed, 28 insertions, 9 deletions
diff --git a/core/math/color.h b/core/math/color.h index 94502a79bf..a9be9e9035 100644 --- a/core/math/color.h +++ b/core/math/color.h @@ -209,9 +209,10 @@ struct Color { _FORCE_INLINE_ Color() {} /** - * RGB / RGBA construct parameters. Alpha is optional, but defaults to 1.0 + * RGBA construct parameters. + * Alpha is not optional as otherwise we can't bind the RGB version for scripting. */ - _FORCE_INLINE_ Color(float p_r, float p_g, float p_b, float p_a = 1.0) { + _FORCE_INLINE_ Color(float p_r, float p_g, float p_b, float p_a) { r = p_r; g = p_g; b = p_b; @@ -219,6 +220,16 @@ struct Color { } /** + * RGB construct parameters. + */ + _FORCE_INLINE_ Color(float p_r, float p_g, float p_b) { + r = p_r; + g = p_g; + b = p_b; + a = 1.0; + } + + /** * Construct a Color from another Color, but with the specified alpha value. */ _FORCE_INLINE_ Color(const Color &p_c, float p_a) { diff --git a/core/math/color_names.inc b/core/math/color_names.inc index cbc821026e..523c7e3c59 100644 --- a/core/math/color_names.inc +++ b/core/math/color_names.inc @@ -61,9 +61,7 @@ static NamedColor named_colors[] = { { "gold", Color(1.00, 0.84, 0.00) }, { "goldenrod", Color(0.85, 0.65, 0.13) }, { "gray", Color(0.75, 0.75, 0.75) }, - { "webgray", Color(0.50, 0.50, 0.50) }, { "green", Color(0.00, 1.00, 0.00) }, - { "webgreen", Color(0.00, 0.50, 0.00) }, { "greenyellow", Color(0.68, 1.00, 0.18) }, { "honeydew", Color(0.94, 1.00, 0.94) }, { "hotpink", Color(1.00, 0.41, 0.71) }, @@ -93,7 +91,6 @@ static NamedColor named_colors[] = { { "linen", Color(0.98, 0.94, 0.90) }, { "magenta", Color(1.00, 0.00, 1.00) }, { "maroon", Color(0.69, 0.19, 0.38) }, - { "webmaroon", Color(0.50, 0.00, 0.00) }, { "mediumaquamarine", Color(0.40, 0.80, 0.67) }, { "mediumblue", Color(0.00, 0.00, 0.80) }, { "mediumorchid", Color(0.73, 0.33, 0.83) }, @@ -126,7 +123,6 @@ static NamedColor named_colors[] = { { "plum", Color(0.87, 0.63, 0.87) }, { "powderblue", Color(0.69, 0.88, 0.90) }, { "purple", Color(0.63, 0.13, 0.94) }, - { "webpurple", Color(0.50, 0.00, 0.50) }, { "rebeccapurple", Color(0.40, 0.20, 0.60) }, { "red", Color(1.00, 0.00, 0.00) }, { "rosybrown", Color(0.74, 0.56, 0.56) }, @@ -148,9 +144,13 @@ static NamedColor named_colors[] = { { "teal", Color(0.00, 0.50, 0.50) }, { "thistle", Color(0.85, 0.75, 0.85) }, { "tomato", Color(1.00, 0.39, 0.28) }, - { "turquoise", Color(0.25, 0.88, 0.82) }, { "transparent", Color(1.00, 1.00, 1.00, 0.00) }, + { "turquoise", Color(0.25, 0.88, 0.82) }, { "violet", Color(0.93, 0.51, 0.93) }, + { "webgray", Color(0.50, 0.50, 0.50) }, + { "webgreen", Color(0.00, 0.50, 0.00) }, + { "webmaroon", Color(0.50, 0.00, 0.00) }, + { "webpurple", Color(0.50, 0.00, 0.50) }, { "wheat", Color(0.96, 0.87, 0.70) }, { "white", Color(1.00, 1.00, 1.00) }, { "whitesmoke", Color(0.96, 0.96, 0.96) }, diff --git a/core/math/transform.cpp b/core/math/transform.cpp index d36fd6a63d..733bb4d55e 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -200,6 +200,13 @@ Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) : origin(p_origin) { } +Transform::Transform(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin) : + origin(p_origin) { + basis.set_axis(0, p_x); + basis.set_axis(1, p_y); + basis.set_axis(2, p_z); +} + Transform::Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz) { basis = Basis(xx, xy, xz, yx, yy, yz, zx, zy, zz); origin = Vector3(ox, oy, oz); diff --git a/core/math/transform.h b/core/math/transform.h index 71847d36ac..c63dbcb989 100644 --- a/core/math/transform.h +++ b/core/math/transform.h @@ -106,9 +106,10 @@ public: operator String() const; - Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz); - Transform(const Basis &p_basis, const Vector3 &p_origin = Vector3()); Transform() {} + Transform(const Basis &p_basis, const Vector3 &p_origin = Vector3()); + Transform(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin); + Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz); }; _FORCE_INLINE_ Vector3 Transform::xform(const Vector3 &p_vector) const { |