summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2017-09-02 22:32:31 +0200
committerHein-Pieter van Braam <hp@tmm.cx>2017-09-08 15:03:53 +0200
commitb2a38854fdde296fd2d7da139a29b23a18ab494d (patch)
tree951326f4d966e01d4f8d4402dc7beb2252560b7a /servers
parentd1cb73b47a17de830d9474026ffa7b3587cfbc68 (diff)
Fix unused variable warnings
The forth in my quest to make Godot 3.x compile with -Werror on GCC7
Diffstat (limited to 'servers')
-rw-r--r--servers/arvr_server.cpp1
-rw-r--r--servers/audio/effects/audio_effect_limiter.cpp5
-rw-r--r--servers/physics/shape_sw.cpp3
-rw-r--r--servers/physics/step_sw.cpp2
-rw-r--r--servers/visual/shader_language.cpp25
-rw-r--r--servers/visual/visual_server_scene.cpp58
6 files changed, 38 insertions, 56 deletions
diff --git a/servers/arvr_server.cpp b/servers/arvr_server.cpp
index bac24f6438..f69d69c51c 100644
--- a/servers/arvr_server.cpp
+++ b/servers/arvr_server.cpp
@@ -130,7 +130,6 @@ void ARVRServer::request_reference_frame(bool p_ignore_tilt, bool p_keep_height)
void ARVRServer::add_interface(const Ref<ARVRInterface> &p_interface) {
ERR_FAIL_COND(p_interface.is_null());
- int idx = -1;
for (int i = 0; i < interfaces.size(); i++) {
if (interfaces[i] == p_interface) {
diff --git a/servers/audio/effects/audio_effect_limiter.cpp b/servers/audio/effects/audio_effect_limiter.cpp
index 391e5db639..9787ba8109 100644
--- a/servers/audio/effects/audio_effect_limiter.cpp
+++ b/servers/audio/effects/audio_effect_limiter.cpp
@@ -31,18 +31,13 @@
void AudioEffectLimiterInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
- float thresh = Math::db2linear(base->threshold);
float threshdb = base->threshold;
float ceiling = Math::db2linear(base->ceiling);
float ceildb = base->ceiling;
float makeup = Math::db2linear(ceildb - threshdb);
- float makeupdb = ceildb - threshdb;
float sc = -base->soft_clip;
float scv = Math::db2linear(sc);
- float sccomp = Math::db2linear(-sc);
float peakdb = ceildb + 25;
- float peaklvl = Math::db2linear(peakdb);
- float scratio = base->soft_clip_ratio;
float scmult = Math::abs((ceildb - sc) / (peakdb - sc));
for (int i = 0; i < p_frame_count; i++) {
diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp
index 1845188089..80eeff93d0 100644
--- a/servers/physics/shape_sw.cpp
+++ b/servers/physics/shape_sw.cpp
@@ -954,6 +954,9 @@ Vector3 ConvexPolygonShapeSW::get_moment_of_inertia(real_t p_mass) const {
void ConvexPolygonShapeSW::_setup(const Vector<Vector3> &p_vertices) {
Error err = QuickHull::build(p_vertices, mesh);
+ if (err != OK)
+ ERR_PRINT("Failed to build QuickHull");
+
Rect3 _aabb;
for (int i = 0; i < mesh.vertices.size(); i++) {
diff --git a/servers/physics/step_sw.cpp b/servers/physics/step_sw.cpp
index 79a55e0af1..76b097dda6 100644
--- a/servers/physics/step_sw.cpp
+++ b/servers/physics/step_sw.cpp
@@ -62,7 +62,7 @@ void StepSW::_setup_island(ConstraintSW *p_island, real_t p_delta) {
ConstraintSW *ci = p_island;
while (ci) {
- bool process = ci->setup(p_delta);
+ ci->setup(p_delta);
//todo remove from island if process fails
ci = ci->get_island_next();
}
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index c7b02c92f7..6ad433268f 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -3000,8 +3000,6 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
if (op->op == OP_CONSTRUCT) {
ERR_FAIL_COND_V(op->arguments[0]->type != Node::TYPE_VARIABLE, p_node);
- VariableNode *vn = static_cast<VariableNode *>(op->arguments[0]);
- //StringName name=vn->name;
DataType base = get_scalar_type(op->get_datatype());
@@ -3121,8 +3119,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
tk = _get_token();
VariableDeclarationNode *vardecl = alloc_node<VariableDeclarationNode>();
- vardecl->datatype=type;
- vardecl->precision=precision;
+ vardecl->datatype = type;
+ vardecl->precision = precision;
p_block->statements.push_back(vardecl);
@@ -3148,8 +3146,8 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
VariableDeclarationNode::Declaration decl;
- decl.name=name;
- decl.initializer=NULL;
+ decl.name = name;
+ decl.initializer = NULL;
tk = _get_token();
@@ -3161,13 +3159,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
decl.initializer = n;
- if (var.type!=n->get_datatype()) {
+ if (var.type != n->get_datatype()) {
_set_error("Invalid assignment of '" + get_datatype_name(n->get_datatype()) + "' to '" + get_datatype_name(var.type) + "'");
return ERR_PARSE_ERROR;
-
}
tk = _get_token();
-
}
vardecl->declarations.push_back(decl);
@@ -3272,9 +3268,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
BlockNode *init_block = alloc_node<BlockNode>();
init_block->parent_block = p_block;
- init_block->single_statement=true;
+ init_block->single_statement = true;
cf->blocks.push_back(init_block);
- if (_parse_block(init_block,p_builtin_types,true,false,false)!=OK) {
+ if (_parse_block(init_block, p_builtin_types, true, false, false) != OK) {
return ERR_PARSE_ERROR;
}
@@ -3282,10 +3278,9 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
if (!n)
return ERR_PARSE_ERROR;
- if (n->get_datatype()!=TYPE_BOOL) {
+ if (n->get_datatype() != TYPE_BOOL) {
_set_error("Middle expression is expected to be boolean.");
return ERR_PARSE_ERROR;
-
}
tk = _get_token();
@@ -3392,7 +3387,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
p_block->statements.push_back(flow);
} else if (tk.type == TK_CF_BREAK) {
-
if (!p_can_break) {
//all is good
_set_error("Breaking is not allowed here");
@@ -3411,7 +3405,6 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Dat
p_block->statements.push_back(flow);
} else if (tk.type == TK_CF_CONTINUE) {
-
if (!p_can_break) {
//all is good
_set_error("Contiuning is not allowed here");
@@ -3980,6 +3973,8 @@ Error ShaderLanguage::complete(const String &p_code, const Map<StringName, Funct
shader = alloc_node<ShaderNode>();
Error err = _parse_shader(p_functions, p_render_modes, p_shader_types);
+ if (err != OK)
+ ERR_PRINT("Failed to parse shader");
switch (completion_type) {
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index e791f7b443..26b428c6db 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -151,8 +151,6 @@ void *VisualServerScene::_instance_pair(void *p_self, OctreeElementID, Instance
} else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
- InstanceLightData *light = static_cast<InstanceLightData *>(A->base_data);
-
return gi_probe->lights.insert(A);
}
@@ -211,8 +209,6 @@ void VisualServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance
} else if (B->base_type == VS::INSTANCE_GI_PROBE && A->base_type == VS::INSTANCE_LIGHT) {
InstanceGIProbeData *gi_probe = static_cast<InstanceGIProbeData *>(B->base_data);
- InstanceLightData *light = static_cast<InstanceLightData *>(A->base_data);
-
Set<Instance *>::Element *E = reinterpret_cast<Set<Instance *>::Element *>(udata);
gi_probe->lights.erase(E);
@@ -890,50 +886,48 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
max_distance = MIN(shadow_max, max_distance);
}
max_distance = MAX(max_distance, p_cam_projection.get_z_near() + 0.001);
- float min_distance = MIN(p_cam_projection.get_z_near(),max_distance);
+ float min_distance = MIN(p_cam_projection.get_z_near(), max_distance);
VS::LightDirectionalShadowDepthRangeMode depth_range_mode = VSG::storage->light_directional_get_shadow_depth_range_mode(p_instance->base);
- if (depth_range_mode==VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED) {
+ if (depth_range_mode == VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_OPTIMIZED) {
//optimize min/max
Vector<Plane> planes = p_cam_projection.get_projection_planes(p_cam_transform);
int cull_count = p_scenario->octree.cull_convex(planes, instance_shadow_cull_result, MAX_INSTANCE_CULL, VS::INSTANCE_GEOMETRY_MASK);
- Plane base(p_cam_transform.origin,-p_cam_transform.basis.get_axis(2));
+ Plane base(p_cam_transform.origin, -p_cam_transform.basis.get_axis(2));
//check distance max and min
- bool found_items=false;
- float z_max=-1e20;
- float z_min=1e20;
+ bool found_items = false;
+ float z_max = -1e20;
+ float z_min = 1e20;
- for(int i=0;i<cull_count;i++) {
+ for (int i = 0; i < cull_count; i++) {
Instance *instance = instance_shadow_cull_result[i];
if (!instance->visible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast<InstanceGeometryData *>(instance->base_data)->can_cast_shadows) {
continue;
}
- float max,min;
+ float max, min;
instance->transformed_aabb.project_range_in_plane(base, min, max);
- if (max>z_max) {
- z_max=max;
+ if (max > z_max) {
+ z_max = max;
}
- if (min<z_min) {
- z_min=min;
+ if (min < z_min) {
+ z_min = min;
}
- found_items=true;
+ found_items = true;
}
if (found_items) {
- min_distance=MAX(min_distance,z_min);
- max_distance=MIN(max_distance,z_max);
+ min_distance = MAX(min_distance, z_min);
+ max_distance = MIN(max_distance, z_max);
}
-
}
-
float range = max_distance - min_distance;
int splits = 0;
@@ -1062,7 +1056,7 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
z_max_cam = z_vec.dot(center) + radius;
z_min_cam = z_vec.dot(center) - radius;
- if (depth_range_mode==VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE) {
+ if (depth_range_mode == VS::LIGHT_DIRECTIONAL_SHADOW_DEPTH_RANGE_STABLE) {
//this trick here is what stabilizes the shadow (make potential jaggies to not move)
//at the cost of some wasted resolution. Still the quality increase is very well worth it
@@ -1073,8 +1067,6 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
y_max_cam = Math::stepify(y_max_cam, unit);
y_min_cam = Math::stepify(y_min_cam, unit);
}
-
-
}
//now that we now all ranges, we can proceed to make the light frustum planes, for culling octree
@@ -1118,7 +1110,6 @@ void VisualServerScene::_light_instance_update_shadow(Instance *p_instance, cons
{
-
CameraMatrix ortho_camera;
real_t half_x = (x_max_cam - x_min_cam) * 0.5;
real_t half_y = (y_max_cam - y_min_cam) * 0.5;
@@ -2135,7 +2126,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
int success_count = 0;
- uint64_t us = OS::get_singleton()->get_ticks_usec();
+ // uint64_t us = OS::get_singleton()->get_ticks_usec();
for (int i = 0; i < p_leaf_count; i++) {
@@ -2188,14 +2179,15 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
success_count++;
}
}
- //print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
- //print_line("valid cells: " + itos(success_count));
+
+ // print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
+ // print_line("valid cells: " + itos(success_count));
} break;
case VS::LIGHT_OMNI:
case VS::LIGHT_SPOT: {
- uint64_t us = OS::get_singleton()->get_ticks_usec();
+ // uint64_t us = OS::get_singleton()->get_ticks_usec();
Vector3 light_pos = light_cache.transform.origin;
Vector3 spot_axis = -light_cache.transform.basis.get_axis(2).normalized();
@@ -2294,8 +2286,7 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header, co
light->energy[2] += int32_t(light_b * att * ((cell->albedo) & 0xFF) / 255.0);
}
}
- //print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
-
+ // print_line("BAKE TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
} break;
}
}
@@ -2707,18 +2698,17 @@ void VisualServerScene::render_probes() {
} break;
case GI_UPDATE_STAGE_UPLOADING: {
- uint64_t us = OS::get_singleton()->get_ticks_usec();
+ // uint64_t us = OS::get_singleton()->get_ticks_usec();
for (int i = 0; i < (int)probe->dynamic.mipmaps_3d.size(); i++) {
- int mmsize = probe->dynamic.mipmaps_3d[i].size();
PoolVector<uint8_t>::Read r = probe->dynamic.mipmaps_3d[i].read();
VSG::storage->gi_probe_dynamic_data_update(probe->dynamic.probe_data, 0, probe->dynamic.grid_size[2] >> i, i, r.ptr());
}
probe->dynamic.updating_stage = GI_UPDATE_STAGE_CHECK;
- //print_line("UPLOAD TIME: "+rtos((OS::get_singleton()->get_ticks_usec()-us)/1000000.0));
+ // print_line("UPLOAD TIME: " + rtos((OS::get_singleton()->get_ticks_usec() - us) / 1000000.0));
} break;
}
}