diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-02 10:40:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-02 10:40:12 +0200 |
commit | 437fb12e1aa3135dc7fa336bd0a53036be649ce8 (patch) | |
tree | df8288d031d4fdf06de7f8f717cb2eafd1c2854f /servers | |
parent | ded74dedefcb03fee1079d33f9688c2e401ea00e (diff) | |
parent | 9c63ab99f0a505b0f60079bb30cc453b4415fddc (diff) |
Merge pull request #10877 from hpvb/fix-unitialized-variables
Fix use of unitialized variables
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics/collision_solver_sw.cpp | 2 | ||||
-rw-r--r-- | servers/physics/gjk_epa.cpp | 6 | ||||
-rw-r--r-- | servers/physics/shape_sw.cpp | 10 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 14 |
5 files changed, 17 insertions, 17 deletions
diff --git a/servers/physics/collision_solver_sw.cpp b/servers/physics/collision_solver_sw.cpp index c7f66cb7fc..7bef208237 100644 --- a/servers/physics/collision_solver_sw.cpp +++ b/servers/physics/collision_solver_sw.cpp @@ -271,7 +271,7 @@ bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A, const Tra bool collided = false; Vector3 closest; - real_t closest_d; + real_t closest_d = 0; for (int i = 0; i < support_count; i++) { diff --git a/servers/physics/gjk_epa.cpp b/servers/physics/gjk_epa.cpp index 6cea5b003d..0f03bd917a 100644 --- a/servers/physics/gjk_epa.cpp +++ b/servers/physics/gjk_epa.cpp @@ -410,8 +410,8 @@ struct GJK if(l>GJK_SIMPLEX3_EPS) { real_t mindist=-1; - real_t subw[2]; - U subm; + real_t subw[2] = { 0 , 0}; + U subm = 0; for(U i=0;i<3;++i) { if(vec3_dot(*vt[i],vec3_cross(dl[i],n))>0) @@ -458,7 +458,7 @@ struct GJK { real_t mindist=-1; real_t subw[3]; - U subm; + U subm=0; for(U i=0;i<3;++i) { const U j=imd3[i]; diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index f02ff03fcf..1845188089 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -734,7 +734,7 @@ Vector3 ConvexPolygonShapeSW::get_support(const Vector3 &p_normal) const { Vector3 n = p_normal; int vert_support_idx = -1; - real_t support_max; + real_t support_max = 0; int vertex_count = mesh.vertices.size(); if (vertex_count == 0) @@ -767,8 +767,8 @@ void ConvexPolygonShapeSW::get_supports(const Vector3 &p_normal, int p_max, Vect int vc = mesh.vertices.size(); //find vertex first - real_t max; - int vtx; + real_t max = 0; + int vtx = 0; for (int i = 0; i < vc; i++) { @@ -1000,7 +1000,7 @@ void FaceShapeSW::project_range(const Vector3 &p_normal, const Transform &p_tran Vector3 FaceShapeSW::get_support(const Vector3 &p_normal) const { int vert_support_idx = -1; - real_t support_max; + real_t support_max = 0; for (int i = 0; i < 3; i++) { @@ -1154,7 +1154,7 @@ Vector3 ConcavePolygonShapeSW::get_support(const Vector3 &p_normal) const { Vector3 n = p_normal; int vert_support_idx = -1; - real_t support_max; + real_t support_max = 0; for (int i = 0; i < count; i++) { diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 09f8a3775e..c7b537c8ea 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2586,7 +2586,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } bool index_valid = false; - DataType member_type; + DataType member_type = TYPE_VOID; switch (expr->get_datatype()) { case TYPE_BVEC2: diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 61ebc6e6de..0d70b7fc0e 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -948,13 +948,13 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons Vector3 z_vec = transform.basis.get_axis(Vector3::AXIS_Z).normalized(); //z_vec points agsint the camera, like in default opengl - float x_min, x_max; - float y_min, y_max; - float z_min, z_max; + float x_min = 0.f, x_max = 0.f; + float y_min = 0.f, y_max = 0.f; + float z_min = 0.f, z_max = 0.f; - float x_min_cam, x_max_cam; - float y_min_cam, y_max_cam; - float z_min_cam, z_max_cam; + float x_min_cam = 0.f, x_max_cam = 0.f; + float y_min_cam = 0.f, y_max_cam = 0.f; + float z_min_cam = 0.f, z_max_cam = 0.f; float bias_scale = 1.0; @@ -1503,7 +1503,7 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam InstanceLightData *light = static_cast<InstanceLightData *>(ins->base_data); - float coverage; + float coverage = 0.f; { //compute coverage |