From 5e18967d7730f162aa111b2972e3fdc80ee52579 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Thu, 7 Sep 2017 08:57:09 +0200 Subject: [PATCH] Fix serveral recent new clang-format errors --- core/math/camera_matrix.cpp | 28 +++++++-------- core/math/camera_matrix.h | 1 - drivers/gles3/rasterizer_storage_gles3.cpp | 2 +- editor/plugins/canvas_item_editor_plugin.cpp | 1 - main/main.cpp | 2 -- scene/2d/audio_stream_player_2d.cpp | 3 -- scene/3d/light.cpp | 9 ++--- scene/gui/control.cpp | 2 +- scene/main/viewport.cpp | 3 +- servers/visual/rasterizer.h | 1 - servers/visual/visual_server_scene.cpp | 37 +++++++++----------- 11 files changed, 35 insertions(+), 54 deletions(-) diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 572a6c52398..b7a929c8e08 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -266,27 +266,26 @@ void CameraMatrix::get_viewport_size(real_t &r_width, real_t &r_height) const { bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8points) const { Vector planes = get_projection_planes(Transform()); - const Planes intersections[8][3]={ - {PLANE_FAR,PLANE_LEFT,PLANE_TOP}, - {PLANE_FAR,PLANE_LEFT,PLANE_BOTTOM}, - {PLANE_FAR,PLANE_RIGHT,PLANE_TOP}, - {PLANE_FAR,PLANE_RIGHT,PLANE_BOTTOM}, - {PLANE_NEAR,PLANE_LEFT,PLANE_TOP}, - {PLANE_NEAR,PLANE_LEFT,PLANE_BOTTOM}, - {PLANE_NEAR,PLANE_RIGHT,PLANE_TOP}, - {PLANE_NEAR,PLANE_RIGHT,PLANE_BOTTOM}, + const Planes intersections[8][3] = { + { PLANE_FAR, PLANE_LEFT, PLANE_TOP }, + { PLANE_FAR, PLANE_LEFT, PLANE_BOTTOM }, + { PLANE_FAR, PLANE_RIGHT, PLANE_TOP }, + { PLANE_FAR, PLANE_RIGHT, PLANE_BOTTOM }, + { PLANE_NEAR, PLANE_LEFT, PLANE_TOP }, + { PLANE_NEAR, PLANE_LEFT, PLANE_BOTTOM }, + { PLANE_NEAR, PLANE_RIGHT, PLANE_TOP }, + { PLANE_NEAR, PLANE_RIGHT, PLANE_BOTTOM }, }; - for(int i=0;i<8;i++) { + for (int i = 0; i < 8; i++) { Vector3 point; - bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]],planes[intersections[i][2]], &point); + bool res = planes[intersections[i][0]].intersect_3(planes[intersections[i][1]], planes[intersections[i][2]], &point); ERR_FAIL_COND_V(!res, false); - p_8points[i]=p_transform.xform(point); + p_8points[i] = p_transform.xform(point); } return true; - } Vector CameraMatrix::get_projection_planes(const Transform &p_transform) const { @@ -564,10 +563,9 @@ int CameraMatrix::get_pixels_per_meter(int p_for_pixel_width) const { bool CameraMatrix::is_orthogonal() const { - return matrix[3][3]==1.0; + return matrix[3][3] == 1.0; } - real_t CameraMatrix::get_fov() const { const real_t *matrix = (const real_t *)this->matrix; diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 87cc4b95b81..3145d73356c 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -84,7 +84,6 @@ struct CameraMatrix { Plane xform4(const Plane &p_vec4) const; _FORCE_INLINE_ Vector3 xform(const Vector3 &p_vec3) const; - operator String() const; void scale_translate_to_fit(const Rect3 &p_aabb); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 3cacfac578f..96d6c471220 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -4631,7 +4631,7 @@ void RasterizerStorageGLES3::light_directional_set_shadow_depth_range_mode(RID p Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); - light->directional_range_mode=p_range_mode; + light->directional_range_mode = p_range_mode; } VS::LightDirectionalShadowDepthRangeMode RasterizerStorageGLES3::light_directional_get_shadow_depth_range_mode(RID p_light) const { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 3d5732c7497..c0a6606ea70 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2269,7 +2269,6 @@ void CanvasItemEditor::_notification(int p_what) { if (p_what == NOTIFICATION_FIXED_PROCESS) { - EditorNode::get_singleton()->get_scene_root()->set_snap_controls_to_pixels(GLOBAL_GET("gui/common/snap_controls_to_pixels")); List &selection = editor_selection->get_selected_node_list(); diff --git a/main/main.cpp b/main/main.cpp index fe07ba484d5..51d1d966b02 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1325,7 +1325,6 @@ bool Main::start() { int shadow_atlas_q2_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_2_subdiv"); int shadow_atlas_q3_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_3_subdiv"); - sml->get_root()->set_shadow_atlas_size(shadow_atlas_size); sml->get_root()->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q0_subdiv)); sml->get_root()->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q1_subdiv)); @@ -1347,7 +1346,6 @@ bool Main::start() { sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); GLOBAL_DEF("gui/common/snap_controls_to_pixels", true); - } String local_game_path; diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp index ea2e77fc47c..d2a8e3315ae 100644 --- a/scene/2d/audio_stream_player_2d.cpp +++ b/scene/2d/audio_stream_player_2d.cpp @@ -254,8 +254,6 @@ void AudioStreamPlayer2D::set_stream(Ref p_stream) { stream.unref(); ERR_FAIL_COND(stream_playback.is_null()); } - - } Ref AudioStreamPlayer2D::get_stream() const { @@ -449,7 +447,6 @@ void AudioStreamPlayer2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "area_mask", PROPERTY_HINT_LAYERS_2D_PHYSICS), "set_area_mask", "get_area_mask"); ADD_SIGNAL(MethodInfo("finished")); - } AudioStreamPlayer2D::AudioStreamPlayer2D() { diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index d410ba1e2a7..096f7878733 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -308,9 +308,8 @@ DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const { } void DirectionalLight::set_shadow_depth_range(ShadowDepthRange p_range) { - shadow_depth_range=p_range; + shadow_depth_range = p_range; VS::get_singleton()->light_directional_set_shadow_depth_range_mode(light, VS::LightDirectionalShadowDepthRangeMode(p_range)); - } DirectionalLight::ShadowDepthRange DirectionalLight::get_shadow_depth_range() const { @@ -318,7 +317,6 @@ DirectionalLight::ShadowDepthRange DirectionalLight::get_shadow_depth_range() co return shadow_depth_range; } - void DirectionalLight::set_blend_splits(bool p_enable) { blend_splits = p_enable; @@ -356,8 +354,8 @@ void DirectionalLight::_bind_methods() { BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS); BIND_ENUM_CONSTANT(SHADOW_PARALLEL_4_SPLITS); - BIND_ENUM_CONSTANT( SHADOW_DEPTH_RANGE_STABLE ); - BIND_ENUM_CONSTANT( SHADOW_DEPTH_RANGE_OPTIMIZED ); + BIND_ENUM_CONSTANT(SHADOW_DEPTH_RANGE_STABLE); + BIND_ENUM_CONSTANT(SHADOW_DEPTH_RANGE_OPTIMIZED); } DirectionalLight::DirectionalLight() @@ -370,7 +368,6 @@ DirectionalLight::DirectionalLight() set_shadow_mode(SHADOW_PARALLEL_4_SPLITS); set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE); - blend_splits = false; } diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 7bf11e67129..87dfd95724c 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1250,7 +1250,7 @@ void Control::_size_changed() { } if (get_viewport()->is_snap_controls_to_pixels_enabled()) { - new_size_cache =new_size_cache.floor(); + new_size_cache = new_size_cache.floor(); new_pos_cache = new_pos_cache.floor(); } bool pos_changed = new_pos_cache != data.pos_cache; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 434d594bbbb..567b1dd7a14 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2580,7 +2580,7 @@ int Viewport::get_render_info(RenderInfo p_info) { void Viewport::set_snap_controls_to_pixels(bool p_enable) { - snap_controls_to_pixels=p_enable; + snap_controls_to_pixels = p_enable; } bool Viewport::is_snap_controls_to_pixels_enabled() const { @@ -2588,7 +2588,6 @@ bool Viewport::is_snap_controls_to_pixels_enabled() const { return snap_controls_to_pixels; } - void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_arvr", "use"), &Viewport::set_use_arvr); diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 0784fb10496..344c10089a7 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -338,7 +338,6 @@ public: virtual void light_directional_set_shadow_depth_range_mode(RID p_light, VS::LightDirectionalShadowDepthRangeMode p_range_mode) = 0; virtual VS::LightDirectionalShadowDepthRangeMode light_directional_get_shadow_depth_range_mode(RID p_light) const = 0; - virtual VS::LightDirectionalShadowMode light_directional_get_shadow_mode(RID p_light) = 0; virtual VS::LightOmniShadowMode light_omni_get_shadow_mode(RID p_light) = 0; diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index e791f7b4432..9704a9627bc 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -890,50 +890,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 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;ivisible || !((1 << instance->base_type) & VS::INSTANCE_GEOMETRY_MASK) || !static_cast(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