diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 13:23:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch) | |
tree | a27e497da7104dd0a64f98a04fa3067668735e91 /scene/resources/multimesh.cpp | |
parent | 710b34b70227becdc652b4ae027fe0ac47409642 (diff) | |
download | redot-engine-0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a.tar.gz |
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.
This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.
There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).
Part of #33027.
Diffstat (limited to 'scene/resources/multimesh.cpp')
-rw-r--r-- | scene/resources/multimesh.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index ce561bfaaf..795ec0df4b 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -48,7 +48,6 @@ void MultiMesh::_set_transform_array(const Vector<Vector3> &p_array) { const Vector3 *r = xforms.ptr(); for (int i = 0; i < len / 4; i++) { - Transform t; t.basis[0] = r[i * 4 + 0]; t.basis[1] = r[i * 4 + 1]; @@ -60,7 +59,6 @@ void MultiMesh::_set_transform_array(const Vector<Vector3> &p_array) { } Vector<Vector3> MultiMesh::_get_transform_array() const { - if (transform_format != TRANSFORM_3D) return Vector<Vector3>(); @@ -73,7 +71,6 @@ Vector<Vector3> MultiMesh::_get_transform_array() const { Vector3 *w = xforms.ptrw(); for (int i = 0; i < instance_count; i++) { - Transform t = get_instance_transform(i); w[i * 4 + 0] = t.basis[0]; w[i * 4 + 1] = t.basis[1]; @@ -85,7 +82,6 @@ Vector<Vector3> MultiMesh::_get_transform_array() const { } void MultiMesh::_set_transform_2d_array(const Vector<Vector2> &p_array) { - if (transform_format != TRANSFORM_2D) return; @@ -98,7 +94,6 @@ void MultiMesh::_set_transform_2d_array(const Vector<Vector2> &p_array) { const Vector2 *r = xforms.ptr(); for (int i = 0; i < len / 3; i++) { - Transform2D t; t.elements[0] = r[i * 3 + 0]; t.elements[1] = r[i * 3 + 1]; @@ -109,7 +104,6 @@ void MultiMesh::_set_transform_2d_array(const Vector<Vector2> &p_array) { } Vector<Vector2> MultiMesh::_get_transform_2d_array() const { - if (transform_format != TRANSFORM_2D) return Vector<Vector2>(); @@ -122,7 +116,6 @@ Vector<Vector2> MultiMesh::_get_transform_2d_array() const { Vector2 *w = xforms.ptrw(); for (int i = 0; i < instance_count; i++) { - Transform2D t = get_instance_transform_2d(i); w[i * 3 + 0] = t.elements[0]; w[i * 3 + 1] = t.elements[1]; @@ -133,7 +126,6 @@ Vector<Vector2> MultiMesh::_get_transform_2d_array() const { } void MultiMesh::_set_color_array(const Vector<Color> &p_array) { - const Vector<Color> &colors = p_array; int len = colors.size(); if (len == 0) @@ -143,13 +135,11 @@ void MultiMesh::_set_color_array(const Vector<Color> &p_array) { const Color *r = colors.ptr(); for (int i = 0; i < len; i++) { - set_instance_color(i, r[i]); } } Vector<Color> MultiMesh::_get_color_array() const { - if (instance_count == 0 || !use_colors) return Vector<Color>(); @@ -157,7 +147,6 @@ Vector<Color> MultiMesh::_get_color_array() const { colors.resize(instance_count); for (int i = 0; i < instance_count; i++) { - colors.set(i, get_instance_color(i)); } @@ -165,7 +154,6 @@ Vector<Color> MultiMesh::_get_color_array() const { } void MultiMesh::_set_custom_data_array(const Vector<Color> &p_array) { - const Vector<Color> &custom_datas = p_array; int len = custom_datas.size(); if (len == 0) @@ -175,13 +163,11 @@ void MultiMesh::_set_custom_data_array(const Vector<Color> &p_array) { const Color *r = custom_datas.ptr(); for (int i = 0; i < len; i++) { - set_instance_custom_data(i, r[i]); } } Vector<Color> MultiMesh::_get_custom_data_array() const { - if (instance_count == 0 || !use_custom_data) return Vector<Color>(); @@ -189,7 +175,6 @@ Vector<Color> MultiMesh::_get_custom_data_array() const { custom_datas.resize(instance_count); for (int i = 0; i < instance_count; i++) { - custom_datas.set(i, get_instance_custom_data(i)); } @@ -206,7 +191,6 @@ Vector<float> MultiMesh::get_buffer() const { } void MultiMesh::set_mesh(const Ref<Mesh> &p_mesh) { - mesh = p_mesh; if (!mesh.is_null()) RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid()); @@ -215,7 +199,6 @@ void MultiMesh::set_mesh(const Ref<Mesh> &p_mesh) { } Ref<Mesh> MultiMesh::get_mesh() const { - return mesh; } @@ -225,7 +208,6 @@ void MultiMesh::set_instance_count(int p_count) { instance_count = p_count; } int MultiMesh::get_instance_count() const { - return instance_count; } @@ -236,55 +218,44 @@ void MultiMesh::set_visible_instance_count(int p_count) { visible_instance_count = p_count; } int MultiMesh::get_visible_instance_count() const { - return visible_instance_count; } void MultiMesh::set_instance_transform(int p_instance, const Transform &p_transform) { - RenderingServer::get_singleton()->multimesh_instance_set_transform(multimesh, p_instance, p_transform); } void MultiMesh::set_instance_transform_2d(int p_instance, const Transform2D &p_transform) { - RenderingServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform); } Transform MultiMesh::get_instance_transform(int p_instance) const { - return RenderingServer::get_singleton()->multimesh_instance_get_transform(multimesh, p_instance); } Transform2D MultiMesh::get_instance_transform_2d(int p_instance) const { - return RenderingServer::get_singleton()->multimesh_instance_get_transform_2d(multimesh, p_instance); } void MultiMesh::set_instance_color(int p_instance, const Color &p_color) { - RenderingServer::get_singleton()->multimesh_instance_set_color(multimesh, p_instance, p_color); } Color MultiMesh::get_instance_color(int p_instance) const { - return RenderingServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance); } void MultiMesh::set_instance_custom_data(int p_instance, const Color &p_custom_data) { - RenderingServer::get_singleton()->multimesh_instance_set_custom_data(multimesh, p_instance, p_custom_data); } Color MultiMesh::get_instance_custom_data(int p_instance) const { - return RenderingServer::get_singleton()->multimesh_instance_get_custom_data(multimesh, p_instance); } AABB MultiMesh::get_aabb() const { - return RenderingServer::get_singleton()->multimesh_get_aabb(multimesh); } RID MultiMesh::get_rid() const { - return multimesh; } @@ -307,17 +278,14 @@ bool MultiMesh::is_using_custom_data() const { } void MultiMesh::set_transform_format(TransformFormat p_transform_format) { - ERR_FAIL_COND(instance_count > 0); transform_format = p_transform_format; } MultiMesh::TransformFormat MultiMesh::get_transform_format() const { - return transform_format; } void MultiMesh::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MultiMesh::set_mesh); ClassDB::bind_method(D_METHOD("get_mesh"), &MultiMesh::get_mesh); ClassDB::bind_method(D_METHOD("set_use_colors", "enable"), &MultiMesh::set_use_colors); @@ -374,7 +342,6 @@ void MultiMesh::_bind_methods() { } MultiMesh::MultiMesh() { - multimesh = RenderingServer::get_singleton()->multimesh_create(); use_colors = false; use_custom_data = false; @@ -384,6 +351,5 @@ MultiMesh::MultiMesh() { } MultiMesh::~MultiMesh() { - RenderingServer::get_singleton()->free(multimesh); } |