summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-10 16:47:11 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-10 16:47:11 +0200
commit94721f5ab8af9e7d91a4de58baf2c8d849ceab6e (patch)
tree92fb34d709310b76de1c2d45cfe2aad8db7a523a /scene
parent6ab92464bc6356f3342c3efd1fc1bb1a5e4467d5 (diff)
Revert "Renamed plane's d to distance"
This reverts commit ec7b481170dcd6a7b4cf0e6c1221e204ff7945f3. This was wrong, `d` is not a distance but the `d` constant in the parametric equation `ax + by + cz = d` describing the plane.
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/camera_3d.cpp2
-rw-r--r--scene/3d/xr_nodes.cpp2
-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
7 files changed, 15 insertions, 15 deletions
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 7d02befee6..871f3119bc 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.distance;
+ p.normal /= p.d;
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 05e282533b..6f41629bac 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.distance;
+ p.normal /= p.d;
Point2 res;
res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x;
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index d96013a081..ae705a47e8 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.distance = Math::lerp(points[i].tilt, points[i + 1].tilt, mid);
+ post.d = 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().distance;
+ wt[idx] = E->get().d;
if (!up_vector_enabled) {
idx++;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index adecf5cf8f..401b689145 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.distance = v.binormal.dot(v.normal.cross(v.tangent)) < 0 ? -1 : 1;
+ t.d = 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 e4d402479f..76d96786bc 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.distance;
+ ta[i * 4 + 3] = vtx.tangent.d;
}
if (uv)
uv[i] = vtx.uv;
diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp
index c5e1aa7c80..4b392e23b7 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.distance;
+ vtx.binormal = last_normal.cross(last_tangent.normal).normalized() * last_tangent.d;
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.distance;
+ v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
}
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.distance;
+ v.binormal = p.normal.cross(v.tangent).normalized() * p.d;
}
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 833e7725ae..aa96f8aa68 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.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,
+ 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,
};
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.distance);
- points.push_back(p.normal * p.distance + p.normal * 3);
+ points.push_back(p.normal * p.d);
+ points.push_back(p.normal * p.d + p.normal * 3);
return points;
}