summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-03-27 16:04:01 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-03-30 18:27:36 +0200
commitf097511b96c7e93f0d62b1c2818208dc11c19851 (patch)
treefbe9884d1dd8aebcd37a85a40b750e53b1bd1a2f /modules
parentb383484e445b1554c811556181a7815e0308fd62 (diff)
Fix another batch of -Wmaybe-uninitialized warnings
And simplify code in CSGShape.
Diffstat (limited to 'modules')
-rw-r--r--modules/basis_universal/register_types.cpp4
-rw-r--r--modules/csg/csg_shape.cpp12
2 files changed, 6 insertions, 10 deletions
diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp
index bf6bc1debd..6b74b8bf4a 100644
--- a/modules/basis_universal/register_types.cpp
+++ b/modules/basis_universal/register_types.cpp
@@ -158,8 +158,8 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) {
const uint8_t *ptr = r;
int size = p_buffer.size();
- basist::transcoder_texture_format format;
- Image::Format imgfmt;
+ basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats;
+ Image::Format imgfmt = Image::FORMAT_MAX;
switch (*(uint32_t *)(ptr)) {
case BASIS_DECOMPRESS_RG: {
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 848b865efb..1ed48a573c 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -742,18 +742,14 @@ CSGBrush *CSGMesh3D::_build_brush() {
Vector<Vector3> anormals = arrays[Mesh::ARRAY_NORMAL];
const Vector3 *nr = NULL;
- bool nr_used = false;
if (anormals.size()) {
nr = anormals.ptr();
- nr_used = true;
}
Vector<Vector2> auvs = arrays[Mesh::ARRAY_TEX_UV];
const Vector2 *uvr = NULL;
- bool uvr_used = false;
if (auvs.size()) {
uvr = auvs.ptr();
- uvr_used = true;
}
Ref<Material> mat;
@@ -789,10 +785,10 @@ CSGBrush *CSGMesh3D::_build_brush() {
for (int k = 0; k < 3; k++) {
int idx = ir[j + k];
vertex[k] = vr[idx];
- if (nr_used) {
+ if (nr) {
normal[k] = nr[idx];
}
- if (uvr_used) {
+ if (uvr) {
uv[k] = uvr[idx];
}
}
@@ -832,10 +828,10 @@ CSGBrush *CSGMesh3D::_build_brush() {
for (int k = 0; k < 3; k++) {
vertex[k] = vr[j + k];
- if (nr_used) {
+ if (nr) {
normal[k] = nr[j + k];
}
- if (uvr_used) {
+ if (uvr) {
uv[k] = uvr[j + k];
}
}