Merge pull request #32560 from bruvzg/vlk_v3_fix

[Vulkan] Fix Vector3 ambiguities and out of bounds init.
This commit is contained in:
Rémi Verschelde 2019-10-05 10:42:58 +02:00 committed by GitHub
commit 6075c5f9bf
5 changed files with 7 additions and 9 deletions

View file

@ -103,7 +103,7 @@ Vector3 Vector3::cubic_interpolaten(const Vector3 &p_b, const Vector3 &p_pre_a,
Vector3 out;
out = 0.5 * ((p1 * 2.0) +
(-p0 + p2) * t +
(2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 +
(2.0 * p0 - 5.0 * p1 + 4.0 * p2 - p3) * t2 +
(-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3);
return out;
}
@ -122,7 +122,7 @@ Vector3 Vector3::cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, c
Vector3 out;
out = 0.5 * ((p1 * 2.0) +
(-p0 + p2) * t +
(2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 +
(2.0 * p0 - 5.0 * p1 + 4.0 * p2 - p3) * t2 +
(-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3);
return out;
}

View file

@ -2618,7 +2618,7 @@ struct EditorSceneImporterGLTFInterpolate {
const float t2 = t * t;
const float t3 = t2 * t;
return 0.5f * ((2.0f * p1) + (-p0 + p2) * t + (2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 + (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
return 0.5f * ((2.0f * p1) + (-p0 + p2) * t + (2.0f * p0 - 5.0f * p1 + 4.0f * p2 - p3) * t2 + (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
}
T bezier(T start, T control_1, T control_2, T end, float t) {

View file

@ -618,8 +618,8 @@ MainLoop *test() {
print_line("minus: " + (Vector3(1, 2, 3) - Vector3(Vector3(4, 5, 7))));
print_line("mul: " + (Vector3(1, 2, 3) * Vector3(Vector3(4, 5, 7))));
print_line("div: " + (Vector3(1, 2, 3) / Vector3(Vector3(4, 5, 7))));
print_line("mul scalar: " + (Vector3(1, 2, 3) * 2));
print_line("premul scalar: " + (2 * Vector3(1, 2, 3)));
print_line("mul scalar: " + (Vector3(1, 2, 3) * 2.0));
print_line("premul scalar: " + (2.0 * Vector3(1, 2, 3)));
print_line("div scalar: " + (Vector3(1, 2, 3) / 3.0));
print_line("length: " + rtos(Vector3(1, 2, 3).length()));
print_line("length squared: " + rtos(Vector3(1, 2, 3).length_squared()));

View file

@ -167,8 +167,7 @@ struct EditorSceneImporterAssetImportInterpolate {
float t2 = t * t;
float t3 = t2 * t;
return 0.5f * ((2.0f * p1) + (-p0 + p2) * t + (2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 +
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
return 0.5f * ((2.0f * p1) + (-p0 + p2) * t + (2.0f * p0 - 5.0f * p1 + 4.0f * p2 - p3) * t2 + (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
}
T bezier(T start, T control_1, T control_2, T end, float t) {

View file

@ -517,9 +517,8 @@ void RasterizerCanvasRD::_render_item(RD::DrawListID p_draw_list, const Item *p_
push_constant.color_texture_pixel_size[0] = 0;
push_constant.color_texture_pixel_size[1] = 0;
push_constant.pad[0] = 0;
push_constant.pad[1] = 0;
push_constant.pad[2] = 0;
push_constant.pad[3] = 0;
push_constant.lights[0] = 0;
push_constant.lights[1] = 0;