summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/marshalls.cpp4
-rw-r--r--core/io/resource_format_binary.cpp4
-rw-r--r--core/math/camera_matrix.cpp12
-rw-r--r--core/math/geometry.cpp4
-rw-r--r--core/math/math_fieldwise.cpp2
-rw-r--r--core/math/plane.cpp18
-rw-r--r--core/math/plane.h30
-rw-r--r--core/math/transform.h4
-rw-r--r--core/self_list.h3
-rw-r--r--core/variant.cpp4
-rw-r--r--core/variant_op.cpp146
-rw-r--r--core/variant_parser.cpp2
-rw-r--r--doc/classes/Engine.xml4
-rw-r--r--doc/classes/Node.xml2
-rw-r--r--doc/classes/Plane.xml6
-rw-r--r--doc/classes/Vector3.xml2
-rw-r--r--doc/classes/VisualShaderNodeInput.xml4
-rw-r--r--doc/classes/VisualShaderNodeIs.xml5
-rw-r--r--doc/classes/VisualShaderNodeOuterProduct.xml2
-rw-r--r--doc/classes/VisualShaderNodeOutput.xml2
-rw-r--r--doc/classes/VisualShaderNodeScalarClamp.xml2
-rw-r--r--doc/classes/VisualShaderNodeScalarDerivativeFunc.xml6
-rw-r--r--doc/classes/VisualShaderNodeScalarInterp.xml2
-rw-r--r--doc/classes/VisualShaderNodeScalarSmoothStep.xml3
-rw-r--r--doc/classes/VisualShaderNodeScalarSwitch.xml2
-rw-r--r--doc/classes/VisualShaderNodeSwitch.xml2
-rw-r--r--doc/classes/VisualShaderNodeTexture.xml14
-rw-r--r--doc/classes/VisualShaderNodeTextureUniform.xml10
-rw-r--r--doc/classes/VisualShaderNodeTextureUniformTriplanar.xml2
-rw-r--r--doc/classes/VisualShaderNodeTransformCompose.xml2
-rw-r--r--doc/classes/VisualShaderNodeTransformConstant.xml3
-rw-r--r--doc/classes/VisualShaderNodeTransformDecompose.xml2
-rw-r--r--doc/classes/VisualShaderNodeTransformFunc.xml5
-rw-r--r--doc/classes/VisualShaderNodeTransformMult.xml7
-rw-r--r--doc/classes/VisualShaderNodeTransformUniform.xml2
-rw-r--r--doc/classes/VisualShaderNodeTransformVecMult.xml7
-rw-r--r--doc/classes/VisualShaderNodeUniform.xml3
-rw-r--r--doc/classes/VisualShaderNodeVec3Constant.xml3
-rw-r--r--doc/classes/VisualShaderNodeVec3Uniform.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorClamp.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorCompose.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorDecompose.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorDerivativeFunc.xml6
-rw-r--r--doc/classes/VisualShaderNodeVectorDistance.xml3
-rw-r--r--doc/classes/VisualShaderNodeVectorFunc.xml38
-rw-r--r--doc/classes/VisualShaderNodeVectorInterp.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorLen.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorOp.xml15
-rw-r--r--doc/classes/VisualShaderNodeVectorRefract.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorScalarMix.xml2
-rw-r--r--doc/classes/VisualShaderNodeVectorScalarSmoothStep.xml3
-rw-r--r--doc/classes/VisualShaderNodeVectorScalarStep.xml3
-rw-r--r--doc/classes/VisualShaderNodeVectorSmoothStep.xml3
-rw-r--r--editor/editor_properties.cpp4
-rw-r--r--editor/import/editor_import_collada.cpp6
-rw-r--r--editor/node_3d_editor_gizmos.cpp12
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp4
-rw-r--r--editor/property_editor.cpp4
-rw-r--r--main/tests/test_math.cpp2
-rw-r--r--modules/bullet/shape_bullet.cpp2
-rw-r--r--modules/gdnative/gdnative/plane.cpp12
-rw-r--r--modules/gdnative/gdnative_api.json4
-rw-r--r--modules/gdnative/include/gdnative/plane.h4
-rw-r--r--modules/gdnavigation/nav_map.cpp2
-rw-r--r--modules/gdscript/gdscript.cpp49
-rw-r--r--modules/gdscript/gdscript.h8
-rw-r--r--modules/gdscript/gdscript_function.cpp83
-rw-r--r--modules/gdscript/gdscript_function.h11
-rw-r--r--modules/gdscript/gdscript_functions.cpp5
-rw-r--r--modules/gdscript/gdscript_parser.cpp58
-rw-r--r--modules/gdscript/gdscript_parser.h3
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp24
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs46
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs18
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h8
-rw-r--r--scene/3d/camera_3d.cpp2
-rw-r--r--scene/3d/xr_nodes.cpp2
-rw-r--r--scene/resources/capsule_shape_2d.cpp3
-rw-r--r--scene/resources/curve.cpp4
-rw-r--r--scene/resources/mesh.cpp2
-rw-r--r--scene/resources/mesh_data_tool.cpp2
-rw-r--r--scene/resources/surface_tool.cpp6
-rw-r--r--scene/resources/world_margin_shape_3d.cpp12
-rw-r--r--servers/physics_3d/collision_solver_3d_sat.cpp2
-rw-r--r--servers/register_server_types.cpp1
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp2
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp4
88 files changed, 586 insertions, 253 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index 81bc45b2f7..1396683d25 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -277,7 +277,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
val.normal.x = decode_float(&buf[0]);
val.normal.y = decode_float(&buf[4]);
val.normal.z = decode_float(&buf[8]);
- val.d = decode_float(&buf[12]);
+ val.distance = decode_float(&buf[12]);
r_variant = val;
if (r_len)
@@ -1140,7 +1140,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
encode_float(p.normal.x, &buf[0]);
encode_float(p.normal.y, &buf[4]);
encode_float(p.normal.z, &buf[8]);
- encode_float(p.d, &buf[12]);
+ encode_float(p.distance, &buf[12]);
}
r_len += 4 * 4;
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 8c7559479b..5907143810 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -214,7 +214,7 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
v.normal.x = f->get_real();
v.normal.y = f->get_real();
v.normal.z = f->get_real();
- v.d = f->get_real();
+ v.distance = f->get_real();
r_v = v;
} break;
case VARIANT_QUAT: {
@@ -1458,7 +1458,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
f->store_real(val.normal.x);
f->store_real(val.normal.y);
f->store_real(val.normal.z);
- f->store_real(val.d);
+ f->store_real(val.distance);
} break;
case Variant::QUAT: {
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index c36070e47f..d2b20ac514 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -59,10 +59,10 @@ Plane CameraMatrix::xform4(const Plane &p_vec4) const {
Plane ret;
- ret.normal.x = matrix[0][0] * p_vec4.normal.x + matrix[1][0] * p_vec4.normal.y + matrix[2][0] * p_vec4.normal.z + matrix[3][0] * p_vec4.d;
- ret.normal.y = matrix[0][1] * p_vec4.normal.x + matrix[1][1] * p_vec4.normal.y + matrix[2][1] * p_vec4.normal.z + matrix[3][1] * p_vec4.d;
- ret.normal.z = matrix[0][2] * p_vec4.normal.x + matrix[1][2] * p_vec4.normal.y + matrix[2][2] * p_vec4.normal.z + matrix[3][2] * p_vec4.d;
- ret.d = matrix[0][3] * p_vec4.normal.x + matrix[1][3] * p_vec4.normal.y + matrix[2][3] * p_vec4.normal.z + matrix[3][3] * p_vec4.d;
+ ret.normal.x = matrix[0][0] * p_vec4.normal.x + matrix[1][0] * p_vec4.normal.y + matrix[2][0] * p_vec4.normal.z + matrix[3][0] * p_vec4.distance;
+ ret.normal.y = matrix[0][1] * p_vec4.normal.x + matrix[1][1] * p_vec4.normal.y + matrix[2][1] * p_vec4.normal.z + matrix[3][1] * p_vec4.distance;
+ ret.normal.z = matrix[0][2] * p_vec4.normal.x + matrix[1][2] * p_vec4.normal.y + matrix[2][2] * p_vec4.normal.z + matrix[3][2] * p_vec4.distance;
+ ret.distance = matrix[0][3] * p_vec4.normal.x + matrix[1][3] * p_vec4.normal.y + matrix[2][3] * p_vec4.normal.z + matrix[3][3] * p_vec4.distance;
return ret;
}
@@ -233,7 +233,7 @@ real_t CameraMatrix::get_z_far() const {
new_plane.normal = -new_plane.normal;
new_plane.normalize();
- return new_plane.d;
+ return new_plane.distance;
}
real_t CameraMatrix::get_z_near() const {
@@ -244,7 +244,7 @@ real_t CameraMatrix::get_z_near() const {
-matrix[15] - matrix[14]);
new_plane.normalize();
- return new_plane.d;
+ return new_plane.distance;
}
Vector2 CameraMatrix::get_viewport_half_extents() const {
diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp
index fa96fc4535..d55ede9fe0 100644
--- a/core/math/geometry.cpp
+++ b/core/math/geometry.cpp
@@ -780,7 +780,7 @@ Geometry::MeshData Geometry::build_convex_mesh(const Vector<Plane> &p_planes) {
if (Math::is_zero_approx(den))
continue; // Point too short.
- real_t dist = -(clip.normal.dot(edge0_A) - clip.d) / den;
+ real_t dist = -(clip.normal.dot(edge0_A) - clip.distance) / den;
Vector3 inters = edge0_A + rel * dist;
new_vertices.push_back(inters);
}
@@ -1199,7 +1199,7 @@ Vector<Vector3> Geometry::compute_convex_mesh_points(const Plane *p_planes, int
for (int n = 0; n < p_plane_count; n++) {
if (n != i && n != j && n != k) {
real_t dp = p_planes[n].normal.dot(convex_shape_point);
- if (dp - p_planes[n].d > CMP_EPSILON) {
+ if (dp - p_planes[n].distance > CMP_EPSILON) {
excluded = true;
break;
}
diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp
index a47d4ef7ad..e42c399ba4 100644
--- a/core/math/math_fieldwise.cpp
+++ b/core/math/math_fieldwise.cpp
@@ -89,7 +89,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
/**/ TRY_TRANSFER_FIELD("x", normal.x)
else TRY_TRANSFER_FIELD("y", normal.y)
else TRY_TRANSFER_FIELD("z", normal.z)
- else TRY_TRANSFER_FIELD("d", d)
+ else TRY_TRANSFER_FIELD("d", distance)
return target;
}
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index a3818698bc..c375913756 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -45,7 +45,7 @@ void Plane::normalize() {
return;
}
normal /= l;
- d /= l;
+ distance /= l;
}
Plane Plane::normalized() const {
@@ -57,7 +57,7 @@ Plane Plane::normalized() const {
Vector3 Plane::get_any_point() const {
- return get_normal() * d;
+ return get_normal() * distance;
}
Vector3 Plane::get_any_perpendicular_normal() const {
@@ -92,9 +92,9 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r
return false;
if (r_result) {
- *r_result = ((vec3_cross(normal1, normal2) * p_plane0.d) +
- (vec3_cross(normal2, normal0) * p_plane1.d) +
- (vec3_cross(normal0, normal1) * p_plane2.d)) /
+ *r_result = ((vec3_cross(normal1, normal2) * p_plane0.distance) +
+ (vec3_cross(normal2, normal0) * p_plane1.distance) +
+ (vec3_cross(normal0, normal1) * p_plane2.distance)) /
denom;
}
@@ -112,7 +112,7 @@ bool Plane::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3
return false;
}
- real_t dist = (normal.dot(p_from) - d) / den;
+ real_t dist = (normal.dot(p_from) - distance) / den;
//printf("dist is %i\n",dist);
if (dist > CMP_EPSILON) { //this is a ray, before the emitting pos (p_from) doesn't exist
@@ -137,7 +137,7 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
return false;
}
- real_t dist = (normal.dot(p_begin) - d) / den;
+ real_t dist = (normal.dot(p_begin) - distance) / den;
//printf("dist is %i\n",dist);
if (dist < -CMP_EPSILON || dist > (1.0 + CMP_EPSILON)) {
@@ -155,10 +155,10 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
bool Plane::is_equal_approx(const Plane &p_plane) const {
- return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(d, p_plane.d);
+ return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(distance, p_plane.distance);
}
Plane::operator String() const {
- return normal.operator String() + ", " + rtos(d);
+ return normal.operator String() + ", " + rtos(distance);
}
diff --git a/core/math/plane.h b/core/math/plane.h
index 771c8fc705..1409a4140f 100644
--- a/core/math/plane.h
+++ b/core/math/plane.h
@@ -36,7 +36,7 @@
class Plane {
public:
Vector3 normal;
- real_t d;
+ real_t distance;
void set_normal(const Vector3 &p_normal);
_FORCE_INLINE_ Vector3 get_normal() const { return normal; }; ///Point is coplanar, CMP_EPSILON for precision
@@ -46,7 +46,7 @@ public:
/* Plane-Point operations */
- _FORCE_INLINE_ Vector3 center() const { return normal * d; }
+ _FORCE_INLINE_ Vector3 center() const { return normal * distance; }
Vector3 get_any_point() const;
Vector3 get_any_perpendicular_normal() const;
@@ -67,7 +67,7 @@ public:
/* misc */
- Plane operator-() const { return Plane(-normal, -d); }
+ Plane operator-() const { return Plane(-normal, -distance); }
bool is_equal_approx(const Plane &p_plane) const;
_FORCE_INLINE_ bool operator==(const Plane &p_plane) const;
@@ -75,41 +75,41 @@ public:
operator String() const;
_FORCE_INLINE_ Plane() :
- d(0) {}
+ distance(0) {}
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
normal(p_a, p_b, p_c),
- d(p_d) {}
+ distance(p_d) {}
- _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
+ _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_distance);
_FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal);
_FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE);
};
bool Plane::is_point_over(const Vector3 &p_point) const {
- return (normal.dot(p_point) > d);
+ return (normal.dot(p_point) > distance);
}
real_t Plane::distance_to(const Vector3 &p_point) const {
- return (normal.dot(p_point) - d);
+ return (normal.dot(p_point) - distance);
}
bool Plane::has_point(const Vector3 &p_point, real_t _epsilon) const {
- real_t dist = normal.dot(p_point) - d;
+ real_t dist = normal.dot(p_point) - distance;
dist = ABS(dist);
return (dist <= _epsilon);
}
-Plane::Plane(const Vector3 &p_normal, real_t p_d) :
+Plane::Plane(const Vector3 &p_normal, real_t p_distance) :
normal(p_normal),
- d(p_d) {
+ distance(p_distance) {
}
Plane::Plane(const Vector3 &p_point, const Vector3 &p_normal) :
normal(p_normal),
- d(p_normal.dot(p_point)) {
+ distance(p_normal.dot(p_point)) {
}
Plane::Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir) {
@@ -120,17 +120,17 @@ Plane::Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_
normal = (p_point1 - p_point2).cross(p_point1 - p_point3);
normal.normalize();
- d = normal.dot(p_point1);
+ distance = normal.dot(p_point1);
}
bool Plane::operator==(const Plane &p_plane) const {
- return normal == p_plane.normal && d == p_plane.d;
+ return normal == p_plane.normal && distance == p_plane.distance;
}
bool Plane::operator!=(const Plane &p_plane) const {
- return normal != p_plane.normal || d != p_plane.d;
+ return normal != p_plane.normal || distance != p_plane.distance;
}
#endif // PLANE_H
diff --git a/core/math/transform.h b/core/math/transform.h
index c6e3be4c70..edbabc9c8b 100644
--- a/core/math/transform.h
+++ b/core/math/transform.h
@@ -132,7 +132,7 @@ _FORCE_INLINE_ Vector3 Transform::xform_inv(const Vector3 &p_vector) const {
_FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const {
- Vector3 point = p_plane.normal * p_plane.d;
+ Vector3 point = p_plane.normal * p_plane.distance;
Vector3 point_dir = point + p_plane.normal;
point = xform(point);
point_dir = xform(point_dir);
@@ -145,7 +145,7 @@ _FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const {
}
_FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const {
- Vector3 point = p_plane.normal * p_plane.d;
+ Vector3 point = p_plane.normal * p_plane.distance;
Vector3 point_dir = point + p_plane.normal;
xform_inv(point);
xform_inv(point_dir);
diff --git a/core/self_list.h b/core/self_list.h
index 19d2783208..43aeb44fea 100644
--- a/core/self_list.h
+++ b/core/self_list.h
@@ -120,6 +120,9 @@ private:
public:
_FORCE_INLINE_ bool in_list() const { return _root; }
+ _FORCE_INLINE_ void remove_from_list() {
+ if (_root) _root->remove(this);
+ }
_FORCE_INLINE_ SelfList<T> *next() { return _next; }
_FORCE_INLINE_ SelfList<T> *prev() { return _prev; }
_FORCE_INLINE_ const SelfList<T> *next() const { return _next; }
diff --git a/core/variant.cpp b/core/variant.cpp
index a91876dd98..35c306f24b 100644
--- a/core/variant.cpp
+++ b/core/variant.cpp
@@ -3173,7 +3173,7 @@ uint32_t Variant::hash() const {
uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.x);
hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.y, hash);
hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.z, hash);
- return hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->d, hash);
+ return hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->distance, hash);
} break;
/*
@@ -3521,7 +3521,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
const Plane *r = reinterpret_cast<const Plane *>(p_variant._data._mem);
return (hash_compare_vector3(l->normal, r->normal)) &&
- (hash_compare_scalar(l->d, r->d));
+ (hash_compare_scalar(l->distance, r->distance));
} break;
case AABB: {
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 27624b81ee..6b462201a4 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -78,38 +78,38 @@
#define TYPE(PREFIX, OP, TYPE) &&PREFIX##_##OP##_##TYPE
/* clang-format off */
-#define TYPES(PREFIX, OP) { \
- TYPE(PREFIX, OP, NIL), \
- TYPE(PREFIX, OP, BOOL), \
- TYPE(PREFIX, OP, INT), \
- TYPE(PREFIX, OP, FLOAT), \
- TYPE(PREFIX, OP, STRING), \
- TYPE(PREFIX, OP, VECTOR2), \
- TYPE(PREFIX, OP, VECTOR2I), \
- TYPE(PREFIX, OP, RECT2), \
- TYPE(PREFIX, OP, RECT2I), \
- TYPE(PREFIX, OP, VECTOR3), \
- TYPE(PREFIX, OP, VECTOR3I), \
- TYPE(PREFIX, OP, TRANSFORM2D), \
- TYPE(PREFIX, OP, PLANE), \
- TYPE(PREFIX, OP, QUAT), \
- TYPE(PREFIX, OP, AABB), \
- TYPE(PREFIX, OP, BASIS), \
- TYPE(PREFIX, OP, TRANSFORM), \
- TYPE(PREFIX, OP, COLOR), \
+#define TYPES(PREFIX, OP) { \
+ TYPE(PREFIX, OP, NIL), \
+ TYPE(PREFIX, OP, BOOL), \
+ TYPE(PREFIX, OP, INT), \
+ TYPE(PREFIX, OP, FLOAT), \
+ TYPE(PREFIX, OP, STRING), \
+ TYPE(PREFIX, OP, VECTOR2), \
+ TYPE(PREFIX, OP, VECTOR2I), \
+ TYPE(PREFIX, OP, RECT2), \
+ TYPE(PREFIX, OP, RECT2I), \
+ TYPE(PREFIX, OP, VECTOR3), \
+ TYPE(PREFIX, OP, VECTOR3I), \
+ TYPE(PREFIX, OP, TRANSFORM2D), \
+ TYPE(PREFIX, OP, PLANE), \
+ TYPE(PREFIX, OP, QUAT), \
+ TYPE(PREFIX, OP, AABB), \
+ TYPE(PREFIX, OP, BASIS), \
+ TYPE(PREFIX, OP, TRANSFORM), \
+ TYPE(PREFIX, OP, COLOR), \
TYPE(PREFIX, OP, STRING_NAME), \
- TYPE(PREFIX, OP, NODE_PATH), \
- TYPE(PREFIX, OP, _RID), \
- TYPE(PREFIX, OP, OBJECT), \
+ TYPE(PREFIX, OP, NODE_PATH), \
+ TYPE(PREFIX, OP, _RID), \
+ TYPE(PREFIX, OP, OBJECT), \
TYPE(PREFIX, OP, CALLABLE), \
- TYPE(PREFIX, OP, SIGNAL), \
- TYPE(PREFIX, OP, DICTIONARY), \
- TYPE(PREFIX, OP, ARRAY), \
+ TYPE(PREFIX, OP, SIGNAL), \
+ TYPE(PREFIX, OP, DICTIONARY), \
+ TYPE(PREFIX, OP, ARRAY), \
TYPE(PREFIX, OP, PACKED_BYTE_ARRAY), \
- TYPE(PREFIX, OP, PACKED_INT32_ARRAY), \
- TYPE(PREFIX, OP, PACKED_INT64_ARRAY), \
- TYPE(PREFIX, OP, PACKED_FLOAT32_ARRAY), \
- TYPE(PREFIX, OP, PACKED_FLOAT64_ARRAY), \
+ TYPE(PREFIX, OP, PACKED_INT32_ARRAY), \
+ TYPE(PREFIX, OP, PACKED_INT64_ARRAY), \
+ TYPE(PREFIX, OP, PACKED_FLOAT32_ARRAY), \
+ TYPE(PREFIX, OP, PACKED_FLOAT64_ARRAY), \
TYPE(PREFIX, OP, PACKED_STRING_ARRAY), \
TYPE(PREFIX, OP, PACKED_VECTOR2_ARRAY), \
TYPE(PREFIX, OP, PACKED_VECTOR3_ARRAY), \
@@ -1550,7 +1550,7 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
v->normal.z = p_value._data._int;
valid = true;
} else if (p_index == CoreStringNames::singleton->d) {
- v->d = p_value._data._int;
+ v->distance = p_value._data._int;
valid = true;
}
} else if (p_value.type == Variant::FLOAT) {
@@ -1565,7 +1565,7 @@ void Variant::set_named(const StringName &p_index, const Variant &p_value, bool
v->normal.z = p_value._data._float;
valid = true;
} else if (p_index == CoreStringNames::singleton->d) {
- v->d = p_value._data._float;
+ v->distance = p_value._data._float;
valid = true;
}
@@ -1851,7 +1851,7 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
} else if (p_index == CoreStringNames::singleton->z) {
return v->normal.z;
} else if (p_index == CoreStringNames::singleton->d) {
- return v->d;
+ return v->distance;
} else if (p_index == CoreStringNames::singleton->normal) {
return v->normal;
}
@@ -2334,7 +2334,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid)
return;
} else if (*str == "d") {
valid = true;
- v->d = p_value;
+ v->distance = p_value;
return;
}
}
@@ -2841,7 +2841,7 @@ Variant Variant::get(const Variant &p_index, bool *r_valid) const {
return v->normal;
} else if (*str == "d") {
valid = true;
- return v->d;
+ return v->distance;
}
}
@@ -3458,17 +3458,39 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
return _data._float > 0.0;
} break;
case VECTOR2: {
- int64_t from = reinterpret_cast<const Vector2 *>(_data._mem)->x;
- int64_t to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
+ double from = reinterpret_cast<const Vector2 *>(_data._mem)->x;
+ double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
+
+ r_iter = from;
+
+ return from < to;
+ } break;
+ case VECTOR2I: {
+ int64_t from = reinterpret_cast<const Vector2i *>(_data._mem)->x;
+ int64_t to = reinterpret_cast<const Vector2i *>(_data._mem)->y;
r_iter = from;
return from < to;
} break;
case VECTOR3: {
- int64_t from = reinterpret_cast<const Vector3 *>(_data._mem)->x;
- int64_t to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
- int64_t step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
+ double from = reinterpret_cast<const Vector3 *>(_data._mem)->x;
+ double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
+ double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
+
+ r_iter = from;
+
+ if (from == to) {
+ return false;
+ } else if (from < to) {
+ return step > 0;
+ }
+ return step < 0;
+ } break;
+ case VECTOR3I: {
+ int64_t from = reinterpret_cast<const Vector3i *>(_data._mem)->x;
+ int64_t to = reinterpret_cast<const Vector3i *>(_data._mem)->y;
+ int64_t step = reinterpret_cast<const Vector3i *>(_data._mem)->z;
r_iter = from;
@@ -3476,10 +3498,8 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const {
return false;
} else if (from < to) {
return step > 0;
- } else {
- return step < 0;
}
- //return true;
+ return step < 0;
} break;
case OBJECT: {
@@ -3640,7 +3660,19 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
return true;
} break;
case VECTOR2: {
- int64_t to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
+ double to = reinterpret_cast<const Vector2 *>(_data._mem)->y;
+
+ double idx = r_iter;
+ idx++;
+
+ if (idx >= to)
+ return false;
+
+ r_iter = idx;
+ return true;
+ } break;
+ case VECTOR2I: {
+ int64_t to = reinterpret_cast<const Vector2i *>(_data._mem)->y;
int64_t idx = r_iter;
idx++;
@@ -3652,8 +3684,24 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const {
return true;
} break;
case VECTOR3: {
- int64_t to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
- int64_t step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
+ double to = reinterpret_cast<const Vector3 *>(_data._mem)->y;
+ double step = reinterpret_cast<const Vector3 *>(_data._mem)->z;
+
+ double idx = r_iter;
+ idx += step;
+
+ if (step < 0 && idx <= to)
+ return false;
+
+ if (step > 0 && idx >= to)
+ return false;
+
+ r_iter = idx;
+ return true;
+ } break;
+ case VECTOR3I: {
+ int64_t to = reinterpret_cast<const Vector3i *>(_data._mem)->y;
+ int64_t step = reinterpret_cast<const Vector3i *>(_data._mem)->z;
int64_t idx = r_iter;
idx += step;
@@ -3844,10 +3892,18 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
return r_iter;
} break;
+ case VECTOR2I: {
+
+ return r_iter;
+ } break;
case VECTOR3: {
return r_iter;
} break;
+ case VECTOR3I: {
+
+ return r_iter;
+ } break;
case OBJECT: {
if (!_get_obj().obj) {
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 0a578faf78..7c3bdd2088 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1551,7 +1551,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
case Variant::PLANE: {
Plane p = p_variant;
- p_store_string_func(p_store_string_ud, "Plane( " + rtosfix(p.normal.x) + ", " + rtosfix(p.normal.y) + ", " + rtosfix(p.normal.z) + ", " + rtosfix(p.d) + " )");
+ p_store_string_func(p_store_string_ud, "Plane( " + rtosfix(p.normal.x) + ", " + rtosfix(p.normal.y) + ", " + rtosfix(p.normal.z) + ", " + rtosfix(p.distance) + " )");
} break;
case Variant::AABB: {
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index 45c153b6dc..12701d8688 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Engine" inherits="Object" version="4.0">
<brief_description>
- Access to basic engine properties.
+ Access to engine properties.
</brief_description>
<description>
- The [Engine] class allows you to query and modify the project's run-time parameters, such as frames per second, time scale, and others.
+ The [Engine] singleton allows you to query and modify the project's run-time parameters, such as frames per second, time scale, and others.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 5ba3c6c56a..0c0d16753a 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -305,7 +305,7 @@
<return type="Node">
</return>
<description>
- Returns the parent node of the current node, or an empty [Node] if the node lacks a parent.
+ Returns the parent node of the current node, or a [code]null instance[/code] if the node lacks a parent.
</description>
</method>
<method name="get_path" qualifiers="const">
diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml
index 292acd8b5d..d8a204a2b9 100644
--- a/doc/classes/Plane.xml
+++ b/doc/classes/Plane.xml
@@ -19,10 +19,10 @@
</argument>
<argument index="2" name="c" type="float">
</argument>
- <argument index="3" name="d" type="float">
+ <argument index="3" name="distance" type="float">
</argument>
<description>
- Creates a plane from the four parameters. The three components of the resulting plane's [member normal] are [code]a[/code], [code]b[/code] and [code]c[/code], and the plane has a distance of [code]d[/code] from the origin.
+ Creates a plane from the four parameters. The three components of the resulting plane's [member normal] are [code]a[/code], [code]b[/code] and [code]c[/code], and the plane has a distance of [code]distance[/code] from the origin.
</description>
</method>
<method name="Plane">
@@ -43,7 +43,7 @@
</return>
<argument index="0" name="normal" type="Vector3">
</argument>
- <argument index="1" name="d" type="float">
+ <argument index="1" name="distance" type="float">
</argument>
<description>
Creates a plane from the normal and the plane's distance to the origin.
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 8c18ca8cc9..29222bb4d1 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -309,7 +309,7 @@
<argument index="0" name="by" type="Vector3">
</argument>
<description>
- Returns a copy of the vector snapped to the lowest neared multiple.
+ Returns the vector snapped to a grid with the given size.
</description>
</method>
<method name="to_diagonal_matrix">
diff --git a/doc/classes/VisualShaderNodeInput.xml b/doc/classes/VisualShaderNodeInput.xml
index ed629508d0..9261d0088d 100644
--- a/doc/classes/VisualShaderNodeInput.xml
+++ b/doc/classes/VisualShaderNodeInput.xml
@@ -4,8 +4,10 @@
Represents the input shader parameter within the visual shader graph.
</brief_description>
<description>
+ Gives access to input variables (built-ins) available for the shader. See the shading reference for the list of available built-ins for each shader type (check [code]Tutorials[/code] section for link).
</description>
<tutorials>
+ <link>https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/index.html</link>
</tutorials>
<methods>
<method name="get_input_real_name" qualifiers="const">
@@ -18,7 +20,7 @@
</methods>
<members>
<member name="input_name" type="String" setter="set_input_name" getter="get_input_name" default="&quot;[None]&quot;">
- One of the several input constants in lower-case style like: "vertex"([/code]VERTEX[code]) or "point_size"([code]POINT_SIZE[/code]).
+ One of the several input constants in lower-case style like: "vertex"([code]VERTEX[/code]) or "point_size"([code]POINT_SIZE[/code]).
</member>
</members>
<signals>
diff --git a/doc/classes/VisualShaderNodeIs.xml b/doc/classes/VisualShaderNodeIs.xml
index 184c9e099f..b767a9638e 100644
--- a/doc/classes/VisualShaderNodeIs.xml
+++ b/doc/classes/VisualShaderNodeIs.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeIs" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A boolean comparison operator to be used within the visual shader graph.
</brief_description>
<description>
+ Returns the boolean result of the comparison between [code]INF[/code] or [code]NaN[/code] and a scalar parameter.
</description>
<tutorials>
</tutorials>
@@ -10,12 +12,15 @@
</methods>
<members>
<member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeIs.Function" default="0">
+ The comparison function. See [enum Function] for options.
</member>
</members>
<constants>
<constant name="FUNC_IS_INF" value="0" enum="Function">
+ Comparison with [code]INF[/code] (Infinity).
</constant>
<constant name="FUNC_IS_NAN" value="1" enum="Function">
+ Comparison with [code]NaN[/code] (Not a Number; denotes invalid numeric results, e.g. division by zero).
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeOuterProduct.xml b/doc/classes/VisualShaderNodeOuterProduct.xml
index b8d4fd687f..ba6822bfce 100644
--- a/doc/classes/VisualShaderNodeOuterProduct.xml
+++ b/doc/classes/VisualShaderNodeOuterProduct.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeOuterProduct" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates an outer product of two vectors within the visual shader graph.
</brief_description>
<description>
+ [code]OuterProduct[/code] treats the first parameter [code]c[/code] as a column vector (matrix with one column) and the second parameter [code]r[/code] as a row vector (matrix with one row) and does a linear algebraic matrix multiply [code]c * r[/code], yielding a matrix whose number of rows is the number of components in [code]c[/code] and whose number of columns is the number of components in [code]r[/code].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeOutput.xml b/doc/classes/VisualShaderNodeOutput.xml
index c63e307bad..2b4aed9ae4 100644
--- a/doc/classes/VisualShaderNodeOutput.xml
+++ b/doc/classes/VisualShaderNodeOutput.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeOutput" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Represents the output shader parameters within the visual shader graph.
</brief_description>
<description>
+ This visual shader node is present in all shader graphs in form of "Output" block with mutliple output value ports.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeScalarClamp.xml b/doc/classes/VisualShaderNodeScalarClamp.xml
index fd963dcb5d..7432e8dfca 100644
--- a/doc/classes/VisualShaderNodeScalarClamp.xml
+++ b/doc/classes/VisualShaderNodeScalarClamp.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeScalarClamp" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Clamps a scalar value within the visual shader graph.
</brief_description>
<description>
+ Constrains a value to lie between [code]min[/code] and [code]max[/code] values.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeScalarDerivativeFunc.xml b/doc/classes/VisualShaderNodeScalarDerivativeFunc.xml
index fa9aa07761..33777c1e49 100644
--- a/doc/classes/VisualShaderNodeScalarDerivativeFunc.xml
+++ b/doc/classes/VisualShaderNodeScalarDerivativeFunc.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeScalarDerivativeFunc" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates a scalar derivative within the visual shader graph.
</brief_description>
<description>
+ This node is only available in [code]Fragment[/code] and [code]Light[/code] visual shaders.
</description>
<tutorials>
</tutorials>
@@ -10,14 +12,18 @@
</methods>
<members>
<member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeScalarDerivativeFunc.Function" default="0">
+ The derivative type. See [enum Function] for options.
</member>
</members>
<constants>
<constant name="FUNC_SUM" value="0" enum="Function">
+ Sum of absolute derivative in [code]x[/code] and [code]y[/code].
</constant>
<constant name="FUNC_X" value="1" enum="Function">
+ Derivative in [code]x[/code] using local differencing.
</constant>
<constant name="FUNC_Y" value="2" enum="Function">
+ Derivative in [code]y[/code] using local differencing.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeScalarInterp.xml b/doc/classes/VisualShaderNodeScalarInterp.xml
index a25ab750cc..393ea70e1a 100644
--- a/doc/classes/VisualShaderNodeScalarInterp.xml
+++ b/doc/classes/VisualShaderNodeScalarInterp.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeScalarInterp" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Linearly interpolates between two scalars within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]mix(a, b, weight)[/code] in the shader language.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeScalarSmoothStep.xml b/doc/classes/VisualShaderNodeScalarSmoothStep.xml
index 1ac16e451f..e619cc8571 100644
--- a/doc/classes/VisualShaderNodeScalarSmoothStep.xml
+++ b/doc/classes/VisualShaderNodeScalarSmoothStep.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeScalarSmoothStep" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates a scalar SmoothStep function within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]smoothstep(edge0, edge1, x)[/code] in the shader language.
+ Returns [code]0.0[/code] if [code]x[/code] is smaller than [code]edge0[/code] and [code]1.0[/code] if [code]x[/code] is larger than [code]edge1[/code]. Otherwise the return value is interpolated between [code]0.0[/code] and [code]1.0[/code] using Hermite polynomials.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeScalarSwitch.xml b/doc/classes/VisualShaderNodeScalarSwitch.xml
index 789c8972bb..2ad5202745 100644
--- a/doc/classes/VisualShaderNodeScalarSwitch.xml
+++ b/doc/classes/VisualShaderNodeScalarSwitch.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeScalarSwitch" inherits="VisualShaderNodeSwitch" version="4.0">
<brief_description>
+ A boolean/scalar function for use within the visual shader graph.
</brief_description>
<description>
+ Returns an associated scalar if the provided boolean value is [code]true[/code] or [code]false[/code].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeSwitch.xml b/doc/classes/VisualShaderNodeSwitch.xml
index 5bbb9168a0..9f8a12c0fd 100644
--- a/doc/classes/VisualShaderNodeSwitch.xml
+++ b/doc/classes/VisualShaderNodeSwitch.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeSwitch" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A boolean/vector function for use within the visual shader graph.
</brief_description>
<description>
+ Returns an associated vector if the provided boolean value is [code]true[/code] or [code]false[/code].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeTexture.xml b/doc/classes/VisualShaderNodeTexture.xml
index a28a7f5c65..8e389e0b40 100644
--- a/doc/classes/VisualShaderNodeTexture.xml
+++ b/doc/classes/VisualShaderNodeTexture.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTexture" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Performs a texture lookup within the visual shader graph.
</brief_description>
<description>
+ Performs a lookup operation on the provided texture, with support for multiple texture sources to choose from.
</description>
<tutorials>
</tutorials>
@@ -10,30 +12,42 @@
</methods>
<members>
<member name="source" type="int" setter="set_source" getter="get_source" enum="VisualShaderNodeTexture.Source" default="0">
+ Determines the source for the lookup. See [enum Source] for options.
</member>
<member name="texture" type="Texture2D" setter="set_texture" getter="get_texture">
+ The source texture, if needed for the selected [member source].
</member>
<member name="texture_type" type="int" setter="set_texture_type" getter="get_texture_type" enum="VisualShaderNodeTexture.TextureType" default="0">
+ Specifies the type of the texture if [member source] is set to [constant SOURCE_TEXTURE]. See [enum TextureType] for options.
</member>
</members>
<constants>
<constant name="SOURCE_TEXTURE" value="0" enum="Source">
+ Use the texture given as an argument for this function.
</constant>
<constant name="SOURCE_SCREEN" value="1" enum="Source">
+ Use the current viewport's texture as the source.
</constant>
<constant name="SOURCE_2D_TEXTURE" value="2" enum="Source">
+ Use the texture from this shader's texture built-in (e.g. a texture of a [Sprite2D]).
</constant>
<constant name="SOURCE_2D_NORMAL" value="3" enum="Source">
+ Use the texture from this shader's normal map built-in.
</constant>
<constant name="SOURCE_DEPTH" value="4" enum="Source">
+ Use the depth texture available for this shader.
</constant>
<constant name="SOURCE_PORT" value="5" enum="Source">
+ Use the texture provided in the input port for this function.
</constant>
<constant name="TYPE_DATA" value="0" enum="TextureType">
+ No hints are added to the uniform declaration.
</constant>
<constant name="TYPE_COLOR" value="1" enum="TextureType">
+ Adds [code]hint_albedo[/code] as hint to the uniform declaration for proper sRGB to linear conversion.
</constant>
<constant name="TYPE_NORMALMAP" value="2" enum="TextureType">
+ Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeTextureUniform.xml b/doc/classes/VisualShaderNodeTextureUniform.xml
index 4e2c39a297..107f08ba28 100644
--- a/doc/classes/VisualShaderNodeTextureUniform.xml
+++ b/doc/classes/VisualShaderNodeTextureUniform.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTextureUniform" inherits="VisualShaderNodeUniform" version="4.0">
<brief_description>
+ Performs a uniform texture lookup within the visual shader graph.
</brief_description>
<description>
+ Performs a lookup operation on the texture provided as a uniform for the shader.
</description>
<tutorials>
</tutorials>
@@ -10,22 +12,30 @@
</methods>
<members>
<member name="color_default" type="int" setter="set_color_default" getter="get_color_default" enum="VisualShaderNodeTextureUniform.ColorDefault" default="0">
+ Sets the default color if no texture is assigned to the uniform.
</member>
<member name="texture_type" type="int" setter="set_texture_type" getter="get_texture_type" enum="VisualShaderNodeTextureUniform.TextureType" default="0">
+ Defines the type of data provided by the source texture. See [enum TextureType] for options.
</member>
</members>
<constants>
<constant name="TYPE_DATA" value="0" enum="TextureType">
+ No hints are added to the uniform declaration.
</constant>
<constant name="TYPE_COLOR" value="1" enum="TextureType">
+ Adds [code]hint_albedo[/code] as hint to the uniform declaration for proper sRGB to linear conversion.
</constant>
<constant name="TYPE_NORMALMAP" value="2" enum="TextureType">
+ Adds [code]hint_normal[/code] as hint to the uniform declaration, which internally converts the texture for proper usage as normal map.
</constant>
<constant name="TYPE_ANISO" value="3" enum="TextureType">
+ Adds [code]hint_aniso[/code] as hint to the uniform declaration to use for a flowmap.
</constant>
<constant name="COLOR_DEFAULT_WHITE" value="0" enum="ColorDefault">
+ Defaults to white color.
</constant>
<constant name="COLOR_DEFAULT_BLACK" value="1" enum="ColorDefault">
+ Defaults to black color.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeTextureUniformTriplanar.xml b/doc/classes/VisualShaderNodeTextureUniformTriplanar.xml
index 3d69575444..28504cc7ac 100644
--- a/doc/classes/VisualShaderNodeTextureUniformTriplanar.xml
+++ b/doc/classes/VisualShaderNodeTextureUniformTriplanar.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTextureUniformTriplanar" inherits="VisualShaderNodeTextureUniform" version="4.0">
<brief_description>
+ Performs a uniform texture lookup with triplanar within the visual shader graph.
</brief_description>
<description>
+ Performs a lookup operation on the texture provided as a uniform for the shader, with support for triplanar mapping.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeTransformCompose.xml b/doc/classes/VisualShaderNodeTransformCompose.xml
index 6d9cab7ab0..41762b0099 100644
--- a/doc/classes/VisualShaderNodeTransformCompose.xml
+++ b/doc/classes/VisualShaderNodeTransformCompose.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformCompose" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Composes a [Transform] from four [Vector3]s within the visual shader graph.
</brief_description>
<description>
+ Creates a 4x4 transform matrix using four vectors of type [code]vec3[/code]. Each vector is one row in the matrix and the last column is a [code]vec4(0, 0, 0, 1)[/code].
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeTransformConstant.xml b/doc/classes/VisualShaderNodeTransformConstant.xml
index 15422e1728..e5004e5bb6 100644
--- a/doc/classes/VisualShaderNodeTransformConstant.xml
+++ b/doc/classes/VisualShaderNodeTransformConstant.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformConstant" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A [Transform] constant for use within the visual shader graph.
</brief_description>
<description>
+ A constant [Transform], which can be used as an input node.
</description>
<tutorials>
</tutorials>
@@ -10,6 +12,7 @@
</methods>
<members>
<member name="constant" type="Transform" setter="set_constant" getter="get_constant" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
+ A [Transform] constant which represents the state of this node.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualShaderNodeTransformDecompose.xml b/doc/classes/VisualShaderNodeTransformDecompose.xml
index 4d3c464781..c8d893db00 100644
--- a/doc/classes/VisualShaderNodeTransformDecompose.xml
+++ b/doc/classes/VisualShaderNodeTransformDecompose.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformDecompose" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Decomposes a [Transform] into four [Vector3]s within the visual shader graph.
</brief_description>
<description>
+ Takes a 4x4 transform matrix and decomposes it into four [code]vec3[/code] values, one from each row of the matrix.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeTransformFunc.xml b/doc/classes/VisualShaderNodeTransformFunc.xml
index d2b6fcef2b..d0b5c5129d 100644
--- a/doc/classes/VisualShaderNodeTransformFunc.xml
+++ b/doc/classes/VisualShaderNodeTransformFunc.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformFunc" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Computes a [Transform] function within the visual shader graph.
</brief_description>
<description>
+ Computes an inverse or transpose function on the provided [Transform].
</description>
<tutorials>
</tutorials>
@@ -10,12 +12,15 @@
</methods>
<members>
<member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeTransformFunc.Function" default="0">
+ The function to be computed. See [enum Function] for options.
</member>
</members>
<constants>
<constant name="FUNC_INVERSE" value="0" enum="Function">
+ Perform the inverse operation on the [Transform] matrix.
</constant>
<constant name="FUNC_TRANSPOSE" value="1" enum="Function">
+ Perform the transpose operation on the [Transform] matrix.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeTransformMult.xml b/doc/classes/VisualShaderNodeTransformMult.xml
index 5893d1413b..02b6e0cd1c 100644
--- a/doc/classes/VisualShaderNodeTransformMult.xml
+++ b/doc/classes/VisualShaderNodeTransformMult.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformMult" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Multiplies [Transform] by [Transform] within the visual shader graph.
</brief_description>
<description>
+ A multiplication operation on two transforms (4x4 matrices), with support for different multiplication operators.
</description>
<tutorials>
</tutorials>
@@ -10,16 +12,21 @@
</methods>
<members>
<member name="operator" type="int" setter="set_operator" getter="get_operator" enum="VisualShaderNodeTransformMult.Operator" default="0">
+ The multiplication type to be performed on the transforms. See [enum Operator] for options.
</member>
</members>
<constants>
<constant name="OP_AxB" value="0" enum="Operator">
+ Multiplies transform [code]a[/code] by the transform [code]b[/code].
</constant>
<constant name="OP_BxA" value="1" enum="Operator">
+ Multiplies transform [code]b[/code] by the transform [code]a[/code].
</constant>
<constant name="OP_AxB_COMP" value="2" enum="Operator">
+ Performs a component-wise multiplication of transform [code]a[/code] by the transform [code]b[/code].
</constant>
<constant name="OP_BxA_COMP" value="3" enum="Operator">
+ Performs a component-wise multiplication of transform [code]b[/code] by the transform [code]a[/code].
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeTransformUniform.xml b/doc/classes/VisualShaderNodeTransformUniform.xml
index 7605ef96d5..43696c8226 100644
--- a/doc/classes/VisualShaderNodeTransformUniform.xml
+++ b/doc/classes/VisualShaderNodeTransformUniform.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformUniform" inherits="VisualShaderNodeUniform" version="4.0">
<brief_description>
+ A [Transform] uniform for use within the visual shader graph.
</brief_description>
<description>
+ Translated to [code]uniform mat4[/code] in the shader language.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeTransformVecMult.xml b/doc/classes/VisualShaderNodeTransformVecMult.xml
index d53c3c5ae5..3d5f87f727 100644
--- a/doc/classes/VisualShaderNodeTransformVecMult.xml
+++ b/doc/classes/VisualShaderNodeTransformVecMult.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeTransformVecMult" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Multiplies a [Transform] and a [Vector3] within the visual shader graph.
</brief_description>
<description>
+ A multiplication operation on a transform (4x4 matrix) and a vector, with support for different multiplication operators.
</description>
<tutorials>
</tutorials>
@@ -10,16 +12,21 @@
</methods>
<members>
<member name="operator" type="int" setter="set_operator" getter="get_operator" enum="VisualShaderNodeTransformVecMult.Operator" default="0">
+ The multiplication type to be performed. See [enum Operator] for options.
</member>
</members>
<constants>
<constant name="OP_AxB" value="0" enum="Operator">
+ Multiplies transform [code]a[/code] by the vector [code]b[/code].
</constant>
<constant name="OP_BxA" value="1" enum="Operator">
+ Multiplies vector [code]b[/code] by the transform [code]a[/code].
</constant>
<constant name="OP_3x3_AxB" value="2" enum="Operator">
+ Multiplies transform [code]a[/code] by the vector [code]b[/code], skipping the last row and column of the transform.
</constant>
<constant name="OP_3x3_BxA" value="3" enum="Operator">
+ Multiplies vector [code]b[/code] by the transform [code]a[/code], skipping the last row and column of the transform.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeUniform.xml b/doc/classes/VisualShaderNodeUniform.xml
index 1225d9c320..83261344bd 100644
--- a/doc/classes/VisualShaderNodeUniform.xml
+++ b/doc/classes/VisualShaderNodeUniform.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeUniform" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A base type for the uniforms within the visual shader graph.
</brief_description>
<description>
+ A uniform represents a variable in the shader which is set externally, i.e. from the [ShaderMaterial]. Uniforms are exposed as properties in the [ShaderMaterial] and can be assigned from the inspector or from a script.
</description>
<tutorials>
</tutorials>
@@ -12,6 +14,7 @@
<member name="qualifier" type="int" setter="set_qualifier" getter="get_qualifier" enum="VisualShaderNodeUniform.Qualifier" default="0">
</member>
<member name="uniform_name" type="String" setter="set_uniform_name" getter="get_uniform_name" default="&quot;&quot;">
+ Name of the uniform, by which it can be accessed through the [ShaderMaterial] properties.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualShaderNodeVec3Constant.xml b/doc/classes/VisualShaderNodeVec3Constant.xml
index 8532c5476f..4dfc9dc081 100644
--- a/doc/classes/VisualShaderNodeVec3Constant.xml
+++ b/doc/classes/VisualShaderNodeVec3Constant.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVec3Constant" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A [Vector3] constant to be used within the visual shader graph.
</brief_description>
<description>
+ A constant [Vector3], which can be used as an input node.
</description>
<tutorials>
</tutorials>
@@ -10,6 +12,7 @@
</methods>
<members>
<member name="constant" type="Vector3" setter="set_constant" getter="get_constant" default="Vector3( 0, 0, 0 )">
+ A [Vector3] constant which represents the state of this node.
</member>
</members>
<constants>
diff --git a/doc/classes/VisualShaderNodeVec3Uniform.xml b/doc/classes/VisualShaderNodeVec3Uniform.xml
index f2b4c4778b..c8b44fdc8d 100644
--- a/doc/classes/VisualShaderNodeVec3Uniform.xml
+++ b/doc/classes/VisualShaderNodeVec3Uniform.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVec3Uniform" inherits="VisualShaderNodeUniform" version="4.0">
<brief_description>
+ A [Vector3] uniform to be used within the visual shader graph.
</brief_description>
<description>
+ Translated to [code]uniform vec3[/code] in the shader language.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorClamp.xml b/doc/classes/VisualShaderNodeVectorClamp.xml
index 85c093f84c..567fed8a41 100644
--- a/doc/classes/VisualShaderNodeVectorClamp.xml
+++ b/doc/classes/VisualShaderNodeVectorClamp.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorClamp" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Clamps a vector value within the visual shader graph.
</brief_description>
<description>
+ Constrains a value to lie between [code]min[/code] and [code]max[/code] values. The operation is performed on each component of the vector individually.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorCompose.xml b/doc/classes/VisualShaderNodeVectorCompose.xml
index e5e4924a9e..c9ff3cd38e 100644
--- a/doc/classes/VisualShaderNodeVectorCompose.xml
+++ b/doc/classes/VisualShaderNodeVectorCompose.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorCompose" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Composes a [Vector3] from three scalars within the visual shader graph.
</brief_description>
<description>
+ Creates a [code]vec3[/code] using three scalar values that can be provided from separate inputs.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorDecompose.xml b/doc/classes/VisualShaderNodeVectorDecompose.xml
index 5378f38b6d..95af323c9b 100644
--- a/doc/classes/VisualShaderNodeVectorDecompose.xml
+++ b/doc/classes/VisualShaderNodeVectorDecompose.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorDecompose" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Decomposes a [Vector3] into three scalars within the visual shader graph.
</brief_description>
<description>
+ Takes a [code]vec3[/code] and decomposes it into three scalar values that can be used as separate inputs.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorDerivativeFunc.xml b/doc/classes/VisualShaderNodeVectorDerivativeFunc.xml
index d62512d68b..859c47bc33 100644
--- a/doc/classes/VisualShaderNodeVectorDerivativeFunc.xml
+++ b/doc/classes/VisualShaderNodeVectorDerivativeFunc.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorDerivativeFunc" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates a vector derivative within the visual shader graph.
</brief_description>
<description>
+ This node is only available in [code]Fragment[/code] and [code]Light[/code] visual shaders.
</description>
<tutorials>
</tutorials>
@@ -10,14 +12,18 @@
</methods>
<members>
<member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeVectorDerivativeFunc.Function" default="0">
+ A derivative type. See [enum Function] for options.
</member>
</members>
<constants>
<constant name="FUNC_SUM" value="0" enum="Function">
+ Sum of absolute derivative in [code]x[/code] and [code]y[/code].
</constant>
<constant name="FUNC_X" value="1" enum="Function">
+ Derivative in [code]x[/code] using local differencing.
</constant>
<constant name="FUNC_Y" value="2" enum="Function">
+ Derivative in [code]y[/code] using local differencing.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeVectorDistance.xml b/doc/classes/VisualShaderNodeVectorDistance.xml
index 2e681156a5..2da04b122e 100644
--- a/doc/classes/VisualShaderNodeVectorDistance.xml
+++ b/doc/classes/VisualShaderNodeVectorDistance.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorDistance" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Returns the distance between two points. To be used within the visual shader graph.
</brief_description>
<description>
+ Calculates distance from point represented by vector [code]p0[/code] to vector [code]p1[/code].
+ Translated to [code]distance(p0, p1)[/code] in the shader language.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorFunc.xml b/doc/classes/VisualShaderNodeVectorFunc.xml
index 0b3f317b8b..cbda3dfb46 100644
--- a/doc/classes/VisualShaderNodeVectorFunc.xml
+++ b/doc/classes/VisualShaderNodeVectorFunc.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorFunc" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A vector function to be used within the visual shader graph.
</brief_description>
<description>
+ A visual shader node able to perform different functions using vectors.
</description>
<tutorials>
</tutorials>
@@ -10,78 +12,114 @@
</methods>
<members>
<member name="function" type="int" setter="set_function" getter="get_function" enum="VisualShaderNodeVectorFunc.Function" default="0">
+ The function to be performed. See [enum Function] for options.
</member>
</members>
<constants>
<constant name="FUNC_NORMALIZE" value="0" enum="Function">
+ Normalizes the vector so that it has a length of [code]1[/code] but points in the same direction.
</constant>
<constant name="FUNC_SATURATE" value="1" enum="Function">
+ Clamps the value between [code]0.0[/code] and [code]1.0[/code].
</constant>
<constant name="FUNC_NEGATE" value="2" enum="Function">
+ Returns the opposite value of the parameter.
</constant>
<constant name="FUNC_RECIPROCAL" value="3" enum="Function">
+ Returns [code]1/vector[/code].
</constant>
<constant name="FUNC_RGB2HSV" value="4" enum="Function">
+ Converts RGB vector to HSV equivalent.
</constant>
<constant name="FUNC_HSV2RGB" value="5" enum="Function">
+ Converts HSV vector to RGB equivalent.
</constant>
<constant name="FUNC_ABS" value="6" enum="Function">
+ Returns the absolute value of the parameter.
</constant>
<constant name="FUNC_ACOS" value="7" enum="Function">
+ Returns the arc-cosine of the parameter.
</constant>
<constant name="FUNC_ACOSH" value="8" enum="Function">
+ Returns the inverse hyperbolic cosine of the parameter.
</constant>
<constant name="FUNC_ASIN" value="9" enum="Function">
+ Returns the arc-sine of the parameter.
</constant>
<constant name="FUNC_ASINH" value="10" enum="Function">
+ Returns the inverse hyperbolic sine of the parameter.
</constant>
<constant name="FUNC_ATAN" value="11" enum="Function">
+ Returns the arc-tangent of the parameter.
</constant>
<constant name="FUNC_ATANH" value="12" enum="Function">
+ Returns the inverse hyperbolic tangent of the parameter.
</constant>
<constant name="FUNC_CEIL" value="13" enum="Function">
+ Finds the nearest integer that is greater than or equal to the parameter.
</constant>
<constant name="FUNC_COS" value="14" enum="Function">
+ Returns the cosine of the parameter.
</constant>
<constant name="FUNC_COSH" value="15" enum="Function">
+ Returns the hyperbolic cosine of the parameter.
</constant>
<constant name="FUNC_DEGREES" value="16" enum="Function">
+ Converts a quantity in radians to degrees.
</constant>
<constant name="FUNC_EXP" value="17" enum="Function">
+ Base-e Exponential.
</constant>
<constant name="FUNC_EXP2" value="18" enum="Function">
+ Base-2 Exponential.
</constant>
<constant name="FUNC_FLOOR" value="19" enum="Function">
+ Finds the nearest integer less than or equal to the parameter.
</constant>
<constant name="FUNC_FRAC" value="20" enum="Function">
+ Computes the fractional part of the argument.
</constant>
<constant name="FUNC_INVERSE_SQRT" value="21" enum="Function">
+ Returns the inverse of the square root of the parameter.
</constant>
<constant name="FUNC_LOG" value="22" enum="Function">
+ Natural logarithm.
</constant>
<constant name="FUNC_LOG2" value="23" enum="Function">
+ Base-2 logarithm.
</constant>
<constant name="FUNC_RADIANS" value="24" enum="Function">
+ Converts a quantity in degrees to radians.
</constant>
<constant name="FUNC_ROUND" value="25" enum="Function">
+ Finds the nearest integer to the parameter.
</constant>
<constant name="FUNC_ROUNDEVEN" value="26" enum="Function">
+ Finds the nearest even integer to the parameter.
</constant>
<constant name="FUNC_SIGN" value="27" enum="Function">
+ Extracts the sign of the parameter, i.e. returns [code]-1[/code] if the parameter is negative, [code]1[/code] if it's positive and [code]0[/code] otherwise.
</constant>
<constant name="FUNC_SIN" value="28" enum="Function">
+ Returns the sine of the parameter.
</constant>
<constant name="FUNC_SINH" value="29" enum="Function">
+ Returns the hyperbolic sine of the parameter.
</constant>
<constant name="FUNC_SQRT" value="30" enum="Function">
+ Returns the square root of the parameter.
</constant>
<constant name="FUNC_TAN" value="31" enum="Function">
+ Returns the tangent of the parameter.
</constant>
<constant name="FUNC_TANH" value="32" enum="Function">
+ Returns the hyperbolic tangent of the parameter.
</constant>
<constant name="FUNC_TRUNC" value="33" enum="Function">
+ Returns a value equal to the nearest integer to the parameter whose absolute value is not larger than the absolute value of the parameter.
</constant>
<constant name="FUNC_ONEMINUS" value="34" enum="Function">
+ Returns [code]1.0 - vector[/code].
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeVectorInterp.xml b/doc/classes/VisualShaderNodeVectorInterp.xml
index 4d6d3ac577..b63d34b742 100644
--- a/doc/classes/VisualShaderNodeVectorInterp.xml
+++ b/doc/classes/VisualShaderNodeVectorInterp.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorInterp" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Linearly interpolates between two vectors within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]mix(a, b, weight)[/code] in the shader language, where [code]weight[/code] is a [Vector3] with weights for each component.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorLen.xml b/doc/classes/VisualShaderNodeVectorLen.xml
index ade575310c..77261d3190 100644
--- a/doc/classes/VisualShaderNodeVectorLen.xml
+++ b/doc/classes/VisualShaderNodeVectorLen.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorLen" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Returns the length of a [Vector3] within the visual shader graph.
</brief_description>
<description>
+ Translated to [code]length(p0)[/code] in the shader language.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorOp.xml b/doc/classes/VisualShaderNodeVectorOp.xml
index 8c391d09a2..d56c012f8f 100644
--- a/doc/classes/VisualShaderNodeVectorOp.xml
+++ b/doc/classes/VisualShaderNodeVectorOp.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorOp" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ A vector operator to be used within the visual shader graph.
</brief_description>
<description>
+ A visual shader node for use of vector operators. Operates on vector [code]a[/code] and vector [code]b[/code].
</description>
<tutorials>
</tutorials>
@@ -10,32 +12,45 @@
</methods>
<members>
<member name="operator" type="int" setter="set_operator" getter="get_operator" enum="VisualShaderNodeVectorOp.Operator" default="0">
+ The operator to be used. See [enum Operator] for options.
</member>
</members>
<constants>
<constant name="OP_ADD" value="0" enum="Operator">
+ Adds two vectors.
</constant>
<constant name="OP_SUB" value="1" enum="Operator">
+ Subtracts a vector from a vector.
</constant>
<constant name="OP_MUL" value="2" enum="Operator">
+ Multiplies two vectors.
</constant>
<constant name="OP_DIV" value="3" enum="Operator">
+ Divides vector by vector.
</constant>
<constant name="OP_MOD" value="4" enum="Operator">
+ Returns the remainder of the two vectors.
</constant>
<constant name="OP_POW" value="5" enum="Operator">
+ Returns the value of the first parameter raised to the power of the second, for each component of the vectors.
</constant>
<constant name="OP_MAX" value="6" enum="Operator">
+ Returns the greater of two values, for each component of the vectors.
</constant>
<constant name="OP_MIN" value="7" enum="Operator">
+ Returns the lesser of two values, for each component of the vectors.
</constant>
<constant name="OP_CROSS" value="8" enum="Operator">
+ Calculates the cross product of two vectors.
</constant>
<constant name="OP_ATAN2" value="9" enum="Operator">
+ Returns the arc-tangent of the parameters.
</constant>
<constant name="OP_REFLECT" value="10" enum="Operator">
+ Returns the vector that points in the direction of reflection. [code]a[/code] is incident vector and [code]b[/code] is the normal vector.
</constant>
<constant name="OP_STEP" value="11" enum="Operator">
+ Vector step operator. Returns [code]0.0[/code] if [code]a[/code] is smaller than [code]b[/code] and [code]1.0[/code] otherwise.
</constant>
</constants>
</class>
diff --git a/doc/classes/VisualShaderNodeVectorRefract.xml b/doc/classes/VisualShaderNodeVectorRefract.xml
index c5962e7e10..0fa90a69cf 100644
--- a/doc/classes/VisualShaderNodeVectorRefract.xml
+++ b/doc/classes/VisualShaderNodeVectorRefract.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorRefract" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Returns the [Vector3] that points in the direction of refraction. For use within the visual shader graph.
</brief_description>
<description>
+ Translated to [code]refract(I, N, eta)[/code] in the shader language, where [code]I[/code] is the incident vector, [code]N[/code] is the normal vector and [code]eta[/code] is the ratio of the indicies of the refraction.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorScalarMix.xml b/doc/classes/VisualShaderNodeVectorScalarMix.xml
index c425bfe45e..791a9e6be1 100644
--- a/doc/classes/VisualShaderNodeVectorScalarMix.xml
+++ b/doc/classes/VisualShaderNodeVectorScalarMix.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorScalarMix" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Linearly interpolates between two vectors using a scalar. For use within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]mix(a, b, weight)[/code] in the shader language, where [code]a[/code] and [code]b[/code] are vectors and [code]weight[/code] is a scalar.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorScalarSmoothStep.xml b/doc/classes/VisualShaderNodeVectorScalarSmoothStep.xml
index 2f341d71e0..580abaf5fe 100644
--- a/doc/classes/VisualShaderNodeVectorScalarSmoothStep.xml
+++ b/doc/classes/VisualShaderNodeVectorScalarSmoothStep.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorScalarSmoothStep" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates a vector SmoothStep function using scalar within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]smoothstep(edge0, edge1, x)[/code] in the shader language, where [code]x[/code] is a scalar.
+ Returns [code]0.0[/code] if [code]x[/code] is smaller than [code]edge0[/code] and [code]1.0[/code] if [code]x[/code] is larger than [code]edge1[/code]. Otherwise the return value is interpolated between [code]0.0[/code] and [code]1.0[/code] using Hermite polynomials.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorScalarStep.xml b/doc/classes/VisualShaderNodeVectorScalarStep.xml
index 11da106001..d61414f3a8 100644
--- a/doc/classes/VisualShaderNodeVectorScalarStep.xml
+++ b/doc/classes/VisualShaderNodeVectorScalarStep.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorScalarStep" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates a vector Step function within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]step(edge, x)[/code] in the shader language.
+ Returns [code]0.0[/code] if [code]x[/code] is smaller than [code]edge[/code] and [code]1.0[/code] otherwise.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/VisualShaderNodeVectorSmoothStep.xml b/doc/classes/VisualShaderNodeVectorSmoothStep.xml
index 54e9f1bd7d..1b77a3c535 100644
--- a/doc/classes/VisualShaderNodeVectorSmoothStep.xml
+++ b/doc/classes/VisualShaderNodeVectorSmoothStep.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VisualShaderNodeVectorSmoothStep" inherits="VisualShaderNode" version="4.0">
<brief_description>
+ Calculates a vector SmoothStep function within the visual shader graph.
</brief_description>
<description>
+ Translates to [code]smoothstep(edge0, edge1, x)[/code] in the shader language, where [code]x[/code] is a vector.
+ Returns [code]0.0[/code] if [code]x[/code] is smaller than [code]edge0[/code] and [code]1.0[/code] if [code]x[/code] is larger than [code]edge1[/code]. Otherwise the return value is interpolated between [code]0.0[/code] and [code]1.0[/code] using Hermite polynomials.
</description>
<tutorials>
</tutorials>
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 5213d7ec15..5d16a8cf77 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1611,7 +1611,7 @@ void EditorPropertyPlane::_value_changed(double val, const String &p_name) {
p.normal.x = spin[0]->get_value();
p.normal.y = spin[1]->get_value();
p.normal.z = spin[2]->get_value();
- p.d = spin[3]->get_value();
+ p.distance = spin[3]->get_value();
emit_changed(get_edited_property(), p, p_name);
}
@@ -1621,7 +1621,7 @@ void EditorPropertyPlane::update_property() {
spin[0]->set_value(val.normal.x);
spin[1]->set_value(val.normal.y);
spin[2]->set_value(val.normal.z);
- spin[3]->set_value(val.d);
+ spin[3]->set_value(val.distance);
setting = false;
}
void EditorPropertyPlane::_notification(int p_what) {
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 697ddfba96..7e7a982501 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -766,7 +766,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
Vector3 tangent = Vector3(tangent_src->array[tangent_pos + 0], tangent_src->array[tangent_pos + 1], tangent_src->array[tangent_pos + 2]);
vertex.tangent.normal = tangent;
- vertex.tangent.d = vertex.normal.cross(tangent).dot(binormal) > 0 ? 1 : -1;
+ vertex.tangent.distance = vertex.normal.cross(tangent).dot(binormal) > 0 ? 1 : -1;
}
}
@@ -794,7 +794,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
#ifndef NO_UP_AXIS_SWAP
if (collada.state.up_axis == Vector3::AXIS_Z) {
- Vector3 bn = vertex.normal.cross(vertex.tangent.normal) * vertex.tangent.d;
+ Vector3 bn = vertex.normal.cross(vertex.tangent.normal) * vertex.tangent.distance;
SWAP(vertex.vertex.z, vertex.vertex.y);
vertex.vertex.z = -vertex.vertex.z;
@@ -805,7 +805,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
SWAP(bn.z, bn.y);
bn.z = -bn.z;
- vertex.tangent.d = vertex.normal.cross(vertex.tangent.normal).dot(bn) > 0 ? 1 : -1;
+ vertex.tangent.distance = vertex.normal.cross(vertex.tangent.normal).dot(bn) > 0 ? 1 : -1;
}
#endif
diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp
index c321e85546..f83204fcdd 100644
--- a/editor/node_3d_editor_gizmos.cpp
+++ b/editor/node_3d_editor_gizmos.cpp
@@ -3724,10 +3724,10 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Vector3 n2 = p.normal.cross(n1).normalized();
Vector3 pface[4] = {
- p.normal * p.d + n1 * 10.0 + n2 * 10.0,
- p.normal * p.d + n1 * 10.0 + n2 * -10.0,
- p.normal * p.d + n1 * -10.0 + n2 * -10.0,
- p.normal * p.d + n1 * -10.0 + n2 * 10.0,
+ p.normal * p.distance + n1 * 10.0 + n2 * 10.0,
+ p.normal * p.distance + n1 * 10.0 + n2 * -10.0,
+ p.normal * p.distance + n1 * -10.0 + n2 * -10.0,
+ p.normal * p.distance + n1 * -10.0 + n2 * 10.0,
};
points.push_back(pface[0]);
@@ -3738,8 +3738,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
points.push_back(pface[3]);
points.push_back(pface[3]);
points.push_back(pface[0]);
- points.push_back(p.normal * p.d);
- points.push_back(p.normal * p.d + p.normal * 3);
+ points.push_back(p.normal * p.distance);
+ points.push_back(p.normal * p.distance + p.normal * 3);
p_gizmo->add_lines(points, material);
p_gizmo->add_collision_segments(points);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 457a0aaa36..7e65dd1c78 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -682,11 +682,11 @@ void Node3DEditorViewport::_select_region() {
}
Plane near(cam_pos, -_get_camera_normal());
- near.d -= get_znear();
+ near.distance -= get_znear();
frustum.push_back(near);
Plane far = -near;
- far.d += get_zfar();
+ far.distance += get_zfar();
frustum.push_back(far);
Vector<ObjectID> instances = RenderingServer::get_singleton()->instances_cull_convex(frustum, get_tree()->get_root()->get_world_3d()->get_scenario());
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 60329fb7bc..15fbf19fdb 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -752,7 +752,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
value_editor[0]->set_text(String::num(plane.normal.x));
value_editor[1]->set_text(String::num(plane.normal.y));
value_editor[2]->set_text(String::num(plane.normal.z));
- value_editor[3]->set_text(String::num(plane.d));
+ value_editor[3]->set_text(String::num(plane.distance));
} break;
case Variant::QUAT: {
@@ -1598,7 +1598,7 @@ void CustomPropertyEditor::_modified(String p_string) {
pl.normal.x = _parse_real_expression(value_editor[0]->get_text());
pl.normal.y = _parse_real_expression(value_editor[1]->get_text());
pl.normal.z = _parse_real_expression(value_editor[2]->get_text());
- pl.d = _parse_real_expression(value_editor[3]->get_text());
+ pl.distance = _parse_real_expression(value_editor[3]->get_text());
v = pl;
_emit_changed_whole_or_field();
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index 38f7371802..3a95581720 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -370,7 +370,7 @@ void test_vec(Plane p_vec) {
Plane v0 = cm.xform4(p_vec);
print_line("out: " + v0);
- v0.normal.z = (v0.d / 100.0 * 2.0 - 1.0) * v0.d;
+ v0.normal.z = (v0.distance / 100.0 * 2.0 - 1.0) * v0.distance;
print_line("out_F: " + v0);
}
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index 8ac26a0fdb..e28683ba78 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -188,7 +188,7 @@ void PlaneShapeBullet::setup(const Plane &p_plane) {
btCollisionShape *PlaneShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
btVector3 btPlaneNormal;
G_TO_B(plane.normal, btPlaneNormal);
- return prepare(PlaneShapeBullet::create_shape_plane(btPlaneNormal, plane.d));
+ return prepare(PlaneShapeBullet::create_shape_plane(btPlaneNormal, plane.distance));
}
/* Sphere */
diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp
index 17221fe081..054673d9cc 100644
--- a/modules/gdnative/gdnative/plane.cpp
+++ b/modules/gdnative/gdnative/plane.cpp
@@ -37,10 +37,10 @@
extern "C" {
#endif
-void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) {
+void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_distance) {
Plane *dest = (Plane *)r_dest;
- *dest = Plane(p_a, p_b, p_c, p_d);
+ *dest = Plane(p_a, p_b, p_c, p_distance);
}
void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3) {
@@ -162,14 +162,14 @@ godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self) {
return *v3;
}
-godot_real GDAPI godot_plane_get_d(const godot_plane *p_self) {
+godot_real GDAPI godot_plane_get_distance(const godot_plane *p_self) {
const Plane *self = (const Plane *)p_self;
- return self->d;
+ return self->distance;
}
-void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d) {
+void GDAPI godot_plane_set_distance(godot_plane *p_self, const godot_real p_distance) {
Plane *self = (Plane *)p_self;
- self->d = p_d;
+ self->distance = p_distance;
}
#ifdef __cplusplus
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index d5ab62dc61..c4b8098fc6 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -3120,14 +3120,14 @@
]
},
{
- "name": "godot_plane_get_d",
+ "name": "godot_plane_get_distance",
"return_type": "godot_real",
"arguments": [
["const godot_plane *", "p_self"]
]
},
{
- "name": "godot_plane_set_d",
+ "name": "godot_plane_set_distance",
"return_type": "void",
"arguments": [
["godot_plane *", "p_self"],
diff --git a/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h
index b759a8cc1a..6bd28d7363 100644
--- a/modules/gdnative/include/gdnative/plane.h
+++ b/modules/gdnative/include/gdnative/plane.h
@@ -92,9 +92,9 @@ void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_no
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self);
-godot_real GDAPI godot_plane_get_d(const godot_plane *p_self);
+godot_real GDAPI godot_plane_get_distance(const godot_plane *p_self);
-void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d);
+void GDAPI godot_plane_set_distance(godot_plane *p_self, const godot_real p_distance);
#ifdef __cplusplus
}
diff --git a/modules/gdnavigation/nav_map.cpp b/modules/gdnavigation/nav_map.cpp
index 7e6a3f7a26..9652938251 100644
--- a/modules/gdnavigation/nav_map.cpp
+++ b/modules/gdnavigation/nav_map.cpp
@@ -783,7 +783,7 @@ void NavMap::clip_path(const std::vector<gd::NavigationPoly> &p_navigation_polys
if (cut_plane.normal == Vector3())
return;
cut_plane.normal.normalize();
- cut_plane.d = cut_plane.normal.dot(from);
+ cut_plane.distance = cut_plane.normal.dot(from);
while (from_poly != p_to_poly) {
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 06ab9e226d..5f659f70a0 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -376,10 +376,15 @@ void GDScript::_update_exports_values(Map<StringName, Variant> &values, List<Pro
}
#endif
-bool GDScript::_update_exports() {
+bool GDScript::_update_exports(bool *r_err, bool p_recursive_call) {
#ifdef TOOLS_ENABLED
+ static Vector<GDScript *> base_caches;
+ if (!p_recursive_call)
+ base_caches.clear();
+ base_caches.append(this);
+
bool changed = false;
if (source_changed_cache) {
@@ -473,7 +478,22 @@ bool GDScript::_update_exports() {
placeholder_fallback_enabled = false;
if (base_cache.is_valid() && base_cache->is_valid()) {
- if (base_cache->_update_exports()) {
+ for (int i = 0; i < base_caches.size(); i++) {
+ if (base_caches[i] == base_cache.ptr()) {
+ if (r_err)
+ *r_err = true;
+ valid = false; // to show error in the editor
+ base_cache->valid = false;
+ base_cache->inheriters_cache.clear(); // to prevent future stackoverflows
+ base_cache.unref();
+ base.unref();
+ _base = nullptr;
+ ERR_FAIL_V_MSG(false, "Cyclic inheritance in script class.");
+ }
+ }
+ if (base_cache->_update_exports(r_err, true)) {
+ if (r_err && *r_err)
+ return false;
changed = true;
}
}
@@ -501,7 +521,10 @@ void GDScript::update_exports() {
#ifdef TOOLS_ENABLED
- _update_exports();
+ bool cyclic_error = false;
+ _update_exports(&cyclic_error);
+ if (cyclic_error)
+ return;
Set<ObjectID> copy = inheriters_cache; //might get modified
@@ -1052,6 +1075,16 @@ void GDScript::_init_rpc_methods_properties() {
}
GDScript::~GDScript() {
+
+ {
+ MutexLock lock(GDScriptLanguage::get_singleton()->lock);
+
+ while (SelfList<GDScriptFunctionState> *E = pending_func_states.first()) {
+ E->self()->_clear_stack();
+ pending_func_states.remove(E);
+ }
+ }
+
for (Map<StringName, GDScriptFunction *>::Element *E = member_functions.front(); E; E = E->next()) {
memdelete(E->get());
}
@@ -1470,9 +1503,15 @@ GDScriptInstance::GDScriptInstance() {
}
GDScriptInstance::~GDScriptInstance() {
- if (script.is_valid() && owner) {
- MutexLock lock(GDScriptLanguage::singleton->lock);
+ MutexLock lock(GDScriptLanguage::get_singleton()->lock);
+
+ while (SelfList<GDScriptFunctionState> *E = pending_func_states.first()) {
+ E->self()->_clear_stack();
+ pending_func_states.remove(E);
+ }
+
+ if (script.is_valid() && owner) {
script->instances.erase(owner);
}
}
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 5fdc25669f..b7ac2bd0c5 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -117,6 +117,8 @@ class GDScript : public Script {
String fully_qualified_name;
SelfList<GDScript> script_list;
+ SelfList<GDScriptFunctionState>::List pending_func_states;
+
GDScriptInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error);
void _set_subclass_path(Ref<GDScript> &p_sc, const String &p_path);
@@ -133,7 +135,7 @@ class GDScript : public Script {
#endif
- bool _update_exports();
+ bool _update_exports(bool *r_err = nullptr, bool p_recursive_call = false);
void _save_orphaned_subclasses();
void _init_rpc_methods_properties();
@@ -254,6 +256,8 @@ class GDScriptInstance : public ScriptInstance {
Vector<Variant> members;
bool base_ref;
+ SelfList<GDScriptFunctionState>::List pending_func_states;
+
void _ml_call_reversed(GDScript *sptr, const StringName &p_method, const Variant **p_args, int p_argcount);
public:
@@ -347,6 +351,8 @@ struct GDScriptWarning {
class GDScriptLanguage : public ScriptLanguage {
+ friend class GDScriptFunctionState;
+
static GDScriptLanguage *singleton;
Variant *_global_array;
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 44640411bb..df0fac956c 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -294,8 +294,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
line = p_state->line;
ip = p_state->ip;
alloca_size = p_state->stack.size();
- script = static_cast<GDScript *>(ObjectDB::get_instance(p_state->script_id));
- p_instance = p_state->instance_id.is_valid() ? static_cast<GDScriptInstance *>(ObjectDB::get_instance(p_state->instance_id)->get_script_instance()) : nullptr;
+ script = p_state->script;
+ p_instance = p_state->instance;
defarg = p_state->defarg;
self = p_state->self;
@@ -1281,11 +1281,21 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
gdfs->state.alloca_size = alloca_size;
gdfs->state.ip = ip + ipofs;
gdfs->state.line = line;
- gdfs->state.script_id = script->get_instance_id();
+ gdfs->state.script = _script;
+ {
+ MutexLock lock(GDScriptLanguage::get_singleton()->lock);
+ _script->pending_func_states.add(&gdfs->scripts_list);
+ if (p_instance) {
+ gdfs->state.instance = p_instance;
+ p_instance->pending_func_states.add(&gdfs->instances_list);
+ } else {
+ gdfs->state.instance = NULL;
+ }
+ }
#ifdef DEBUG_ENABLED
+ gdfs->state.function_name = name;
gdfs->state.script_path = _script->get_path();
#endif
- gdfs->state.instance_id = (p_instance && p_instance->get_owner()) ? p_instance->get_owner()->get_instance_id() : ObjectID();
gdfs->state.defarg = defarg;
gdfs->function = this;
@@ -1833,12 +1843,14 @@ bool GDScriptFunctionState::is_valid(bool p_extended_check) const {
return false;
if (p_extended_check) {
- // Class instance gone? (Otherwise script is valid for sure, because the instance has a ref to the script)
- if (state.instance_id.is_valid() && !ObjectDB::get_instance(state.instance_id)) {
+ MutexLock lock(GDScriptLanguage::get_singleton()->lock);
+
+ // Script gone?
+ if (!scripts_list.in_list()) {
return false;
}
- // Script gone? (Static method, so there's no instance whose ref to the script can ensure it's valid)
- if (!ObjectDB::get_instance(state.script_id)) {
+ // Class instance gone? (if not static function)
+ if (state.instance && !instances_list.in_list()) {
return false;
}
}
@@ -1849,19 +1861,26 @@ bool GDScriptFunctionState::is_valid(bool p_extended_check) const {
Variant GDScriptFunctionState::resume(const Variant &p_arg) {
ERR_FAIL_COND_V(!function, Variant());
- if (state.instance_id.is_valid() && !ObjectDB::get_instance(state.instance_id)) {
+ {
+ MutexLock lock(GDScriptLanguage::singleton->lock);
+
+ if (!scripts_list.in_list()) {
#ifdef DEBUG_ENABLED
- ERR_FAIL_V_MSG(Variant(), "Resumed function '" + String(function->get_name()) + "()' after yield, but class instance is gone. At script: " + state.script_path + ":" + itos(state.line));
+ ERR_FAIL_V_MSG(Variant(), "Resumed function '" + state.function_name + "()' after yield, but script is gone. At script: " + state.script_path + ":" + itos(state.line));
#else
- return Variant();
+ return Variant();
#endif
- }
- if (!ObjectDB::get_instance(state.script_id)) {
+ }
+ if (state.instance && !instances_list.in_list()) {
#ifdef DEBUG_ENABLED
- ERR_FAIL_V_MSG(Variant(), "Resumed function '" + String(function->get_name()) + "()' after yield, but script is gone. At script: " + state.script_path + ":" + itos(state.line));
+ ERR_FAIL_V_MSG(Variant(), "Resumed function '" + state.function_name + "()' after yield, but class instance is gone. At script: " + state.script_path + ":" + itos(state.line));
#else
- return Variant();
+ return Variant();
#endif
+ }
+ // Do these now to avoid locking again after the call
+ scripts_list.remove_from_list();
+ instances_list.remove_from_list();
}
state.result = p_arg;
@@ -1884,6 +1903,8 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
state.result = Variant();
if (completed) {
+ _clear_stack();
+
if (first_state.is_valid()) {
first_state->emit_signal("completed", ret);
} else {
@@ -1893,18 +1914,22 @@ Variant GDScriptFunctionState::resume(const Variant &p_arg) {
#ifdef DEBUG_ENABLED
if (EngineDebugger::is_active())
GDScriptLanguage::get_singleton()->exit_function();
- if (state.stack_size) {
- //free stack
- Variant *stack = (Variant *)state.stack.ptr();
- for (int i = 0; i < state.stack_size; i++)
- stack[i].~Variant();
- }
#endif
}
return ret;
}
+void GDScriptFunctionState::_clear_stack() {
+
+ if (state.stack_size) {
+ Variant *stack = (Variant *)state.stack.ptr();
+ for (int i = 0; i < state.stack_size; i++)
+ stack[i].~Variant();
+ state.stack_size = 0;
+ }
+}
+
void GDScriptFunctionState::_bind_methods() {
ClassDB::bind_method(D_METHOD("resume", "arg"), &GDScriptFunctionState::resume, DEFVAL(Variant()));
@@ -1914,18 +1939,20 @@ void GDScriptFunctionState::_bind_methods() {
ADD_SIGNAL(MethodInfo("completed", PropertyInfo(Variant::NIL, "result", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
}
-GDScriptFunctionState::GDScriptFunctionState() {
+GDScriptFunctionState::GDScriptFunctionState() :
+ scripts_list(this),
+ instances_list(this) {
function = nullptr;
}
GDScriptFunctionState::~GDScriptFunctionState() {
- if (function != nullptr) {
- //never called, deinitialize stack
- for (int i = 0; i < state.stack_size; i++) {
- Variant *v = (Variant *)&state.stack[sizeof(Variant) * i];
- v->~Variant();
- }
+ _clear_stack();
+
+ {
+ MutexLock lock(GDScriptLanguage::singleton->lock);
+ scripts_list.remove_from_list();
+ instances_list.remove_from_list();
}
}
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 9d8e23d994..d38b6d0739 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -293,11 +293,12 @@ private:
public:
struct CallState {
- ObjectID script_id;
+ GDScript *script;
+ GDScriptInstance *instance;
#ifdef DEBUG_ENABLED
+ StringName function_name;
String script_path;
#endif
- ObjectID instance_id;
Vector<uint8_t> stack;
int stack_size;
Variant self;
@@ -357,12 +358,18 @@ class GDScriptFunctionState : public Reference {
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
Ref<GDScriptFunctionState> first_state;
+ SelfList<GDScriptFunctionState> scripts_list;
+ SelfList<GDScriptFunctionState> instances_list;
+
protected:
static void _bind_methods();
public:
bool is_valid(bool p_extended_check = false) const;
Variant resume(const Variant &p_arg = Variant());
+
+ void _clear_stack();
+
GDScriptFunctionState();
~GDScriptFunctionState();
};
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 0199af642f..85a5d86ca0 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -1199,6 +1199,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
r_ret = gdscr->_new(nullptr, -1 /*skip initializer*/, r_error);
+ if (r_error.error != Callable::CallError::CALL_OK) {
+ r_ret = Variant();
+ return;
+ }
+
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
Ref<GDScript> gd_ref = ins->get_script();
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 17077567c7..3280b1f8e3 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -72,6 +72,16 @@ bool GDScriptParser::_end_statement() {
return false;
}
+void GDScriptParser::_set_end_statement_error(String p_name) {
+ String error_msg;
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER) {
+ error_msg = vformat("Expected end of statement (\"%s\"), got %s (\"%s\") instead.", p_name, tokenizer->get_token_name(tokenizer->get_token()), tokenizer->get_token_identifier());
+ } else {
+ error_msg = vformat("Expected end of statement (\"%s\"), got %s instead.", p_name, tokenizer->get_token_name(tokenizer->get_token()));
+ }
+ _set_error(error_msg);
+}
+
bool GDScriptParser::_enter_indent_block(BlockNode *p_block) {
if (tokenizer->get_token() != GDScriptTokenizer::TK_COLON) {
@@ -2734,6 +2744,7 @@ void GDScriptParser::_transform_match_statment(MatchNode *p_match_statement) {
IdentifierNode *id2 = alloc_node<IdentifierNode>();
id2->name = local_var->name;
+ id2->datatype = local_var->datatype;
id2->declared_block = branch->body;
id2->set_datatype(local_var->assign->get_datatype());
@@ -2937,7 +2948,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
lv->assign = assigned;
if (!_end_statement()) {
- _set_error("Expected end of statement (\"var\").");
+ _set_end_statement_error("var");
return;
}
@@ -3171,9 +3182,9 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
ConstantNode *cn = alloc_node<ConstantNode>();
switch (args.size()) {
- case 1: cn->value = (int)constants[0]; break;
- case 2: cn->value = Vector2(constants[0], constants[1]); break;
- case 3: cn->value = Vector3(constants[0], constants[1], constants[2]); break;
+ case 1: cn->value = (int64_t)constants[0]; break;
+ case 2: cn->value = Vector2i(constants[0], constants[1]); break;
+ case 3: cn->value = Vector3i(constants[0], constants[1], constants[2]); break;
}
cn->datatype = _type_from_variant(cn->value);
container = cn;
@@ -3186,8 +3197,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
switch (args.size()) {
case 1: tn->vtype = Variant::INT; break;
- case 2: tn->vtype = Variant::VECTOR2; break;
- case 3: tn->vtype = Variant::VECTOR3; break;
+ case 2: tn->vtype = Variant::VECTOR2I; break;
+ case 3: tn->vtype = Variant::VECTOR3I; break;
}
for (int i = 0; i < args.size(); i++) {
@@ -3248,7 +3259,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
cf_continue->cf_type = ControlFlowNode::CF_CONTINUE;
p_block->statements.push_back(cf_continue);
if (!_end_statement()) {
- _set_error("Expected end of statement (\"continue\").");
+ _set_end_statement_error("continue");
return;
}
} break;
@@ -3260,7 +3271,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
cf_break->cf_type = ControlFlowNode::CF_BREAK;
p_block->statements.push_back(cf_break);
if (!_end_statement()) {
- _set_error("Expected end of statement (\"break\").");
+ _set_end_statement_error("break");
return;
}
} break;
@@ -3289,7 +3300,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
cf_return->arguments.push_back(retexpr);
p_block->statements.push_back(cf_return);
if (!_end_statement()) {
- _set_error("Expected end of statement after return expression.");
+ _set_end_statement_error("return");
return;
}
}
@@ -3378,7 +3389,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
p_block->statements.push_back(an);
if (!_end_statement()) {
- _set_error("Expected end of statement after \"assert\".", assert_line);
+ _set_end_statement_error("assert");
return;
}
} break;
@@ -3389,7 +3400,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
p_block->statements.push_back(bn);
if (!_end_statement()) {
- _set_error("Expected end of statement after \"breakpoint\".");
+ _set_end_statement_error("breakpoint");
return;
}
} break;
@@ -3408,7 +3419,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON && tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
_set_error("Unexpected ':=', use '=' instead. Expected end of statement after expression.");
} else {
- _set_error(String() + "Expected end of statement after expression, got " + tokenizer->get_token_name(tokenizer->get_token()) + " instead");
+ _set_error(vformat("Expected end of statement after expression, got %s instead.", tokenizer->get_token_name(tokenizer->get_token())));
}
return;
}
@@ -3598,7 +3609,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (error_set)
return;
if (!_end_statement()) {
- _set_error("Expected end of statement after \"extends\".");
+ _set_end_statement_error("extends");
return;
}
@@ -4103,7 +4114,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
p_class->_signals.push_back(sig);
if (!_end_statement()) {
- _set_error("Expected end of statement (\"signal\").");
+ _set_end_statement_error("signal");
return;
}
} break;
@@ -4960,6 +4971,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
IdentifierNode *id = alloc_node<IdentifierNode>();
id->name = member.identifier;
+ id->datatype = member.data_type;
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_INIT_ASSIGN;
@@ -5002,6 +5014,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
IdentifierNode *id = alloc_node<IdentifierNode>();
id->name = member.identifier;
+ id->datatype = member.data_type;
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_INIT_ASSIGN;
@@ -5044,7 +5057,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
p_class->variables.push_back(member);
if (!_end_statement()) {
- _set_error("Expected end of statement (\"continue\").");
+ _set_end_statement_error("var");
return;
}
} break;
@@ -5124,7 +5137,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
p_class->constant_expressions.insert(const_id, constant);
if (!_end_statement()) {
- _set_error("Expected end of statement (constant).", line);
+ _set_end_statement_error("const");
return;
}
@@ -5278,7 +5291,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
if (!_end_statement()) {
- _set_error("Expected end of statement (\"enum\").");
+ _set_end_statement_error("enum");
return;
}
@@ -6647,6 +6660,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
IdentifierNode *id = alloc_node<IdentifierNode>();
id->name = cn->value.operator StringName();
+ id->datatype = cn->datatype;
op->op = OperatorNode::OP_INDEX_NAMED;
op->arguments.write[1] = id;
@@ -7571,6 +7585,10 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType
}
if (_get_member_type(base_type, p_identifier, member_type)) {
+ if (!p_base_type && current_function && current_function->_static) {
+ _set_error("Can't access member variable (\"" + p_identifier.operator String() + "\") from a static function.", p_line);
+ return DataType();
+ }
return member_type;
}
@@ -7802,7 +7820,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
ConstantNode *tgt_type = alloc_node<ConstantNode>();
tgt_type->line = v.line;
- tgt_type->value = (int)v.data_type.builtin_type;
+ tgt_type->value = (int64_t)v.data_type.builtin_type;
OperatorNode *convert_call = alloc_node<OperatorNode>();
convert_call->line = v.line;
@@ -8179,7 +8197,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
ConstantNode *tgt_type = alloc_node<ConstantNode>();
tgt_type->line = lv->line;
- tgt_type->value = (int)lv->datatype.builtin_type;
+ tgt_type->value = (int64_t)lv->datatype.builtin_type;
tgt_type->datatype = _type_from_variant(tgt_type->value);
OperatorNode *convert_call = alloc_node<OperatorNode>();
@@ -8784,7 +8802,7 @@ int GDScriptParser::get_completion_argument_index() {
return completion_argument;
}
-int GDScriptParser::get_completion_identifier_is_function() {
+bool GDScriptParser::get_completion_identifier_is_function() {
return completion_ident_is_call;
}
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index f254352423..b345a88744 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -624,6 +624,7 @@ private:
void _parse_extends(ClassNode *p_class);
void _parse_class(ClassNode *p_class);
bool _end_statement();
+ void _set_end_statement_error(String p_name);
void _determine_inheritance(ClassNode *p_class, bool p_recursive = true);
bool _parse_type(DataType &r_type, bool p_can_be_void = false);
@@ -683,7 +684,7 @@ public:
BlockNode *get_completion_block();
FunctionNode *get_completion_function();
int get_completion_argument_index();
- int get_completion_identifier_is_function();
+ bool get_completion_identifier_is_function();
const List<String> &get_dependencies() const { return dependencies; }
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index d42ca52731..76f42ead5f 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -803,19 +803,16 @@ void GDScriptTokenizerText::_advance() {
switch (next) {
- case 'a': res = 7; break;
- case 'b': res = 8; break;
- case 't': res = 9; break;
- case 'n': res = 10; break;
- case 'v': res = 11; break;
- case 'f': res = 12; break;
- case 'r': res = 13; break;
+ case 'a': res = '\a'; break;
+ case 'b': res = '\b'; break;
+ case 't': res = '\t'; break;
+ case 'n': res = '\n'; break;
+ case 'v': res = '\v'; break;
+ case 'f': res = '\f'; break;
+ case 'r': res = '\r'; break;
case '\'': res = '\''; break;
case '\"': res = '\"'; break;
case '\\': res = '\\'; break;
- case '/':
- res = '/';
- break; //wtf
case 'u': {
// hex number
@@ -847,6 +844,10 @@ void GDScriptTokenizerText::_advance() {
i += 3;
} break;
+ case '\n': {
+ line++;
+ column = 1;
+ } break;
default: {
_make_error("Invalid escape sequence");
@@ -854,7 +855,8 @@ void GDScriptTokenizerText::_advance() {
} break;
}
- str += res;
+ if (next != '\n')
+ str += res;
} else {
if (CharType(GETCHAR(i)) == '\n') {
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 9abbac6a0b..b0c2c75c19 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -385,7 +385,7 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b
Plane p;
p.normal[edit_axis] = 1.0;
- p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
+ p.distance = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
Vector3 inters;
if (!p.intersects_segment(from, from + normal * settings_pick_distance->get_value(), &inters))
@@ -1137,7 +1137,7 @@ void GridMapEditor::_notification(int p_what) {
Plane p;
p.normal[edit_axis] = 1.0;
- p.d = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
+ p.distance = edit_floor[edit_axis] * node->get_cell_size()[edit_axis];
p = node->get_transform().xform(p); // plane to snap
Node3DEditorPlugin *sep = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen());
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
index 885845e3a4..55a83642fd 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Plane.cs
@@ -56,29 +56,29 @@ namespace Godot
}
}
- public real_t D { get; set; }
+ public real_t Distance { get; set; }
public Vector3 Center
{
get
{
- return _normal * D;
+ return _normal * Distance;
}
}
public real_t DistanceTo(Vector3 point)
{
- return _normal.Dot(point) - D;
+ return _normal.Dot(point) - Distance;
}
public Vector3 GetAnyPoint()
{
- return _normal * D;
+ return _normal * Distance;
}
public bool HasPoint(Vector3 point, real_t epsilon = Mathf.Epsilon)
{
- real_t dist = _normal.Dot(point) - D;
+ real_t dist = _normal.Dot(point) - Distance;
return Mathf.Abs(dist) <= epsilon;
}
@@ -89,9 +89,9 @@ namespace Godot
if (Mathf.IsZeroApprox(denom))
return null;
- Vector3 result = b._normal.Cross(c._normal) * D +
- c._normal.Cross(_normal) * b.D +
- _normal.Cross(b._normal) * c.D;
+ Vector3 result = b._normal.Cross(c._normal) * Distance +
+ c._normal.Cross(_normal) * b.Distance +
+ _normal.Cross(b._normal) * c.Distance;
return result / denom;
}
@@ -103,7 +103,7 @@ namespace Godot
if (Mathf.IsZeroApprox(den))
return null;
- real_t dist = (_normal.Dot(from) - D) / den;
+ real_t dist = (_normal.Dot(from) - Distance) / den;
// This is a ray, before the emitting pos (from) does not exist
if (dist > Mathf.Epsilon)
@@ -120,7 +120,7 @@ namespace Godot
if (Mathf.IsZeroApprox(den))
return null;
- real_t dist = (_normal.Dot(begin) - D) / den;
+ real_t dist = (_normal.Dot(begin) - Distance) / den;
// Only allow dist to be in the range of 0 to 1, with tolerance.
if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon)
@@ -131,7 +131,7 @@ namespace Godot
public bool IsPointOver(Vector3 point)
{
- return _normal.Dot(point) > D;
+ return _normal.Dot(point) > Distance;
}
public Plane Normalized()
@@ -141,7 +141,7 @@ namespace Godot
if (len == 0)
return new Plane(0, 0, 0, 0);
- return new Plane(_normal / len, D / len);
+ return new Plane(_normal / len, Distance / len);
}
public Vector3 Project(Vector3 point)
@@ -159,27 +159,27 @@ namespace Godot
public static Plane PlaneXY { get { return _planeXY; } }
// Constructors
- public Plane(real_t a, real_t b, real_t c, real_t d)
+ public Plane(real_t a, real_t b, real_t c, real_t distance)
{
_normal = new Vector3(a, b, c);
- this.D = d;
+ this.Distance = distance;
}
- public Plane(Vector3 normal, real_t d)
+ public Plane(Vector3 normal, real_t distance)
{
this._normal = normal;
- this.D = d;
+ this.Distance = distance;
}
public Plane(Vector3 v1, Vector3 v2, Vector3 v3)
{
_normal = (v1 - v3).Cross(v1 - v2);
_normal.Normalize();
- D = _normal.Dot(v1);
+ Distance = _normal.Dot(v1);
}
public static Plane operator -(Plane plane)
{
- return new Plane(-plane._normal, -plane.D);
+ return new Plane(-plane._normal, -plane.Distance);
}
public static bool operator ==(Plane left, Plane right)
@@ -204,17 +204,17 @@ namespace Godot
public bool Equals(Plane other)
{
- return _normal == other._normal && D == other.D;
+ return _normal == other._normal && Distance == other.Distance;
}
public bool IsEqualApprox(Plane other)
{
- return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(D, other.D);
+ return _normal.IsEqualApprox(other._normal) && Mathf.IsEqualApprox(Distance, other.Distance);
}
public override int GetHashCode()
{
- return _normal.GetHashCode() ^ D.GetHashCode();
+ return _normal.GetHashCode() ^ Distance.GetHashCode();
}
public override string ToString()
@@ -222,7 +222,7 @@ namespace Godot
return String.Format("({0}, {1})", new object[]
{
_normal.ToString(),
- D.ToString()
+ Distance.ToString()
});
}
@@ -231,7 +231,7 @@ namespace Godot
return String.Format("({0}, {1})", new object[]
{
_normal.ToString(format),
- D.ToString(format)
+ Distance.ToString(format)
});
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index 099eacd7dd..41b4e9367f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -12,7 +12,7 @@ namespace Godot
{
private static int GetSliceCount(this string instance, string splitter)
{
- if (instance.Empty() || splitter.Empty())
+ if (string.IsNullOrEmpty(instance) || string.IsNullOrEmpty(splitter))
return 0;
int pos = 0;
@@ -29,7 +29,7 @@ namespace Godot
private static string GetSliceCharacter(this string instance, char splitter, int slice)
{
- if (!instance.Empty() && slice >= 0)
+ if (!string.IsNullOrEmpty(instance) && slice >= 0)
{
int i = 0;
int prev = 0;
@@ -237,10 +237,10 @@ namespace Godot
// </summary>
public static int CompareTo(this string instance, string to, bool caseSensitive = true)
{
- if (instance.Empty())
- return to.Empty() ? 0 : -1;
+ if (string.IsNullOrEmpty(instance))
+ return string.IsNullOrEmpty(to) ? 0 : -1;
- if (to.Empty())
+ if (string.IsNullOrEmpty(to))
return 1;
int instanceIndex = 0;
@@ -287,14 +287,6 @@ namespace Godot
}
// <summary>
- // Return true if the string is empty.
- // </summary>
- public static bool Empty(this string instance)
- {
- return string.IsNullOrEmpty(instance);
- }
-
- // <summary>
// Return true if the strings ends with the given string.
// </summary>
public static bool EndsWith(this string instance, string text)
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index f2d887e6d6..fd645f1608 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -274,7 +274,7 @@ enum {
MATCHES_Plane = (MATCHES_Vector3 && MATCHES_real_t && (sizeof(Plane) == (sizeof(Vector3) + sizeof(real_t))) &&
offsetof(Plane, normal) == 0 &&
- offsetof(Plane, d) == sizeof(Vector3))
+ offsetof(Plane, distance) == sizeof(Vector3))
};
// In the future we may force this if we want to ref return these structs
@@ -466,14 +466,14 @@ struct M_Color {
struct M_Plane {
M_Vector3 normal;
- real_t d;
+ real_t distance;
static _FORCE_INLINE_ Plane convert_to(const M_Plane &p_from) {
- return Plane(M_Vector3::convert_to(p_from.normal), p_from.d);
+ return Plane(M_Vector3::convert_to(p_from.normal), p_from.distance);
}
static _FORCE_INLINE_ M_Plane convert_from(const Plane &p_from) {
- M_Plane ret = { M_Vector3::convert_from(p_from.normal), p_from.d };
+ M_Plane ret = { M_Vector3::convert_from(p_from.normal), p_from.distance };
return ret;
}
};
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 871f3119bc..7d02befee6 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -376,7 +376,7 @@ Point2 Camera3D::unproject_position(const Vector3 &p_pos) const {
Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
p = cm.xform4(p);
- p.normal /= p.d;
+ p.normal /= p.distance;
Point2 res;
res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x;
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index 6f41629bac..05e282533b 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -111,7 +111,7 @@ Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const {
Plane p(get_camera_transform().xform_inv(p_pos), 1.0);
p = cm.xform4(p);
- p.normal /= p.d;
+ p.normal /= p.distance;
Point2 res;
res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x;
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index ab2657c892..5a3282478c 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -72,6 +72,9 @@ real_t CapsuleShape2D::get_radius() const {
void CapsuleShape2D::set_height(real_t p_height) {
height = p_height;
+ if (height < 0)
+ height = 0;
+
_update_shape();
}
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index ae705a47e8..d96013a081 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -1237,7 +1237,7 @@ void Curve3D::_bake() const {
p = mid;
Plane post;
post.normal = pos;
- post.d = Math::lerp(points[i].tilt, points[i + 1].tilt, mid);
+ post.distance = Math::lerp(points[i].tilt, points[i + 1].tilt, mid);
pointlist.push_back(post);
} else {
@@ -1274,7 +1274,7 @@ void Curve3D::_bake() const {
for (List<Plane>::Element *E = pointlist.front(); E; E = E->next()) {
w[idx] = E->get().normal;
- wt[idx] = E->get().d;
+ wt[idx] = E->get().distance;
if (!up_vector_enabled) {
idx++;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 401b689145..adecf5cf8f 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -1522,7 +1522,7 @@ Error ArrayMesh::lightmap_unwrap_cached(int *&r_cache_data, unsigned int &r_cach
if (lightmap_surfaces[surface].format & ARRAY_FORMAT_TANGENT) {
Plane t;
t.normal = v.tangent;
- t.d = v.binormal.dot(v.normal.cross(v.tangent)) < 0 ? -1 : 1;
+ t.distance = v.binormal.dot(v.normal.cross(v.tangent)) < 0 ? -1 : 1;
surfaces_tools.write[surface]->add_tangent(t);
}
if (lightmap_surfaces[surface].format & ARRAY_FORMAT_BONES) {
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index 76d96786bc..e4d402479f 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -255,7 +255,7 @@ Error MeshDataTool::commit_to_surface(const Ref<ArrayMesh> &p_mesh) {
ta[i * 4 + 0] = vtx.tangent.normal.x;
ta[i * 4 + 1] = vtx.tangent.normal.y;
ta[i * 4 + 2] = vtx.tangent.normal.z;
- ta[i * 4 + 3] = vtx.tangent.d;
+ ta[i * 4 + 3] = vtx.tangent.distance;
}
if (uv)
uv[i] = vtx.uv;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index 4b392e23b7..c5e1aa7c80 100644
--- a/scene/resources/surface_tool.cpp
+++ b/scene/resources/surface_tool.cpp
@@ -107,7 +107,7 @@ void SurfaceTool::add_vertex(const Vector3 &p_vertex) {
vtx.weights = last_weights;
vtx.bones = last_bones;
vtx.tangent = last_tangent.normal;
- vtx.binormal = last_normal.cross(last_tangent.normal).normalized() * last_tangent.d;
+ vtx.binormal = last_normal.cross(last_tangent.normal).normalized() * last_tangent.distance;
const int expected_vertices = 4;
@@ -575,7 +575,7 @@ Vector<SurfaceTool::Vertex> SurfaceTool::create_vertex_array_from_triangle_array
if (lformat & RS::ARRAY_FORMAT_TANGENT) {
Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]);
v.tangent = p.normal;
- v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
+ v.binormal = p.normal.cross(v.tangent).normalized() * p.distance;
}
if (lformat & RS::ARRAY_FORMAT_COLOR)
v.color = carr[i];
@@ -658,7 +658,7 @@ void SurfaceTool::_create_list_from_arrays(Array arr, List<Vertex> *r_vertex, Li
if (lformat & RS::ARRAY_FORMAT_TANGENT) {
Plane p(tarr[i * 4 + 0], tarr[i * 4 + 1], tarr[i * 4 + 2], tarr[i * 4 + 3]);
v.tangent = p.normal;
- v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
+ v.binormal = p.normal.cross(v.tangent).normalized() * p.distance;
}
if (lformat & RS::ARRAY_FORMAT_COLOR)
v.color = carr[i];
diff --git a/scene/resources/world_margin_shape_3d.cpp b/scene/resources/world_margin_shape_3d.cpp
index aa96f8aa68..833e7725ae 100644
--- a/scene/resources/world_margin_shape_3d.cpp
+++ b/scene/resources/world_margin_shape_3d.cpp
@@ -41,10 +41,10 @@ Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() {
Vector3 n2 = p.normal.cross(n1).normalized();
Vector3 pface[4] = {
- p.normal * p.d + n1 * 10.0 + n2 * 10.0,
- p.normal * p.d + n1 * 10.0 + n2 * -10.0,
- p.normal * p.d + n1 * -10.0 + n2 * -10.0,
- p.normal * p.d + n1 * -10.0 + n2 * 10.0,
+ p.normal * p.distance + n1 * 10.0 + n2 * 10.0,
+ p.normal * p.distance + n1 * 10.0 + n2 * -10.0,
+ p.normal * p.distance + n1 * -10.0 + n2 * -10.0,
+ p.normal * p.distance + n1 * -10.0 + n2 * 10.0,
};
points.push_back(pface[0]);
@@ -55,8 +55,8 @@ Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() {
points.push_back(pface[3]);
points.push_back(pface[3]);
points.push_back(pface[0]);
- points.push_back(p.normal * p.d);
- points.push_back(p.normal * p.d + p.normal * 3);
+ points.push_back(p.normal * p.distance);
+ points.push_back(p.normal * p.distance + p.normal * 3);
return points;
}
diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp
index 5096b080ab..d663209f6d 100644
--- a/servers/physics_3d/collision_solver_3d_sat.cpp
+++ b/servers/physics_3d/collision_solver_3d_sat.cpp
@@ -194,7 +194,7 @@ static void _generate_contacts_face_face(const Vector3 *p_points_A, int p_point_
// calculate intersection
Vector3 rel = edge1_A - edge0_A;
real_t den = clip.normal.dot(rel);
- real_t dist = -(clip.normal.dot(edge0_A) - clip.d) / den;
+ real_t dist = -(clip.normal.dot(edge0_A) - clip.distance) / den;
Vector3 inters = edge0_A + rel * dist;
ERR_FAIL_COND(dst_idx >= max_clip);
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index eb92cf55e3..60217002fb 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -218,7 +218,6 @@ void register_server_singletons() {
Engine::get_singleton()->add_singleton(Engine::Singleton("DisplayServer", DisplayServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingServer", RenderingServer::get_singleton()));
- Engine::get_singleton()->add_singleton(Engine::Singleton("RenderingDevice", RenderingDevice::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton()));
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton()));
diff --git a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
index d469dd97ca..afd1296002 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_effects_rd.cpp
@@ -558,7 +558,7 @@ void RasterizerEffectsRD::sub_surface_scattering(RID p_diffuse, RID p_diffuse2,
int32_t y_groups = (p_screen_size.height - 1) / 8 + 1;
Plane p = p_camera.xform4(Plane(1, 0, -1, 1));
- p.normal /= p.d;
+ p.normal /= p.distance;
float unit_size = p.normal.x;
{ //scale color and depth to half
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
index 8d299d623a..8ca8446c23 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -1368,7 +1368,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
gui[0] = v.normal.x;
gui[1] = v.normal.y;
gui[2] = v.normal.z;
- gui[3] = v.d;
+ gui[3] = v.distance;
}
} break;
case ShaderLanguage::TYPE_MAT2: {
@@ -4929,7 +4929,7 @@ void RasterizerStorageRD::_global_variable_store_in_buffer(int32_t p_index, RS::
bv.x = v.normal.x;
bv.y = v.normal.y;
bv.z = v.normal.z;
- bv.w = v.d;
+ bv.w = v.distance;
} break;
case RS::GLOBAL_VAR_TYPE_COLOR: {
GlobalVariables::Value &bv = global_variables.buffer_values[p_index];