Jelajahi Sumber

Fix GCC 5 build after #26331 and cleanup style

Also cleanup after 01a3dd3.
Rémi Verschelde 6 tahun lalu
induk
melakukan
0ba75c195e

+ 6 - 6
core/io/resource_importer.cpp

@@ -32,7 +32,8 @@
 
 #include "core/os/os.h"
 #include "core/variant_parser.h"
-bool ResourceFormatImporter::SortImporterByName::operator() ( const Ref<ResourceImporter>& p_a,const Ref<ResourceImporter>& p_b) const {
+
+bool ResourceFormatImporter::SortImporterByName::operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const {
 	return p_a->get_importer_name() < p_b->get_importer_name();
 }
 
@@ -321,7 +322,6 @@ Variant ResourceFormatImporter::get_resource_metadata(const String &p_path) cons
 	return pat.metadata;
 }
 
-
 void ResourceFormatImporter::get_dependencies(const String &p_path, List<String> *p_dependencies, bool p_add_types) {
 
 	PathAndType pat;
@@ -394,7 +394,7 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con
 		return false;
 	}
 
-	for(int i=0;i<importers.size();i++) {
+	for (int i = 0; i < importers.size(); i++) {
 		if (importers[i]->get_importer_name() == pat.importer) {
 			if (!importers[i]->are_import_settings_valid(p_path)) { //importer thinks this is not valid
 				return false;
@@ -405,10 +405,10 @@ bool ResourceFormatImporter::are_import_settings_valid(const String &p_path) con
 	return true;
 }
 
- String ResourceFormatImporter::get_import_settings_hash() const {
+String ResourceFormatImporter::get_import_settings_hash() const {
 	String hash;
-	for(int i=0;i<importers.size();i++) {
-		hash+=":"+importers[i]->get_importer_name()+":"+importers[i]->get_import_settings_string();
+	for (int i = 0; i < importers.size(); i++) {
+		hash += ":" + importers[i]->get_importer_name() + ":" + importers[i]->get_import_settings_string();
 	}
 	return hash.md5_text();
 }

+ 6 - 4
core/io/resource_importer.h

@@ -52,7 +52,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
 
 	//need them to stay in order to compute the settings hash
 	struct SortImporterByName {
-		bool operator() ( const Ref<ResourceImporter>& p_a,const Ref<ResourceImporter>& p_b) const;
+		bool operator()(const Ref<ResourceImporter> &p_a, const Ref<ResourceImporter> &p_b) const;
 	};
 
 	Vector<Ref<ResourceImporter> > importers;
@@ -75,7 +75,10 @@ public:
 	String get_internal_resource_path(const String &p_path) const;
 	void get_internal_resource_path_list(const String &p_path, List<String> *r_paths);
 
-	void add_importer(const Ref<ResourceImporter> &p_importer) { importers.push_back(p_importer); importers.sort_custom<SortImporterByName>();}
+	void add_importer(const Ref<ResourceImporter> &p_importer) {
+		importers.push_back(p_importer);
+		importers.sort_custom<SortImporterByName>();
+	}
 	void remove_importer(const Ref<ResourceImporter> &p_importer) { importers.erase(p_importer); }
 	Ref<ResourceImporter> get_importer_by_name(const String &p_name) const;
 	Ref<ResourceImporter> get_importer_by_extension(const String &p_extension) const;
@@ -117,10 +120,9 @@ public:
 	virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const = 0;
 	virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const = 0;
 
-	virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata=NULL) = 0;
+	virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0;
 	virtual bool are_import_settings_valid(const String &p_path) const { return true; }
 	virtual String get_import_settings_string() const { return String(); }
-
 };
 
 #endif // RESOURCE_IMPORTER_H

+ 0 - 1
core/script_debugger_remote.cpp

@@ -1054,7 +1054,6 @@ void ScriptDebuggerRemote::profiling_set_frame_times(float p_frame_time, float p
 	physics_frame_time = p_physics_frame_time;
 }
 
-
 ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL;
 
 ScriptDebuggerRemote::ScriptDebuggerRemote() :

+ 1 - 3
drivers/gles2/rasterizer_scene_gles2.cpp

@@ -42,8 +42,6 @@
 #define glClearDepth glClearDepthf
 #endif
 
-#define _DEPTH_COMPONENT24_OES 0x81A6
-
 static const GLenum _cube_side_enum[6] = {
 
 	GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
@@ -569,7 +567,7 @@ bool RasterizerSceneGLES2::reflection_probe_instance_begin_render(RID p_instance
 					glBindFramebuffer(GL_FRAMEBUFFER, rpi->fbo[i]);
 					glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _cube_side_enum[i], rpi->cubemap, 0);
 					glBindRenderbuffer(GL_RENDERBUFFER, rpi->depth);
-					glRenderbufferStorage(GL_RENDERBUFFER, _DEPTH_COMPONENT24_OES, size, size);
+					glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, size, size); // Note: used to be _DEPTH_COMPONENT24_OES. GL_DEPTH_COMPONENT untested.
 					glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rpi->depth);
 
 #ifdef DEBUG_ENABLED

+ 0 - 2
drivers/gles2/rasterizer_storage_gles2.cpp

@@ -54,8 +54,6 @@ GLuint RasterizerStorageGLES2::system_fbo = 0;
 
 #define _EXT_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
 
-#define _DEPTH_COMPONENT24_OES 0x81A6
-
 #define _RED_OES 0x1903
 
 void RasterizerStorageGLES2::bind_quad_array() const {

+ 1 - 1
drivers/gles2/shaders/canvas.glsl

@@ -349,7 +349,7 @@ void main() {
 	vec2 uv = uv_interp;
 #ifdef USE_FORCE_REPEAT
 	//needs to use this to workaround GLES2/WebGL1 forcing tiling that textures that dont support it
-	uv = mod(uv,vec2(1.0,1.0));
+	uv = mod(uv, vec2(1.0, 1.0));
 #endif
 
 #if !defined(COLOR_USED)

+ 1 - 1
drivers/gles2/shaders/cubemap_filter.glsl

@@ -194,7 +194,7 @@ void main() {
 	gl_FragColor = vec4(texturePanorama(source_panorama, N).rgb, 1.0);
 #else
 
-	gl_FragColor = vec4(textureCube(source_cube,N).rgb, 1.0);
+	gl_FragColor = vec4(textureCube(source_cube, N).rgb, 1.0);
 #endif //USE_SOURCE_PANORAMA
 
 #else

+ 0 - 4
drivers/gles2/shaders/scene.glsl

@@ -660,7 +660,6 @@ VERTEX_SHADER_CODE
 #if defined(RENDER_DEPTH) && defined(USE_RGBA_SHADOWS)
 	position_interp = gl_Position;
 #endif
-
 }
 
 /* clang-format off */
@@ -1358,12 +1357,9 @@ LIGHT_SHADER_CODE
 
 #endif
 
-
 #define SAMPLE_SHADOW_TEXEL(p_shadow, p_pos, p_depth) step(p_depth, SHADOW_DEPTH(texture2D(p_shadow, p_pos)))
 #define SAMPLE_SHADOW_TEXEL_PROJ(p_shadow, p_pos) step(p_pos.z, SHADOW_DEPTH(texture2DProj(p_shadow, p_pos)))
 
-
-
 float sample_shadow(highp sampler2D shadow, highp vec4 spos) {
 
 #ifdef SHADOW_MODE_PCF_13

+ 1 - 1
scene/resources/resource_format_text.cpp

@@ -1389,7 +1389,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
 
 			if (!p_main && (!bundle_resources) && res->get_path().length() && res->get_path().find("::") == -1) {
 				if (res->get_path() == local_path) {
-					ERR_PRINTS("Circular reference to resource being saved found: '"+local_path+"' will be null next time it's loaded.");
+					ERR_PRINTS("Circular reference to resource being saved found: '" + local_path + "' will be null next time it's loaded.");
 					return;
 				}
 				int index = external_resources.size();

+ 2 - 2
scene/resources/texture.cpp

@@ -427,7 +427,7 @@ ImageTexture::ImageTexture() {
 	storage = STORAGE_RAW;
 	lossy_storage_quality = 0.7;
 	image_stored = false;
-	format = Image::Format::FORMAT_L8;
+	format = Image::FORMAT_L8;
 }
 
 ImageTexture::~ImageTexture() {
@@ -1516,7 +1516,7 @@ CubeMap::CubeMap() {
 	cubemap = VisualServer::get_singleton()->texture_create();
 	storage = STORAGE_RAW;
 	lossy_storage_quality = 0.7;
-	format = Image::Format::FORMAT_BPTC_RGBA;
+	format = Image::FORMAT_BPTC_RGBA;
 }
 
 CubeMap::~CubeMap() {