diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-09-07 08:57:09 +0200 |
---|---|---|
committer | Hein-Pieter van Braam <hp@tmm.cx> | 2017-09-08 00:20:16 +0200 |
commit | 5e18967d7730f162aa111b2972e3fdc80ee52579 (patch) | |
tree | 03dc5c7bec497370bc24a7254992a6e986495bf9 | |
parent | eedb39091aaa1dc0b8f204844bb1eb270b2349f6 (diff) |
Fix serveral recent new clang-format errors
-rw-r--r-- | core/math/camera_matrix.cpp | 28 | ||||
-rw-r--r-- | core/math/camera_matrix.h | 1 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | main/main.cpp | 2 | ||||
-rw-r--r-- | scene/2d/audio_stream_player_2d.cpp | 3 | ||||
-rw-r--r-- | scene/3d/light.cpp | 9 | ||||
-rw-r--r-- | scene/gui/control.cpp | 2 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 3 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 1 | ||||
-rw-r--r-- | 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 572a6c5239..b7a929c8e0 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<Plane> 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<Plane> 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 87cc4b95b8..3145d73356 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 3cacfac578..96d6c47122 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 3d5732c749..c0a6606ea7 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<Node *> &selection = editor_selection->get_selected_node_list(); diff --git a/main/main.cpp b/main/main.cpp index fe07ba484d..51d1d966b0 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 ea2e77fc47..d2a8e3315a 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<AudioStream> p_stream) { stream.unref(); ERR_FAIL_COND(stream_playback.is_null()); } - - } Ref<AudioStream> 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 d410ba1e2a..096f787873 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 7bf11e6712..87dfd95724 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 434d594bbb..567b1dd7a1 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 0784fb1049..344c10089a 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 e791f7b443..9704a9627b 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<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 +1060,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 +1071,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 +1114,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; |