Fix serveral recent new clang-format errors

This commit is contained in:
Hein-Pieter van Braam 2017-09-07 08:57:09 +02:00
parent eedb39091a
commit 5e18967d77
11 changed files with 35 additions and 54 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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 {

View file

@ -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();

View file

@ -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;

View file

@ -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() {

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;