diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/environment.cpp | 6 | ||||
-rw-r--r-- | scene/resources/environment.h | 8 | ||||
-rw-r--r-- | scene/resources/physics_material.cpp | 6 | ||||
-rw-r--r-- | scene/resources/physics_material.h | 16 | ||||
-rw-r--r-- | scene/resources/shape_3d.cpp | 12 | ||||
-rw-r--r-- | scene/resources/shape_3d.h | 2 | ||||
-rw-r--r-- | scene/resources/tile_set.h | 38 |
7 files changed, 31 insertions, 57 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 02ea5b24b8..4647c38e04 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1117,11 +1117,7 @@ void Environment::_bind_methods() { BIND_ENUM_CONSTANT(SSAO_BLUR_3x3); } -Environment::Environment() : - bg_mode(BG_CLEAR_COLOR), - tone_mapper(TONE_MAPPER_LINEAR), - ssao_blur(SSAO_BLUR_3x3), - glow_blend_mode(GLOW_BLEND_MODE_ADDITIVE) { +Environment::Environment() { environment = RS::get_singleton()->environment_create(); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 02434bc592..6d00560634 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -90,7 +90,7 @@ public: private: RID environment; - BGMode bg_mode; + BGMode bg_mode = BG_CLEAR_COLOR; Ref<Sky> bg_sky; float bg_sky_custom_fov; Vector3 sky_rotation; @@ -105,7 +105,7 @@ private: AmbientSource ambient_source; ReflectionSource reflection_source; - ToneMapper tone_mapper; + ToneMapper tone_mapper = TONE_MAPPER_LINEAR; float tonemap_exposure; float tonemap_white; bool tonemap_auto_exposure; @@ -132,7 +132,7 @@ private: float ssao_bias; float ssao_direct_light_affect; float ssao_ao_channel_affect; - SSAOBlur ssao_blur; + SSAOBlur ssao_blur = SSAO_BLUR_3x3; float ssao_edge_sharpness; bool glow_enabled; @@ -141,7 +141,7 @@ private: float glow_strength; float glow_mix; float glow_bloom; - GlowBlendMode glow_blend_mode; + GlowBlendMode glow_blend_mode = GLOW_BLEND_MODE_ADDITIVE; float glow_hdr_bleed_threshold; float glow_hdr_bleed_scale; float glow_hdr_luminance_cap; diff --git a/scene/resources/physics_material.cpp b/scene/resources/physics_material.cpp index 8ac0191452..89fbf7a248 100644 --- a/scene/resources/physics_material.cpp +++ b/scene/resources/physics_material.cpp @@ -69,9 +69,3 @@ void PhysicsMaterial::set_absorbent(bool p_val) { absorbent = p_val; emit_changed(); } - -PhysicsMaterial::PhysicsMaterial() : - friction(1), - rough(false), - bounce(0), - absorbent(false) {} diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h index f4a77d9854..1fac3fa6ef 100644 --- a/scene/resources/physics_material.h +++ b/scene/resources/physics_material.h @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef physics_material_override_H -#define physics_material_override_H +#ifndef PHYSICS_MATERIAL_H +#define PHYSICS_MATERIAL_H #include "core/resource.h" #include "servers/physics_server_3d.h" @@ -40,10 +40,10 @@ class PhysicsMaterial : public Resource { OBJ_SAVE_TYPE(PhysicsMaterial); RES_BASE_EXTENSION("phymat"); - real_t friction; - bool rough; - real_t bounce; - bool absorbent; + real_t friction = 1; + bool rough = false; + real_t bounce = 0; + bool absorbent = false; protected: static void _bind_methods(); @@ -69,7 +69,7 @@ public: return absorbent ? -bounce : bounce; } - PhysicsMaterial(); + PhysicsMaterial() {} }; -#endif // physics_material_override_H +#endif // PHYSICS_MATERIAL_H diff --git a/scene/resources/shape_3d.cpp b/scene/resources/shape_3d.cpp index f4a5d91e52..97d03b3cfc 100644 --- a/scene/resources/shape_3d.cpp +++ b/scene/resources/shape_3d.cpp @@ -109,19 +109,13 @@ void Shape3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin"); } -Shape3D::Shape3D() : - margin(0.04) { - - ERR_PRINT("Constructor must not be called!"); +Shape3D::Shape3D() { + ERR_PRINT("Default constructor must not be called!"); } Shape3D::Shape3D(RID p_shape) : - margin(0.04) { - - shape = p_shape; -} + shape(p_shape) {} Shape3D::~Shape3D() { - PhysicsServer3D::get_singleton()->free(shape); } diff --git a/scene/resources/shape_3d.h b/scene/resources/shape_3d.h index e7a516412d..6516868fd5 100644 --- a/scene/resources/shape_3d.h +++ b/scene/resources/shape_3d.h @@ -41,7 +41,7 @@ class Shape3D : public Resource { OBJ_SAVE_TYPE(Shape3D); RES_BASE_EXTENSION("shape"); RID shape; - real_t margin; + real_t margin = 0.04; Ref<ArrayMesh> debug_mesh_cache; diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 05b43dfb89..5f01959253 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -48,13 +48,10 @@ public: Ref<Shape2D> shape; Transform2D shape_transform; Vector2 autotile_coord; - bool one_way_collision; - float one_way_collision_margin; + bool one_way_collision = false; + float one_way_collision_margin = 1.0; - ShapeData() { - one_way_collision = false; - one_way_collision_margin = 1.0; - } + ShapeData() {} }; enum BitmaskMode { @@ -92,22 +89,18 @@ public: }; struct AutotileData { - BitmaskMode bitmask_mode; - Size2 size; - int spacing; - Vector2 icon_coord; + BitmaskMode bitmask_mode = BITMASK_2X2; + // Default size to prevent invalid value + Size2 size = Size2(64, 64); + Vector2 icon_coord = Vector2(0, 0); + int spacing = 0; Map<Vector2, uint32_t> flags; Map<Vector2, Ref<OccluderPolygon2D>> occluder_map; Map<Vector2, Ref<NavigationPolygon>> navpoly_map; Map<Vector2, int> priority_map; Map<Vector2, int> z_index_map; - // Default size to prevent invalid value - explicit AutotileData() : - bitmask_mode(BITMASK_2X2), - size(64, 64), - spacing(0), - icon_coord(0, 0) {} + explicit AutotileData() {} }; private: @@ -124,16 +117,13 @@ private: Vector2 navigation_polygon_offset; Ref<NavigationPolygon> navigation_polygon; Ref<ShaderMaterial> material; - TileMode tile_mode; - Color modulate; + TileMode tile_mode = SINGLE_TILE; + // Default modulate for back-compat + Color modulate = Color(1, 1, 1); AutotileData autotile_data; - int z_index; + int z_index = 0; - // Default modulate for back-compat - explicit TileData() : - tile_mode(SINGLE_TILE), - modulate(1, 1, 1), - z_index(0) {} + explicit TileData() {} }; Map<int, TileData> tile_map; |