Initialize class variables with default values in scene/ [1/2]

This commit is contained in:
Rafał Mikrut 2021-02-07 22:29:31 +01:00
parent 57e2822a05
commit 003bb8e1a8
139 changed files with 871 additions and 1652 deletions

View file

@ -712,15 +712,4 @@ void AnimatedSprite2D::_bind_methods() {
}
AnimatedSprite2D::AnimatedSprite2D() {
centered = true;
hflip = false;
vflip = false;
frame = 0;
speed_scale = 1.0f;
playing = false;
backwards = false;
animation = "default";
timeout = 0;
is_over = false;
}

View file

@ -38,14 +38,9 @@ class SpriteFrames : public Resource {
GDCLASS(SpriteFrames, Resource);
struct Anim {
float speed;
bool loop;
float speed = 5.0;
bool loop = true;
Vector<Ref<Texture2D>> frames;
Anim() {
loop = true;
speed = 5;
}
};
Map<StringName, Anim> animations;
@ -109,20 +104,20 @@ class AnimatedSprite2D : public Node2D {
GDCLASS(AnimatedSprite2D, Node2D);
Ref<SpriteFrames> frames;
bool playing;
bool backwards;
StringName animation;
int frame;
float speed_scale;
bool playing = false;
bool backwards = false;
StringName animation = "default";
int frame = 0;
float speed_scale = 1.0f;
bool centered;
bool centered = true;
Point2 offset;
bool is_over;
float timeout;
bool is_over = false;
float timeout = 0.0;
bool hflip;
bool vflip;
bool hflip = false;
bool vflip = false;
void _res_changed();

View file

@ -627,20 +627,8 @@ void Area2D::_bind_methods() {
Area2D::Area2D() :
CollisionObject2D(PhysicsServer2D::get_singleton()->area_create(), true) {
space_override = SPACE_OVERRIDE_DISABLED;
set_gravity(98);
set_gravity_vector(Vector2(0, 1));
gravity_is_point = false;
gravity_distance_scale = 0;
linear_damp = 0.1;
angular_damp = 1;
locked = false;
priority = 0;
monitoring = false;
monitorable = false;
collision_mask = 1;
collision_layer = 1;
audio_bus_override = false;
set_monitoring(true);
set_monitorable(true);
}

View file

@ -47,19 +47,19 @@ public:
};
private:
SpaceOverride space_override;
SpaceOverride space_override = SPACE_OVERRIDE_DISABLED;
Vector2 gravity_vec;
real_t gravity;
bool gravity_is_point;
real_t gravity_distance_scale;
real_t linear_damp;
real_t angular_damp;
uint32_t collision_mask;
uint32_t collision_layer;
int priority;
bool monitoring;
bool monitorable;
bool locked;
bool gravity_is_point = false;
real_t gravity_distance_scale = 0.0;
real_t linear_damp = 0.1;
real_t angular_damp = 1.0;
uint32_t collision_mask = 1;
uint32_t collision_layer = 1;
int priority = 0;
bool monitoring = false;
bool monitorable = false;
bool locked = false;
void _body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape);
@ -67,8 +67,8 @@ private:
void _body_exit_tree(ObjectID p_id);
struct ShapePair {
int body_shape;
int area_shape;
int body_shape = 0;
int area_shape = 0;
bool operator<(const ShapePair &p_sp) const {
if (body_shape == p_sp.body_shape) {
return area_shape < p_sp.area_shape;
@ -85,8 +85,8 @@ private:
};
struct BodyState {
int rc;
bool in_tree;
int rc = 0;
bool in_tree = false;
VSet<ShapePair> shapes;
};
@ -98,8 +98,8 @@ private:
void _area_exit_tree(ObjectID p_id);
struct AreaShapePair {
int area_shape;
int self_shape;
int area_shape = 0;
int self_shape = 0;
bool operator<(const AreaShapePair &p_sp) const {
if (area_shape == p_sp.area_shape) {
return self_shape < p_sp.self_shape;
@ -116,15 +116,15 @@ private:
};
struct AreaState {
int rc;
bool in_tree;
int rc = 0;
bool in_tree = false;
VSet<AreaShapePair> shapes;
};
Map<ObjectID, AreaState> area_map;
void _clear_monitoring();
bool audio_bus_override;
bool audio_bus_override = false;
StringName audio_bus;
protected:

View file

@ -503,21 +503,6 @@ void AudioStreamPlayer2D::_bind_methods() {
}
AudioStreamPlayer2D::AudioStreamPlayer2D() {
volume_db = 0;
pitch_scale = 1.0;
autoplay = false;
setseek = -1;
active = false;
output_count = 0;
prev_output_count = 0;
max_distance = 2000;
attenuation = 1;
setplay = -1;
output_ready = false;
area_mask = 1;
stream_paused = false;
stream_paused_fade_in = false;
stream_paused_fade_out = false;
AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer2D::_bus_layout_changed));
}

View file

@ -47,32 +47,32 @@ private:
struct Output {
AudioFrame vol;
int bus_index;
Viewport *viewport; //pointer only used for reference to previous mix
int bus_index = 0;
Viewport *viewport = nullptr; //pointer only used for reference to previous mix
};
Output outputs[MAX_OUTPUTS];
volatile int output_count;
volatile bool output_ready;
volatile int output_count = 0;
volatile bool output_ready = false;
//these are used by audio thread to have a reference of previous volumes (for ramping volume and avoiding clicks)
Output prev_outputs[MAX_OUTPUTS];
int prev_output_count;
int prev_output_count = 0;
Ref<AudioStreamPlayback> stream_playback;
Ref<AudioStream> stream;
Vector<AudioFrame> mix_buffer;
volatile float setseek;
volatile bool active;
volatile float setplay;
volatile float setseek = -1.0;
volatile bool active = false;
volatile float setplay = -1.0;
float volume_db;
float pitch_scale;
bool autoplay;
bool stream_paused;
bool stream_paused_fade_in;
bool stream_paused_fade_out;
float volume_db = 0.0;
float pitch_scale = 1.0;
bool autoplay = false;
bool stream_paused = false;
bool stream_paused_fade_in = false;
bool stream_paused_fade_out = false;
StringName bus;
void _mix_audio();
@ -83,10 +83,10 @@ private:
void _bus_layout_changed();
uint32_t area_mask;
uint32_t area_mask = 1;
float max_distance;
float attenuation;
float max_distance = 2000.0;
float attenuation = 1.0;
protected:
void _validate_property(PropertyInfo &property) const override;

View file

@ -93,8 +93,6 @@ void BackBufferCopy::_bind_methods() {
}
BackBufferCopy::BackBufferCopy() {
rect = Rect2(-100, -100, 200, 200);
copy_mode = COPY_MODE_RECT;
_update_copy_mode();
}

View file

@ -44,8 +44,8 @@ public:
};
private:
Rect2 rect;
CopyMode copy_mode;
Rect2 rect = Rect2(-100, -100, 200, 200);
CopyMode copy_mode = COPY_MODE_RECT;
void _update_copy_mode();

View file

@ -749,9 +749,6 @@ void Camera2D::_bind_methods() {
}
Camera2D::Camera2D() {
anchor_mode = ANCHOR_MODE_DRAG_CENTER;
rotating = false;
current = false;
limit[SIDE_LEFT] = -10000000;
limit[SIDE_TOP] = -10000000;
limit[SIDE_RIGHT] = 10000000;
@ -761,27 +758,6 @@ Camera2D::Camera2D() {
drag_margin[SIDE_TOP] = 0.2;
drag_margin[SIDE_RIGHT] = 0.2;
drag_margin[SIDE_BOTTOM] = 0.2;
camera_pos = Vector2();
first = true;
smoothing_enabled = false;
limit_smoothing_enabled = false;
custom_viewport = nullptr;
process_mode = CAMERA2D_PROCESS_IDLE;
smoothing = 5.0;
zoom = Vector2(1, 1);
screen_drawing_enabled = true;
limit_drawing_enabled = false;
margin_drawing_enabled = false;
drag_horizontal_enabled = false;
drag_vertical_enabled = false;
drag_horizontal_offset = 0;
drag_vertical_offset = 0;
drag_horizontal_offset_changed = false;
drag_vertical_offset_changed = false;
set_notify_transform(true);
}

View file

@ -51,32 +51,32 @@ public:
protected:
Point2 camera_pos;
Point2 smoothed_camera_pos;
bool first;
bool first = true;
ObjectID custom_viewport_id; // to check validity
Viewport *custom_viewport;
Viewport *viewport;
Viewport *custom_viewport = nullptr;
Viewport *viewport = nullptr;
StringName group_name;
StringName canvas_group_name;
RID canvas;
Vector2 offset;
Vector2 zoom;
AnchorMode anchor_mode;
bool rotating;
bool current;
float smoothing;
bool smoothing_enabled;
Vector2 zoom = Vector2(1, 1);
AnchorMode anchor_mode = ANCHOR_MODE_DRAG_CENTER;
bool rotating = false;
bool current = false;
float smoothing = 5.0;
bool smoothing_enabled = false;
int limit[4];
bool limit_smoothing_enabled;
bool limit_smoothing_enabled = false;
float drag_margin[4];
bool drag_horizontal_enabled;
bool drag_vertical_enabled;
float drag_horizontal_offset;
float drag_vertical_offset;
bool drag_horizontal_offset_changed;
bool drag_vertical_offset_changed;
bool drag_horizontal_enabled = false;
bool drag_vertical_enabled = false;
float drag_horizontal_offset = 0.0;
float drag_vertical_offset = 0.0;
bool drag_horizontal_offset_changed = false;
bool drag_vertical_offset_changed = false;
Point2 camera_screen_center;
void _update_process_mode();
@ -87,11 +87,11 @@ protected:
void _set_old_smoothing(float p_enable);
bool screen_drawing_enabled;
bool limit_drawing_enabled;
bool margin_drawing_enabled;
bool screen_drawing_enabled = true;
bool limit_drawing_enabled = false;
bool margin_drawing_enabled = false;
Camera2DProcessMode process_mode;
Camera2DProcessMode process_mode = CAMERA2D_PROCESS_IDLE;
Size2 _get_camera_screen_size() const;

View file

@ -94,7 +94,6 @@ String CanvasModulate::get_configuration_warning() const {
}
CanvasModulate::CanvasModulate() {
color = Color(1, 1, 1, 1);
}
CanvasModulate::~CanvasModulate() {

View file

@ -36,7 +36,7 @@
class CanvasModulate : public Node2D {
GDCLASS(CanvasModulate, Node2D);
Color color;
Color color = Color(1, 1, 1, 1);
protected:
void _notification(int p_what);

View file

@ -37,35 +37,29 @@
class CollisionObject2D : public Node2D {
GDCLASS(CollisionObject2D, Node2D);
bool area;
bool area = false;
RID rid;
bool pickable;
bool pickable = false;
struct ShapeData {
Object *owner;
Object *owner = nullptr;
Transform2D xform;
struct Shape {
Ref<Shape2D> shape;
int index;
int index = 0;
};
Vector<Shape> shapes;
bool disabled;
bool one_way_collision;
real_t one_way_collision_margin;
ShapeData() {
disabled = false;
one_way_collision = false;
one_way_collision_margin = 0;
owner = nullptr;
}
bool disabled = false;
bool one_way_collision = false;
real_t one_way_collision_margin = 0.0;
};
int total_subshapes;
int total_subshapes = 0;
Map<uint32_t, ShapeData> shapes;
bool only_update_transform_changes; //this is used for sync physics in KinematicBody
bool only_update_transform_changes = false; //this is used for sync physics in KinematicBody
protected:
CollisionObject2D(RID p_rid, bool p_area);

View file

@ -310,12 +310,5 @@ void CollisionPolygon2D::_bind_methods() {
}
CollisionPolygon2D::CollisionPolygon2D() {
aabb = Rect2(-10, -10, 20, 20);
build_mode = BUILD_SOLIDS;
set_notify_local_transform(true);
parent = nullptr;
owner_id = 0;
disabled = false;
one_way_collision = false;
one_way_collision_margin = 1.0;
}

View file

@ -46,14 +46,14 @@ public:
};
protected:
Rect2 aabb;
BuildMode build_mode;
Rect2 aabb = Rect2(-10, -10, 20, 20);
BuildMode build_mode = BUILD_SOLIDS;
Vector<Point2> polygon;
uint32_t owner_id;
CollisionObject2D *parent;
bool disabled;
bool one_way_collision;
real_t one_way_collision_margin;
uint32_t owner_id = 0;
CollisionObject2D *parent = nullptr;
bool disabled = false;
bool one_way_collision = false;
real_t one_way_collision_margin = 1.0;
Vector<Vector<Vector2>> _decompose_in_convex();

View file

@ -243,11 +243,5 @@ void CollisionShape2D::_bind_methods() {
}
CollisionShape2D::CollisionShape2D() {
rect = Rect2(-Point2(10, 10), Point2(20, 20));
set_notify_local_transform(true);
owner_id = 0;
parent = nullptr;
disabled = false;
one_way_collision = false;
one_way_collision_margin = 1.0;
}

View file

@ -39,13 +39,13 @@ class CollisionObject2D;
class CollisionShape2D : public Node2D {
GDCLASS(CollisionShape2D, Node2D);
Ref<Shape2D> shape;
Rect2 rect;
uint32_t owner_id;
CollisionObject2D *parent;
Rect2 rect = Rect2(-Point2(10, 10), Point2(20, 20));
uint32_t owner_id = 0;
CollisionObject2D *parent = nullptr;
void _shape_changed();
bool disabled;
bool one_way_collision;
real_t one_way_collision_margin;
bool disabled = false;
bool one_way_collision = false;
real_t one_way_collision_margin = 1.0;
void _update_in_shape_owner(bool p_xform_only = false);

View file

@ -1369,34 +1369,14 @@ void CPUParticles2D::_bind_methods() {
}
CPUParticles2D::CPUParticles2D() {
time = 0;
inactive_time = 0;
frame_remainder = 0;
cycle = 0;
redraw = false;
emitting = false;
mesh = RenderingServer::get_singleton()->mesh_create();
multimesh = RenderingServer::get_singleton()->multimesh_create();
RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh);
set_emitting(true);
set_one_shot(false);
set_amount(8);
set_lifetime(1);
set_fixed_fps(0);
set_fractional_delta(true);
set_pre_process_time(0);
set_explosiveness_ratio(0);
set_randomness_ratio(0);
set_lifetime_randomness(0);
set_use_local_coordinates(true);
set_draw_order(DRAW_ORDER_INDEX);
set_speed_scale(1);
set_direction(Vector2(1, 0));
set_spread(45);
set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
@ -1409,11 +1389,6 @@ CPUParticles2D::CPUParticles2D() {
set_param(PARAM_HUE_VARIATION, 0);
set_param(PARAM_ANIM_SPEED, 0);
set_param(PARAM_ANIM_OFFSET, 0);
set_emission_shape(EMISSION_SHAPE_POINT);
set_emission_sphere_radius(1);
set_emission_rect_extents(Vector2(1, 1));
set_gravity(Vector2(0, 98));
for (int i = 0; i < PARAM_MAX; i++) {
set_param_randomness(Parameter(i), 0);

View file

@ -78,31 +78,31 @@ public:
};
private:
bool emitting;
bool emitting = false;
struct Particle {
Transform2D transform;
Color color;
float custom[4];
float rotation;
float custom[4] = {};
float rotation = 0.0;
Vector2 velocity;
bool active;
float angle_rand;
float scale_rand;
float hue_rot_rand;
float anim_offset_rand;
float time;
float lifetime;
bool active = false;
float angle_rand = 0.0;
float scale_rand = 0.0;
float hue_rot_rand = 0.0;
float anim_offset_rand = 0.0;
float time = 0.0;
float lifetime = 0.0;
Color base_color;
uint32_t seed;
uint32_t seed = 0;
};
float time;
float inactive_time;
float frame_remainder;
int cycle;
bool redraw;
float time = 0.0;
float inactive_time = 0.0;
float frame_remainder = 0.0;
int cycle = 0;
bool redraw = false;
RID mesh;
RID multimesh;
@ -112,7 +112,7 @@ private:
Vector<int> particle_order;
struct SortLifetime {
const Particle *particles;
const Particle *particles = nullptr;
bool operator()(int p_a, int p_b) const {
return particles[p_a].time > particles[p_b].time;
@ -120,7 +120,7 @@ private:
};
struct SortAxis {
const Particle *particles;
const Particle *particles = nullptr;
Vector2 axis;
bool operator()(int p_a, int p_b) const {
return axis.dot(particles[p_a].transform[2]) < axis.dot(particles[p_b].transform[2]);
@ -129,28 +129,28 @@ private:
//
bool one_shot;
bool one_shot = false;
float lifetime;
float pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
float lifetime_randomness;
float speed_scale;
float lifetime = 1.0;
float pre_process_time = 0.0;
float explosiveness_ratio = 0.0;
float randomness_ratio = 0.0;
float lifetime_randomness = 0.0;
float speed_scale = 1.0;
bool local_coords;
int fixed_fps;
bool fractional_delta;
int fixed_fps = 0;
bool fractional_delta = true;
Transform2D inv_emission_transform;
DrawOrder draw_order;
DrawOrder draw_order = DRAW_ORDER_INDEX;
Ref<Texture2D> texture;
////////
Vector2 direction;
float spread;
Vector2 direction = Vector2(1, 0);
float spread = 45.0;
float parameters[PARAM_MAX];
float randomness[PARAM_MAX];
@ -161,15 +161,15 @@ private:
bool particle_flags[PARTICLE_FLAG_MAX];
EmissionShape emission_shape;
float emission_sphere_radius;
Vector2 emission_rect_extents;
EmissionShape emission_shape = EMISSION_SHAPE_POINT;
float emission_sphere_radius = 1.0;
Vector2 emission_rect_extents = Vector2(1, 1);
Vector<Vector2> emission_points;
Vector<Vector2> emission_normals;
Vector<Color> emission_colors;
int emission_point_count;
int emission_point_count = 0;
Vector2 gravity;
Vector2 gravity = Vector2(0, 98);
void _update_internal();
void _particles_process(float p_delta);

View file

@ -249,8 +249,6 @@ void Joint2D::_bind_methods() {
}
Joint2D::Joint2D() {
bias = 0;
exclude_from_collision = true;
}
///////////////////////////////////////////////////////////////////////////////
@ -300,7 +298,6 @@ void PinJoint2D::_bind_methods() {
}
PinJoint2D::PinJoint2D() {
softness = 0;
}
///////////////////////////////////////////////////////////////////////////////
@ -364,8 +361,6 @@ void GrooveJoint2D::_bind_methods() {
}
GrooveJoint2D::GrooveJoint2D() {
length = 50;
initial_offset = 25;
}
///////////////////////////////////////////////////////////////////////////////
@ -467,8 +462,4 @@ void DampedSpringJoint2D::_bind_methods() {
}
DampedSpringJoint2D::DampedSpringJoint2D() {
length = 50;
rest_length = 0;
stiffness = 20;
damping = 1;
}

View file

@ -43,9 +43,9 @@ class Joint2D : public Node2D {
NodePath a;
NodePath b;
real_t bias;
real_t bias = 0.0;
bool exclude_from_collision;
bool exclude_from_collision = true;
String warning;
protected:
@ -80,7 +80,7 @@ public:
class PinJoint2D : public Joint2D {
GDCLASS(PinJoint2D, Joint2D);
real_t softness;
real_t softness = 0.0;
protected:
void _notification(int p_what);
@ -97,8 +97,8 @@ public:
class GrooveJoint2D : public Joint2D {
GDCLASS(GrooveJoint2D, Joint2D);
real_t length;
real_t initial_offset;
real_t length = 50.0;
real_t initial_offset = 25.0;
protected:
void _notification(int p_what);
@ -118,10 +118,10 @@ public:
class DampedSpringJoint2D : public Joint2D {
GDCLASS(DampedSpringJoint2D, Joint2D);
real_t stiffness;
real_t damping;
real_t rest_length;
real_t length;
real_t stiffness = 20.0;
real_t damping = 1.0;
real_t rest_length = 0.0;
real_t length = 50.0;
protected:
void _notification(int p_what);

View file

@ -300,22 +300,6 @@ void Light2D::_bind_methods() {
Light2D::Light2D() {
canvas_light = RenderingServer::get_singleton()->canvas_light_create();
enabled = true;
editor_only = false;
shadow = false;
color = Color(1, 1, 1);
height = 0;
z_min = -1024;
z_max = 1024;
layer_min = 0;
layer_max = 0;
item_mask = 1;
item_shadow_mask = 1;
energy = 1.0;
shadow_color = Color(0, 0, 0, 0);
shadow_filter = SHADOW_FILTER_NONE;
shadow_smooth = 0;
blend_mode = BLEND_MODE_ADD;
set_notify_transform(true);
}

View file

@ -52,24 +52,24 @@ public:
private:
RID canvas_light;
bool enabled;
bool editor_only;
bool shadow;
Color color;
Color shadow_color;
float height;
float energy;
int z_min;
int z_max;
int layer_min;
int layer_max;
int item_mask;
int item_shadow_mask;
float shadow_smooth;
bool enabled = true;
bool editor_only = false;
bool shadow = false;
Color color = Color(1, 1, 1);
Color shadow_color = Color(0, 0, 0, 0);
float height = 0.0;
float energy = 1.0;
int z_min = -1024;
int z_max = 1024;
int layer_min = 0;
int layer_max = 0;
int item_mask = 1;
int item_shadow_mask = 1;
float shadow_smooth = 0.0;
Ref<Texture2D> texture;
Vector2 texture_offset;
ShadowFilter shadow_filter;
BlendMode blend_mode;
ShadowFilter shadow_filter = SHADOW_FILTER_NONE;
BlendMode blend_mode = BLEND_MODE_ADD;
void _update_light_visibility();

View file

@ -145,9 +145,6 @@ void OccluderPolygon2D::_bind_methods() {
OccluderPolygon2D::OccluderPolygon2D() {
occ_polygon = RS::get_singleton()->canvas_occluder_polygon_create();
closed = true;
cull = CULL_DISABLED;
rect_cache_dirty = true;
}
OccluderPolygon2D::~OccluderPolygon2D() {

View file

@ -46,11 +46,11 @@ public:
private:
RID occ_polygon;
Vector<Vector2> polygon;
bool closed;
CullMode cull;
bool closed = true;
CullMode cull = CULL_DISABLED;
mutable Rect2 item_rect;
mutable bool rect_cache_dirty;
mutable bool rect_cache_dirty = true;
protected:
static void _bind_methods();

View file

@ -40,15 +40,6 @@ VARIANT_ENUM_CAST(Line2D::LineCapMode)
VARIANT_ENUM_CAST(Line2D::LineTextureMode)
Line2D::Line2D() {
_joint_mode = LINE_JOINT_SHARP;
_begin_cap_mode = LINE_CAP_NONE;
_end_cap_mode = LINE_CAP_NONE;
_width = 10;
_default_color = Color(1, 1, 1);
_texture_mode = LINE_TEXTURE_NONE;
_sharp_limit = 2.f;
_round_precision = 8;
_antialiased = false;
}
#ifdef TOOLS_ENABLED

View file

@ -124,18 +124,18 @@ private:
private:
Vector<Vector2> _points;
LineJointMode _joint_mode;
LineCapMode _begin_cap_mode;
LineCapMode _end_cap_mode;
float _width;
LineJointMode _joint_mode = LINE_JOINT_SHARP;
LineCapMode _begin_cap_mode = LINE_CAP_NONE;
LineCapMode _end_cap_mode = LINE_CAP_NONE;
float _width = 10.0;
Ref<Curve> _curve;
Color _default_color;
Color _default_color = Color(1, 1, 1);
Ref<Gradient> _gradient;
Ref<Texture2D> _texture;
LineTextureMode _texture_mode;
float _sharp_limit;
int _round_precision;
bool _antialiased;
LineTextureMode _texture_mode = LINE_TEXTURE_NONE;
float _sharp_limit = 2.f;
int _round_precision = 8;
bool _antialiased = false;
};
#endif // LINE2D_H

View file

@ -94,20 +94,6 @@ static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) {
//----------------------------------------------------------------------------
LineBuilder::LineBuilder() {
joint_mode = Line2D::LINE_JOINT_SHARP;
width = 10;
curve = nullptr;
default_color = Color(0.4, 0.5, 1);
gradient = nullptr;
sharp_limit = 2.f;
round_precision = 8;
begin_cap_mode = Line2D::LINE_CAP_NONE;
end_cap_mode = Line2D::LINE_CAP_NONE;
tile_aspect = 1.f;
_interpolate_color = false;
_last_index[0] = 0;
_last_index[1] = 0;
}
void LineBuilder::clear_output() {

View file

@ -41,17 +41,17 @@ public:
// TODO Move in a struct and reference it
// Input
Vector<Vector2> points;
Line2D::LineJointMode joint_mode;
Line2D::LineCapMode begin_cap_mode;
Line2D::LineCapMode end_cap_mode;
float width;
Curve *curve;
Color default_color;
Gradient *gradient;
Line2D::LineTextureMode texture_mode;
float sharp_limit;
int round_precision;
float tile_aspect; // w/h
Line2D::LineJointMode joint_mode = Line2D::LINE_JOINT_SHARP;
Line2D::LineCapMode begin_cap_mode = Line2D::LINE_CAP_NONE;
Line2D::LineCapMode end_cap_mode = Line2D::LINE_CAP_NONE;
float width = 10.0;
Curve *curve = nullptr;
Color default_color = Color(0.4, 0.5, 1);
Gradient *gradient = nullptr;
Line2D::LineTextureMode texture_mode = Line2D::LineTextureMode::LINE_TEXTURE_NONE;
float sharp_limit = 2.f;
int round_precision = 8;
float tile_aspect = 1.f; // w/h
// TODO offset_joints option (offers alternative implementation of round joints)
// TODO Move in a struct and reference it
@ -82,8 +82,8 @@ private:
void new_arc(Vector2 center, Vector2 vbegin, float angle_delta, Color color, Rect2 uv_rect);
private:
bool _interpolate_color;
int _last_index[2]; // Index of last up and down vertices of the strip
bool _interpolate_color = false;
int _last_index[2] = {}; // Index of last up and down vertices of the strip
};
#endif // LINE_BUILDER_H

View file

@ -37,9 +37,9 @@ class Node2D : public CanvasItem {
GDCLASS(Node2D, CanvasItem);
Point2 pos;
float angle = 0;
float angle = 0.0;
Size2 _scale = Vector2(1, 1);
float skew = 0;
float skew = 0.0;
int z_index = 0;
bool z_relative = true;

View file

@ -185,9 +185,5 @@ void ParallaxBackground::_bind_methods() {
}
ParallaxBackground::ParallaxBackground() {
scale = 1.0;
set_layer(-100); //behind all by default
base_scale = Vector2(1, 1);
ignore_camera_zoom = false;
}

View file

@ -39,15 +39,15 @@ class ParallaxBackground : public CanvasLayer {
GDCLASS(ParallaxBackground, CanvasLayer);
Point2 offset;
float scale;
float scale = 1.0;
Point2 base_offset;
Point2 base_scale;
Point2 base_scale = Vector2(1, 1);
Point2 screen_offset;
String group_name;
Point2 limit_begin;
Point2 limit_end;
Point2 final_offset;
bool ignore_camera_zoom;
bool ignore_camera_zoom = false;
void _update_scroll();

View file

@ -163,5 +163,4 @@ void ParallaxLayer::_bind_methods() {
}
ParallaxLayer::ParallaxLayer() {
motion_scale = Size2(1, 1);
}

View file

@ -38,7 +38,7 @@ class ParallaxLayer : public Node2D {
Point2 orig_offset;
Point2 orig_scale;
Size2 motion_scale;
Size2 motion_scale = Size2(1, 1);
Vector2 motion_offset;
Vector2 mirroring;
void _update_mirroring();

View file

@ -240,7 +240,7 @@ bool PathFollow2D::get_cubic_interpolation() const {
void PathFollow2D::_validate_property(PropertyInfo &property) const {
if (property.name == "offset") {
float max = 10000;
float max = 10000.0;
if (path && path->get_curve().is_valid()) {
max = path->get_curve()->get_baked_length();
}

View file

@ -64,10 +64,10 @@ class PathFollow2D : public Node2D {
public:
private:
Path2D *path = nullptr;
real_t offset = 0;
real_t h_offset = 0;
real_t v_offset = 0;
real_t lookahead = 4;
real_t offset = 0.0;
real_t h_offset = 0.0;
real_t v_offset = 0.0;
real_t lookahead = 4.0;
bool cubic = true;
bool loop = true;
bool rotates = true;

View file

@ -111,8 +111,6 @@ bool PhysicsBody2D::get_collision_layer_bit(int p_bit) const {
PhysicsBody2D::PhysicsBody2D(PhysicsServer2D::BodyMode p_mode) :
CollisionObject2D(PhysicsServer2D::get_singleton()->body_create(), false) {
PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), p_mode);
collision_layer = 1;
collision_mask = 1;
set_pickable(false);
}
@ -197,7 +195,6 @@ void StaticBody2D::_bind_methods() {
StaticBody2D::StaticBody2D() :
PhysicsBody2D(PhysicsServer2D::BODY_MODE_STATIC) {
constant_angular_velocity = 0;
}
StaticBody2D::~StaticBody2D() {
@ -320,8 +317,8 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap
struct _RigidBody2DInOut {
ObjectID id;
int shape;
int local_shape;
int shape = 0;
int local_shape = 0;
};
bool RigidBody2D::_test_motion(const Vector2 &p_motion, bool p_infinite_inertia, real_t p_margin, const Ref<PhysicsTestMotionResult2D> &p_result) {
@ -841,25 +838,6 @@ void RigidBody2D::_bind_methods() {
RigidBody2D::RigidBody2D() :
PhysicsBody2D(PhysicsServer2D::BODY_MODE_RIGID) {
mode = MODE_RIGID;
mass = 1;
gravity_scale = 1;
linear_damp = -1;
angular_damp = -1;
max_contacts_reported = 0;
state = nullptr;
angular_velocity = 0;
sleeping = false;
ccd_mode = CCD_MODE_DISABLED;
custom_integrator = false;
contact_monitor = nullptr;
can_sleep = true;
PhysicsServer2D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
}

View file

@ -41,8 +41,8 @@ class KinematicCollision2D;
class PhysicsBody2D : public CollisionObject2D {
GDCLASS(PhysicsBody2D, CollisionObject2D);
uint32_t collision_layer;
uint32_t collision_mask;
uint32_t collision_layer = 1;
uint32_t collision_mask = 1;
protected:
void _notification(int p_what);
@ -74,7 +74,7 @@ class StaticBody2D : public PhysicsBody2D {
GDCLASS(StaticBody2D, PhysicsBody2D);
Vector2 constant_linear_velocity;
real_t constant_angular_velocity;
real_t constant_angular_velocity = 0.0;
Ref<PhysicsMaterial> physics_material_override;
@ -116,30 +116,30 @@ public:
};
private:
bool can_sleep;
PhysicsDirectBodyState2D *state;
Mode mode;
bool can_sleep = true;
PhysicsDirectBodyState2D *state = nullptr;
Mode mode = MODE_RIGID;
real_t mass;
real_t mass = 1.0;
Ref<PhysicsMaterial> physics_material_override;
real_t gravity_scale;
real_t linear_damp;
real_t angular_damp;
real_t gravity_scale = 1.0;
real_t linear_damp = -1.0;
real_t angular_damp = -1.0;
Vector2 linear_velocity;
real_t angular_velocity;
bool sleeping;
real_t angular_velocity = 0.0;
bool sleeping = false;
int max_contacts_reported;
int max_contacts_reported = 0;
bool custom_integrator;
bool custom_integrator = false;
CCDMode ccd_mode;
CCDMode ccd_mode = CCD_MODE_DISABLED;
struct ShapePair {
int body_shape;
int local_shape;
bool tagged;
int body_shape = 0;
int local_shape = 0;
bool tagged = false;
bool operator<(const ShapePair &p_sp) const {
if (body_shape == p_sp.body_shape) {
return local_shape < p_sp.local_shape;
@ -160,16 +160,16 @@ private:
};
struct BodyState {
//int rc;
bool in_scene;
bool in_scene = false;
VSet<ShapePair> shapes;
};
struct ContactMonitor {
bool locked;
bool locked = false;
Map<ObjectID, BodyState> body_map;
};
ContactMonitor *contact_monitor;
ContactMonitor *contact_monitor = nullptr;
void _body_enter_tree(ObjectID p_id);
void _body_exit_tree(ObjectID p_id);
@ -268,11 +268,11 @@ public:
Vector2 collider_vel;
ObjectID collider;
RID collider_rid;
int collider_shape;
int collider_shape = 0;
Variant collider_metadata;
Vector2 remainder;
Vector2 travel;
int local_shape;
int local_shape = 0;
};
private:

View file

@ -155,7 +155,7 @@ void Polygon2D::_notification(int p_what) {
Rect2 bounds;
int highest_idx = -1;
float highest_y = -1e20;
float sum = 0;
float sum = 0.0;
for (int i = 0; i < len; i++) {
if (i == 0) {
@ -273,7 +273,7 @@ void Polygon2D::_notification(int p_what) {
//normalize the weights
for (int i = 0; i < vc; i++) {
float tw = 0;
float tw = 0.0;
for (int j = 0; j < 4; j++) {
tw += weightsw[i * 4 + j];
}
@ -649,13 +649,4 @@ void Polygon2D::_bind_methods() {
}
Polygon2D::Polygon2D() {
invert = false;
invert_border = 100;
antialiased = false;
tex_rot = 0;
tex_tile = true;
tex_scale = Vector2(1, 1);
color = Color(1, 1, 1);
rect_cache_dirty = true;
internal_vertices = 0;
}

View file

@ -40,7 +40,7 @@ class Polygon2D : public Node2D {
Vector<Vector2> uv;
Vector<Color> vertex_colors;
Array polygons;
int internal_vertices;
int internal_vertices = 0;
struct Bone {
NodePath path;
@ -49,19 +49,19 @@ class Polygon2D : public Node2D {
Vector<Bone> bone_weights;
Color color;
Color color = Color(1, 1, 1);
Ref<Texture2D> texture;
Size2 tex_scale;
Size2 tex_scale = Vector2(1, 1);
Vector2 tex_ofs;
bool tex_tile;
float tex_rot;
bool invert;
float invert_border;
bool antialiased;
bool tex_tile = true;
float tex_rot = 0.0;
bool invert = false;
float invert_border = 100.0;
bool antialiased = false;
Vector2 offset;
mutable bool rect_cache_dirty;
mutable bool rect_cache_dirty = true;
mutable Rect2 item_rect;
NodePath skeleton;

View file

@ -173,7 +173,7 @@ void RayCast2D::_notification(int p_what) {
}
draw_line(Vector2(), target_position, draw_col, 2);
Vector<Vector2> pts;
float tsize = 8;
float tsize = 8.0;
pts.push_back(xf.xform(Vector2(tsize, 0)));
pts.push_back(xf.xform(Vector2(0, Math_SQRT12 * tsize)));
pts.push_back(xf.xform(Vector2(0, -Math_SQRT12 * tsize)));
@ -325,12 +325,4 @@ void RayCast2D::_bind_methods() {
}
RayCast2D::RayCast2D() {
enabled = true;
collided = false;
against_shape = 0;
collision_mask = 1;
target_position = Vector2(0, 50);
exclude_parent_body = true;
collide_with_bodies = true;
collide_with_areas = false;
}

View file

@ -36,20 +36,20 @@
class RayCast2D : public Node2D {
GDCLASS(RayCast2D, Node2D);
bool enabled;
bool collided;
bool enabled = true;
bool collided = false;
ObjectID against;
int against_shape;
int against_shape = 0;
Vector2 collision_point;
Vector2 collision_normal;
Set<RID> exclude;
uint32_t collision_mask;
bool exclude_parent_body;
uint32_t collision_mask = 1;
bool exclude_parent_body = true;
Vector2 target_position;
Vector2 target_position = Vector2(0, 50);
bool collide_with_areas;
bool collide_with_bodies;
bool collide_with_areas = false;
bool collide_with_bodies = true;
protected:
void _notification(int p_what);

View file

@ -223,10 +223,5 @@ void RemoteTransform2D::_bind_methods() {
}
RemoteTransform2D::RemoteTransform2D() {
use_global_coordinates = true;
update_remote_position = true;
update_remote_rotation = true;
update_remote_scale = true;
set_notify_transform(true);
}

View file

@ -40,10 +40,10 @@ class RemoteTransform2D : public Node2D {
ObjectID cache;
bool use_global_coordinates;
bool update_remote_position;
bool update_remote_rotation;
bool update_remote_scale;
bool use_global_coordinates = true;
bool update_remote_position = true;
bool update_remote_rotation = true;
bool update_remote_scale = true;
void _update_remote();
void _update_cache();

View file

@ -157,10 +157,6 @@ String Bone2D::get_configuration_warning() const {
}
Bone2D::Bone2D() {
skeleton = nullptr;
parent_bone = nullptr;
skeleton_index = -1;
default_length = 16;
set_notify_local_transform(true);
//this is a clever hack so the bone knows no rest has been set yet, allowing to show an error.
for (int i = 0; i < 3; i++) {
@ -293,9 +289,6 @@ void Skeleton2D::_bind_methods() {
}
Skeleton2D::Skeleton2D() {
bone_setup_dirty = true;
transform_dirty = true;
skeleton = RS::get_singleton()->skeleton_create();
set_notify_transform(true);
}

View file

@ -43,12 +43,12 @@ class Bone2D : public Node2D {
friend class AnimatedValuesBackup;
#endif
Bone2D *parent_bone;
Skeleton2D *skeleton;
Bone2D *parent_bone = nullptr;
Skeleton2D *skeleton = nullptr;
Transform2D rest;
float default_length;
float default_length = 16.0;
int skeleton_index;
int skeleton_index = -1;
protected:
void _notification(int p_what);
@ -82,19 +82,19 @@ class Skeleton2D : public Node2D {
bool operator<(const Bone &p_bone) const {
return p_bone.bone->is_greater_than(bone);
}
Bone2D *bone;
int parent_index;
Bone2D *bone = nullptr;
int parent_index = 0;
Transform2D accum_transform;
Transform2D rest_inverse;
};
Vector<Bone> bones;
bool bone_setup_dirty;
bool bone_setup_dirty = true;
void _make_bone_setup_dirty();
void _update_bone_setup();
bool transform_dirty;
bool transform_dirty = true;
void _make_transform_dirty();
void _update_transform();

View file

@ -462,16 +462,6 @@ void Sprite2D::_bind_methods() {
}
Sprite2D::Sprite2D() {
centered = true;
hflip = false;
vflip = false;
region = false;
region_filter_clip = false;
frame = 0;
vframes = 1;
hframes = 1;
}
Sprite2D::~Sprite2D() {

View file

@ -39,21 +39,21 @@ class Sprite2D : public Node2D {
Ref<Texture2D> texture;
Color specular_color;
float shininess;
float shininess = 0.0;
bool centered;
bool centered = true;
Point2 offset;
bool hflip;
bool vflip;
bool region;
bool hflip = false;
bool vflip = false;
bool region = false;
Rect2 region_rect;
bool region_filter_clip;
bool region_filter_clip = false;
int frame;
int frame = 0;
int vframes;
int hframes;
int vframes = 1;
int hframes = 1;
void _get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_clip) const;

View file

@ -1872,32 +1872,6 @@ void TileMap::_changed_callback(Object *p_changed, const char *p_prop) {
}
TileMap::TileMap() {
rect_cache_dirty = true;
used_size_cache_dirty = true;
pending_update = false;
quadrant_order_dirty = false;
quadrant_size = 16;
cell_size = Size2(64, 64);
custom_transform = Transform2D(64, 0, 0, 64, 0, 0);
collision_layer = 1;
collision_mask = 1;
friction = 1;
bounce = 0;
mode = MODE_SQUARE;
half_offset = HALF_OFFSET_DISABLED;
use_parent = false;
collision_parent = nullptr;
use_kinematic = false;
navigation = nullptr;
use_y_sort = false;
compatibility_mode = false;
centered_textures = false;
occluder_light_mask = 1;
clip_uv = false;
format = FORMAT_1; // Assume lowest possible format if none is present
fp_adjust = 0.00001;
tile_origin = TILE_ORIGIN_TOP_LEFT;
set_notify_transform(true);
set_notify_local_transform(false);
}

View file

@ -70,22 +70,22 @@ private:
};
Ref<TileSet> tile_set;
Size2i cell_size;
int quadrant_size;
Mode mode;
Transform2D custom_transform;
HalfOffset half_offset;
bool use_parent;
CollisionObject2D *collision_parent;
bool use_kinematic;
Navigation2D *navigation;
Size2i cell_size = Size2(64, 64);
int quadrant_size = 16;
Mode mode = MODE_SQUARE;
Transform2D custom_transform = Transform2D(64, 0, 0, 64, 0, 0);
HalfOffset half_offset = HALF_OFFSET_DISABLED;
bool use_parent = false;
CollisionObject2D *collision_parent = nullptr;
bool use_kinematic = false;
Navigation2D *navigation = nullptr;
union PosKey {
struct {
int16_t x;
int16_t y;
};
uint32_t key;
uint32_t key = 0;
//using a more precise comparison so the regions can be sorted later
bool operator<(const PosKey &p_k) const { return (y == p_k.y) ? x < p_k.x : y < p_k.y; }
@ -119,8 +119,7 @@ private:
int16_t autotile_coord_y : 16;
};
uint64_t _u64t;
Cell() { _u64t = 0; }
uint64_t _u64t = 0;
};
Map<PosKey, Cell> tile_map;
@ -130,7 +129,7 @@ private:
Vector2 pos;
List<RID> canvas_items;
RID body;
uint32_t shape_owner_id;
uint32_t shape_owner_id = 0;
SelfList<Quadrant> dirty_list;
@ -176,27 +175,27 @@ private:
SelfList<Quadrant>::List dirty_quadrant_list;
bool pending_update;
bool pending_update = false;
Rect2 rect_cache;
bool rect_cache_dirty;
bool rect_cache_dirty = true;
Rect2 used_size_cache;
bool used_size_cache_dirty;
bool quadrant_order_dirty;
bool use_y_sort;
bool compatibility_mode;
bool centered_textures;
bool clip_uv;
float fp_adjust;
float friction;
float bounce;
uint32_t collision_layer;
uint32_t collision_mask;
mutable DataFormat format;
bool used_size_cache_dirty = true;
bool quadrant_order_dirty = false;
bool use_y_sort = false;
bool compatibility_mode = false;
bool centered_textures = false;
bool clip_uv = false;
float fp_adjust = 0.00001;
float friction = 1.0;
float bounce = 0.0;
uint32_t collision_layer = 1;
uint32_t collision_mask = 1;
mutable DataFormat format = FORMAT_1; // Assume lowest possible format if none is present
TileOrigin tile_origin;
TileOrigin tile_origin = TILE_ORIGIN_TOP_LEFT;
int occluder_light_mask;
int occluder_light_mask = 1;
void _fix_cell_transform(Transform2D &xform, const Cell &p_cell, const Vector2 &p_offset, const Size2 &p_sc);

View file

@ -399,11 +399,6 @@ void TouchScreenButton::_bind_methods() {
}
TouchScreenButton::TouchScreenButton() {
finger_pressed = -1;
passby_press = false;
visibility = VISIBILITY_ALWAYS;
shape_centered = true;
shape_visible = true;
unit_rect = Ref<RectangleShape2D>(memnew(RectangleShape2D));
unit_rect->set_size(Vector2(1, 1));
}

View file

@ -50,16 +50,16 @@ private:
Ref<Texture2D> texture_pressed;
Ref<BitMap> bitmask;
Ref<Shape2D> shape;
bool shape_centered;
bool shape_visible;
bool shape_centered = true;
bool shape_visible = true;
Ref<RectangleShape2D> unit_rect;
StringName action;
bool passby_press;
int finger_pressed;
bool passby_press = false;
int finger_pressed = -1;
VisibilityMode visibility;
VisibilityMode visibility = VISIBILITY_ALWAYS;
void _input(const Ref<InputEvent> &p_event);

View file

@ -363,6 +363,4 @@ VisibilityEnabler2D::VisibilityEnabler2D() {
}
enabler[ENABLER_PARENT_PROCESS] = false;
enabler[ENABLER_PARENT_PHYSICS_PROCESS] = false;
visible = false;
}

View file

@ -85,7 +85,7 @@ protected:
virtual void _screen_enter() override;
virtual void _screen_exit() override;
bool visible;
bool visible = false;
void _find_nodes(Node *p_node);

View file

@ -48,6 +48,5 @@ void YSort::_bind_methods() {
}
YSort::YSort() {
sort_enabled = true;
RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), true);
}

View file

@ -35,7 +35,7 @@
class YSort : public Node2D {
GDCLASS(YSort, Node2D);
bool sort_enabled;
bool sort_enabled = true;
static void _bind_methods();
public:

View file

@ -681,29 +681,10 @@ void Area3D::_bind_methods() {
Area3D::Area3D() :
CollisionObject3D(PhysicsServer3D::get_singleton()->area_create(), true) {
space_override = SPACE_OVERRIDE_DISABLED;
set_gravity(9.8);
locked = false;
set_gravity_vector(Vector3(0, -1, 0));
gravity_is_point = false;
gravity_distance_scale = 0;
linear_damp = 0.1;
angular_damp = 0.1;
priority = 0;
monitoring = false;
monitorable = false;
collision_mask = 1;
collision_layer = 1;
set_monitoring(true);
set_monitorable(true);
audio_bus_override = false;
audio_bus = "Master";
use_reverb_bus = false;
reverb_bus = "Master";
reverb_amount = 0.0;
reverb_uniformity = 0.0;
}
Area3D::~Area3D() {

View file

@ -47,19 +47,19 @@ public:
};
private:
SpaceOverride space_override;
SpaceOverride space_override = SPACE_OVERRIDE_DISABLED;
Vector3 gravity_vec;
real_t gravity;
bool gravity_is_point;
real_t gravity_distance_scale;
real_t angular_damp;
real_t linear_damp;
uint32_t collision_mask;
uint32_t collision_layer;
int priority;
bool monitoring;
bool monitorable;
bool locked;
bool gravity_is_point = false;
real_t gravity_distance_scale = 0.0;
real_t angular_damp = 0.1;
real_t linear_damp = 0.1;
uint32_t collision_mask = 1;
uint32_t collision_layer = 1;
int priority = 0;
bool monitoring = false;
bool monitorable = false;
bool locked = false;
void _body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape);
@ -67,8 +67,8 @@ private:
void _body_exit_tree(ObjectID p_id);
struct ShapePair {
int body_shape;
int area_shape;
int body_shape = 0;
int area_shape = 0;
bool operator<(const ShapePair &p_sp) const {
if (body_shape == p_sp.body_shape) {
return area_shape < p_sp.area_shape;
@ -85,8 +85,8 @@ private:
};
struct BodyState {
int rc;
bool in_tree;
int rc = 0;
bool in_tree = false;
VSet<ShapePair> shapes;
};
@ -98,8 +98,8 @@ private:
void _area_exit_tree(ObjectID p_id);
struct AreaShapePair {
int area_shape;
int self_shape;
int area_shape = 0;
int self_shape = 0;
bool operator<(const AreaShapePair &p_sp) const {
if (area_shape == p_sp.area_shape) {
return self_shape < p_sp.self_shape;
@ -116,21 +116,21 @@ private:
};
struct AreaState {
int rc;
bool in_tree;
int rc = 0;
bool in_tree = false;
VSet<AreaShapePair> shapes;
};
Map<ObjectID, AreaState> area_map;
void _clear_monitoring();
bool audio_bus_override;
StringName audio_bus;
bool audio_bus_override = false;
StringName audio_bus = "Master";
bool use_reverb_bus;
StringName reverb_bus;
float reverb_amount;
float reverb_uniformity;
bool use_reverb_bus = false;
StringName reverb_bus = "Master";
float reverb_amount = 0.0;
float reverb_uniformity = 0.0;
void _validate_property(PropertyInfo &property) const override;

View file

@ -42,8 +42,8 @@ class Spcap {
private:
struct Speaker {
Vector3 direction;
real_t effective_number_of_speakers; // precalculated
mutable real_t squared_gain; // temporary
real_t effective_number_of_speakers = 0; // precalculated
mutable real_t squared_gain = 0; // temporary
};
Vector<Speaker> speakers;
@ -1002,31 +1002,6 @@ void AudioStreamPlayer3D::_bind_methods() {
}
AudioStreamPlayer3D::AudioStreamPlayer3D() {
unit_db = 0;
unit_size = 1;
attenuation_model = ATTENUATION_INVERSE_DISTANCE;
max_db = 3;
pitch_scale = 1.0;
autoplay = false;
setseek = -1;
active = false;
output_count = 0;
prev_output_count = 0;
max_distance = 0;
setplay = -1;
output_ready = false;
area_mask = 1;
emission_angle = 45;
emission_angle_enabled = false;
emission_angle_filter_attenuation_db = -12;
attenuation_filter_cutoff_hz = 5000;
attenuation_filter_db = -24;
out_of_range_mode = OUT_OF_RANGE_MIX;
doppler_tracking = DOPPLER_TRACKING_DISABLED;
stream_paused = false;
stream_paused_fade_in = false;
stream_paused_fade_out = false;
velocity_tracker.instance();
AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer3D::_bus_layout_changed));
set_disable_scale(true);

View file

@ -71,46 +71,39 @@ private:
AudioFilterSW filter;
AudioFilterSW::Processor filter_process[8];
AudioFrame vol[4];
float filter_gain;
float pitch_scale;
int bus_index;
int reverb_bus_index;
float filter_gain = 0.0;
float pitch_scale = 0.0;
int bus_index = -1;
int reverb_bus_index = -1;
AudioFrame reverb_vol[4];
Viewport *viewport; //pointer only used for reference to previous mix
Output() {
filter_gain = 0;
viewport = nullptr;
reverb_bus_index = -1;
bus_index = -1;
}
Viewport *viewport = nullptr; //pointer only used for reference to previous mix
};
Output outputs[MAX_OUTPUTS];
volatile int output_count;
volatile bool output_ready;
volatile int output_count = 0;
volatile bool output_ready = false;
//these are used by audio thread to have a reference of previous volumes (for ramping volume and avoiding clicks)
Output prev_outputs[MAX_OUTPUTS];
int prev_output_count;
int prev_output_count = 0;
Ref<AudioStreamPlayback> stream_playback;
Ref<AudioStream> stream;
Vector<AudioFrame> mix_buffer;
volatile float setseek;
volatile bool active;
volatile float setplay;
volatile float setseek = -1.0;
volatile bool active = false;
volatile float setplay = -1.0;
AttenuationModel attenuation_model;
float unit_db;
float unit_size;
float max_db;
float pitch_scale;
bool autoplay;
bool stream_paused;
bool stream_paused_fade_in;
bool stream_paused_fade_out;
AttenuationModel attenuation_model = ATTENUATION_INVERSE_DISTANCE;
float unit_db = 0.0;
float unit_size = 1.0;
float max_db = 3.0;
float pitch_scale = 1.0;
bool autoplay = false;
bool stream_paused = false;
bool stream_paused_fade_in = false;
bool stream_paused_fade_out = false;
StringName bus;
static void _calc_output_vol(const Vector3 &source_dir, real_t tightness, Output &output);
@ -122,21 +115,21 @@ private:
void _bus_layout_changed();
uint32_t area_mask;
uint32_t area_mask = 1;
bool emission_angle_enabled;
float emission_angle;
float emission_angle_filter_attenuation_db;
float attenuation_filter_cutoff_hz;
float attenuation_filter_db;
bool emission_angle_enabled = false;
float emission_angle = 45.0;
float emission_angle_filter_attenuation_db = -12.0;
float attenuation_filter_cutoff_hz = 5000.0;
float attenuation_filter_db = -24.0;
float max_distance;
float max_distance = 0.0;
Ref<VelocityTracker3D> velocity_tracker;
DopplerTracking doppler_tracking;
DopplerTracking doppler_tracking = DOPPLER_TRACKING_DISABLED;
OutOfRangeMode out_of_range_mode;
OutOfRangeMode out_of_range_mode = OUT_OF_RANGE_MIX;
float _get_attenuation_db(float p_distance) const;

View file

@ -1466,17 +1466,4 @@ void BakedLightmap::_bind_methods() {
}
BakedLightmap::BakedLightmap() {
environment_mode = ENVIRONMENT_MODE_DISABLED;
environment_custom_color = Color(0.2, 0.7, 1.0);
environment_custom_energy = 1.0;
bake_quality = BAKE_QUALITY_MEDIUM;
interior = false;
directional = false;
gen_probes = GENERATE_PROBES_DISABLED;
use_denoiser = true;
bounces = 1;
bias = 0.0005;
max_texture_size = 16384;
}

View file

@ -53,9 +53,9 @@ class BakedLightmapData : public Resource {
struct User {
NodePath path;
int32_t sub_instance;
int32_t sub_instance = 0;
Rect2 uv_scale;
int slice_index;
int slice_index = 0;
};
Vector<User> users;
@ -136,32 +136,32 @@ public:
};
private:
BakeQuality bake_quality;
bool use_denoiser;
int bounces;
float bias;
int max_texture_size;
bool interior;
EnvironmentMode environment_mode;
BakeQuality bake_quality = BAKE_QUALITY_MEDIUM;
bool use_denoiser = true;
int bounces = 1;
float bias = 0.0005;
int max_texture_size = 16384;
bool interior = false;
EnvironmentMode environment_mode = ENVIRONMENT_MODE_DISABLED;
Ref<Sky> environment_custom_sky;
Color environment_custom_color;
float environment_custom_energy;
bool directional;
GenerateProbes gen_probes;
Color environment_custom_color = Color(0.2, 0.7, 1.0);
float environment_custom_energy = 1.0;
bool directional = false;
GenerateProbes gen_probes = GENERATE_PROBES_DISABLED;
Ref<BakedLightmapData> light_data;
struct LightsFound {
Transform xform;
Light3D *light;
Light3D *light = nullptr;
};
struct MeshesFound {
Transform xform;
NodePath node_path;
int32_t subindex;
int32_t subindex = 0;
Ref<Mesh> mesh;
int32_t lightmap_scale;
int32_t lightmap_scale = 0;
Vector<Ref<Material>> overrides;
};
@ -172,19 +172,20 @@ private:
struct BakeTimeData {
String text;
int pass;
uint64_t last_step;
int pass = 0;
uint64_t last_step = 0;
};
struct BSPSimplex {
int vertices[4];
int planes[4];
int vertices[4] = {};
int planes[4] = {};
};
struct BSPNode {
static const int32_t EMPTY_LEAF = INT32_MIN;
Plane plane;
int32_t over = EMPTY_LEAF, under = EMPTY_LEAF;
int32_t over = EMPTY_LEAF;
int32_t under = EMPTY_LEAF;
};
int _bsp_get_simplex_side(const Vector<Vector3> &p_points, const LocalVector<BSPSimplex> &p_simplices, const Plane &p_plane, uint32_t p_simplex) const;
@ -192,16 +193,16 @@ private:
struct BakeStepUD {
Lightmapper::BakeStepFunc func;
void *ud;
float from_percent;
float to_percent;
void *ud = nullptr;
float from_percent = 0.0;
float to_percent = 0.0;
};
static bool _lightmap_bake_step_function(float p_completion, const String &p_text, void *ud, bool p_refresh);
struct GenProbesOctree {
Vector3i offset;
uint32_t size;
uint32_t size = 0;
GenProbesOctree *children[8] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
~GenProbesOctree() {
for (int i = 0; i < 8; i++) {

View file

@ -105,7 +105,6 @@ void BoneAttachment3D::_notification(int p_what) {
}
BoneAttachment3D::BoneAttachment3D() {
bound = false;
}
void BoneAttachment3D::_bind_methods() {

View file

@ -36,7 +36,7 @@
class BoneAttachment3D : public Node3D {
GDCLASS(BoneAttachment3D, Node3D);
bool bound;
bool bound = false;
String bone_name;
void _check_bind();

View file

@ -653,24 +653,10 @@ Vector3 Camera3D::get_doppler_tracked_velocity() const {
Camera3D::Camera3D() {
camera = RenderingServer::get_singleton()->camera_create();
size = 1;
fov = 0;
frustum_offset = Vector2();
near = 0;
far = 0;
current = false;
viewport = nullptr;
force_change = false;
mode = PROJECTION_PERSPECTIVE;
set_perspective(75.0, 0.05, 4000.0);
keep_aspect = KEEP_HEIGHT;
layers = 0xfffff;
v_offset = 0;
h_offset = 0;
RenderingServer::get_singleton()->camera_set_cull_mask(camera, layers);
//active=false;
velocity_tracker.instance();
doppler_tracking = DOPPLER_TRACKING_DISABLED;
set_notify_transform(true);
set_disable_scale(true);
}
@ -882,16 +868,10 @@ void ClippedCamera3D::_bind_methods() {
}
ClippedCamera3D::ClippedCamera3D() {
margin = 0;
clip_offset = 0;
process_mode = CLIP_PROCESS_PHYSICS;
set_physics_process_internal(true);
collision_mask = 1;
set_notify_local_transform(Engine::get_singleton()->is_editor_hint());
points.resize(5);
pyramid_shape = PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON);
clip_to_areas = false;
clip_to_bodies = true;
}
ClippedCamera3D::~ClippedCamera3D() {

View file

@ -57,26 +57,27 @@ public:
};
private:
bool force_change;
bool current;
Viewport *viewport;
bool force_change = false;
bool current = false;
Viewport *viewport = nullptr;
Projection mode;
Projection mode = PROJECTION_PERSPECTIVE;
float fov;
float size;
float fov = 0.0;
float size = 1.0;
Vector2 frustum_offset;
float near, far;
float v_offset;
float h_offset;
KeepAspect keep_aspect;
float near = 0.0;
float far = 0.0;
float v_offset = 0.0;
float h_offset = 0.0;
KeepAspect keep_aspect = KEEP_HEIGHT;
RID camera;
RID scenario_id;
// String camera_group;
uint32_t layers;
uint32_t layers = 0xfffff;
Ref<Environment> environment;
Ref<CameraEffects> effects;
@ -87,7 +88,7 @@ private:
friend class Viewport;
void _update_audio_listener_state();
DopplerTracking doppler_tracking;
DopplerTracking doppler_tracking = DOPPLER_TRACKING_DISABLED;
Ref<VelocityTracker3D> velocity_tracker;
protected:
@ -191,13 +192,13 @@ public:
};
private:
ProcessMode process_mode;
ProcessMode process_mode = CLIP_PROCESS_PHYSICS;
RID pyramid_shape;
float margin;
float clip_offset;
uint32_t collision_mask;
bool clip_to_areas;
bool clip_to_bodies;
float margin = 0.0;
float clip_offset = 0.0;
uint32_t collision_mask = 1;
bool clip_to_areas = false;
bool clip_to_bodies = true;
Set<RID> exclude;

View file

@ -325,10 +325,7 @@ uint32_t CollisionObject3D::shape_find_owner(int p_shape_index) const {
CollisionObject3D::CollisionObject3D(RID p_rid, bool p_area) {
rid = p_rid;
area = p_area;
capture_input_on_drag = false;
ray_pickable = true;
set_notify_transform(true);
total_subshapes = 0;
if (p_area) {
PhysicsServer3D::get_singleton()->area_attach_object_instance_id(rid, get_instance_id());
@ -360,8 +357,6 @@ String CollisionObject3D::get_configuration_warning() const {
}
CollisionObject3D::CollisionObject3D() {
capture_input_on_drag = false;
ray_pickable = true;
set_notify_transform(true);
//owner=

View file

@ -37,33 +37,28 @@
class CollisionObject3D : public Node3D {
GDCLASS(CollisionObject3D, Node3D);
bool area;
bool area = false;
RID rid;
struct ShapeData {
Object *owner;
Object *owner = nullptr;
Transform xform;
struct ShapeBase {
Ref<Shape3D> shape;
int index;
int index = 0;
};
Vector<ShapeBase> shapes;
bool disabled;
ShapeData() {
disabled = false;
owner = nullptr;
}
bool disabled = false;
};
int total_subshapes;
int total_subshapes = 0;
Map<uint32_t, ShapeData> shapes;
bool capture_input_on_drag;
bool ray_pickable;
bool capture_input_on_drag = false;
bool ray_pickable = true;
void _update_pickable();

View file

@ -197,10 +197,5 @@ void CollisionPolygon3D::_bind_methods() {
}
CollisionPolygon3D::CollisionPolygon3D() {
aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
depth = 1.0;
set_notify_local_transform(true);
parent = nullptr;
owner_id = 0;
disabled = false;
}

View file

@ -39,14 +39,14 @@ class CollisionPolygon3D : public Node3D {
GDCLASS(CollisionPolygon3D, Node3D);
protected:
real_t depth;
AABB aabb;
real_t depth = 1.0;
AABB aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
Vector<Point2> polygon;
uint32_t owner_id;
CollisionObject3D *parent;
uint32_t owner_id = 0;
CollisionObject3D *parent = nullptr;
bool disabled;
bool disabled = false;
void _build_polygon();

View file

@ -213,10 +213,6 @@ bool CollisionShape3D::is_disabled() const {
CollisionShape3D::CollisionShape3D() {
//indicator = RenderingServer::get_singleton()->mesh_create();
disabled = false;
debug_shape = nullptr;
parent = nullptr;
owner_id = 0;
set_notify_local_transform(true);
}

View file

@ -40,14 +40,14 @@ class CollisionShape3D : public Node3D {
Ref<Shape3D> shape;
uint32_t owner_id;
CollisionObject3D *parent;
uint32_t owner_id = 0;
CollisionObject3D *parent = nullptr;
Node *debug_shape;
Node *debug_shape = nullptr;
bool debug_shape_dirty;
void resource_changed(RES res);
bool disabled;
bool disabled = false;
protected:
void _update_debug_shape();

View file

@ -1445,13 +1445,6 @@ void CPUParticles3D::_bind_methods() {
}
CPUParticles3D::CPUParticles3D() {
time = 0;
inactive_time = 0;
frame_remainder = 0;
cycle = 0;
redraw = false;
emitting = false;
set_notify_transform(true);
multimesh = RenderingServer::get_singleton()->multimesh_create();
@ -1459,23 +1452,8 @@ CPUParticles3D::CPUParticles3D() {
set_base(multimesh);
set_emitting(true);
set_one_shot(false);
set_amount(8);
set_lifetime(1);
set_fixed_fps(0);
set_fractional_delta(true);
set_pre_process_time(0);
set_explosiveness_ratio(0);
set_randomness_ratio(0);
set_lifetime_randomness(0);
set_use_local_coordinates(true);
set_draw_order(DRAW_ORDER_INDEX);
set_speed_scale(1);
set_direction(Vector3(1, 0, 0));
set_spread(45);
set_flatness(0);
set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
@ -1488,23 +1466,6 @@ CPUParticles3D::CPUParticles3D() {
set_param(PARAM_HUE_VARIATION, 0);
set_param(PARAM_ANIM_SPEED, 0);
set_param(PARAM_ANIM_OFFSET, 0);
set_emission_shape(EMISSION_SHAPE_POINT);
set_emission_sphere_radius(1);
set_emission_box_extents(Vector3(1, 1, 1));
set_gravity(Vector3(0, -9.8, 0));
for (int i = 0; i < PARAM_MAX; i++) {
set_param_randomness(Parameter(i), 0);
}
for (int i = 0; i < PARTICLE_FLAG_MAX; i++) {
particle_flags[i] = false;
}
can_update = false;
set_color(Color(1, 1, 1, 1));
}
CPUParticles3D::~CPUParticles3D() {

View file

@ -78,30 +78,30 @@ public:
};
private:
bool emitting;
bool emitting = false;
struct Particle {
Transform transform;
Color color;
float custom[4];
float custom[4] = {};
Vector3 velocity;
bool active;
float angle_rand;
float scale_rand;
float hue_rot_rand;
float anim_offset_rand;
float time;
float lifetime;
bool active = false;
float angle_rand = 0.0;
float scale_rand = 0.0;
float hue_rot_rand = 0.0;
float anim_offset_rand = 0.0;
float time = 0.0;
float lifetime = 0.0;
Color base_color;
uint32_t seed;
uint32_t seed = 0;
};
float time;
float inactive_time;
float frame_remainder;
int cycle;
bool redraw;
float time = 0.0;
float inactive_time = 0.0;
float frame_remainder = 0.0;
int cycle = 0;
bool redraw = false;
RID multimesh;
@ -110,7 +110,7 @@ private:
Vector<int> particle_order;
struct SortLifetime {
const Particle *particles;
const Particle *particles = nullptr;
bool operator()(int p_a, int p_b) const {
return particles[p_a].time > particles[p_b].time;
@ -118,7 +118,7 @@ private:
};
struct SortAxis {
const Particle *particles;
const Particle *particles = nullptr;
Vector3 axis;
bool operator()(int p_a, int p_b) const {
return axis.dot(particles[p_a].transform.origin) < axis.dot(particles[p_b].transform.origin);
@ -127,50 +127,50 @@ private:
//
bool one_shot;
bool one_shot = false;
float lifetime;
float pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
float lifetime_randomness;
float speed_scale;
bool local_coords;
int fixed_fps;
bool fractional_delta;
float lifetime = 1.0;
float pre_process_time = 0.0;
float explosiveness_ratio = 0.0;
float randomness_ratio = 0.0;
float lifetime_randomness = 0.0;
float speed_scale = 1.0;
bool local_coords = true;
int fixed_fps = 0;
bool fractional_delta = true;
Transform inv_emission_transform;
volatile bool can_update;
volatile bool can_update = false;
DrawOrder draw_order;
DrawOrder draw_order = DRAW_ORDER_INDEX;
Ref<Mesh> mesh;
////////
Vector3 direction;
float spread;
float flatness;
Vector3 direction = Vector3(1, 0, 0);
float spread = 45.0;
float flatness = 0.0;
float parameters[PARAM_MAX];
float randomness[PARAM_MAX];
float randomness[PARAM_MAX] = {};
Ref<Curve> curve_parameters[PARAM_MAX];
Color color;
Color color = Color(1, 1, 1, 1);
Ref<Gradient> color_ramp;
bool particle_flags[PARTICLE_FLAG_MAX];
bool particle_flags[PARTICLE_FLAG_MAX] = {};
EmissionShape emission_shape;
float emission_sphere_radius;
Vector3 emission_box_extents;
EmissionShape emission_shape = EMISSION_SHAPE_POINT;
float emission_sphere_radius = 1.0;
Vector3 emission_box_extents = Vector3(1, 1, 1);
Vector<Vector3> emission_points;
Vector<Vector3> emission_normals;
Vector<Color> emission_colors;
int emission_point_count;
int emission_point_count = 0;
Vector3 gravity;
Vector3 gravity = Vector3(0, -9.8, 0);
void _update_internal();
void _particles_process(float p_delta);

View file

@ -220,18 +220,6 @@ void Decal::_bind_methods() {
}
Decal::Decal() {
extents = Vector3(1, 1, 1);
emission_energy = 1.0;
modulate = Color(1, 1, 1, 1);
albedo_mix = 1.0;
cull_mask = (1 << 20) - 1;
upper_fade = 0.3;
lower_fade = 0.3;
normal_fade = 0;
distance_fade_enabled = false;
distance_fade_begin = 10;
distance_fade_length = 1;
decal = RenderingServer::get_singleton()->decal_create();
RS::get_singleton()->instance_set_base(get_instance(), decal);
}

View file

@ -49,18 +49,18 @@ public:
private:
RID decal;
Vector3 extents;
Vector3 extents = Vector3(1, 1, 1);
Ref<Texture2D> textures[TEXTURE_MAX];
float emission_energy;
float albedo_mix;
Color modulate;
uint32_t cull_mask;
float normal_fade;
float upper_fade;
float lower_fade;
bool distance_fade_enabled;
float distance_fade_begin;
float distance_fade_length;
float emission_energy = 1.0;
float albedo_mix = 1.0;
Color modulate = Color(1, 1, 1, 1);
uint32_t cull_mask = (1 << 20) - 1;
float normal_fade = 0.0;
float upper_fade = 0.3;
float lower_fade = 0.3;
bool distance_fade_enabled = false;
float distance_fade_begin = 10.0;
float distance_fade_length = 1.0;
protected:
static void _bind_methods();

View file

@ -286,17 +286,6 @@ void GIProbeData::_bind_methods() {
}
GIProbeData::GIProbeData() {
ao = 0.0;
ao_size = 0.5;
dynamic_range = 4;
energy = 1.0;
bias = 1.5;
normal_bias = 0.0;
propagation = 0.7;
anisotropy_strength = 0.5;
interior = false;
use_two_bounces = false;
probe = RS::get_singleton()->gi_probe_create();
}
@ -553,9 +542,6 @@ void GIProbe::_bind_methods() {
}
GIProbe::GIProbe() {
subdiv = SUBDIV_128;
extents = Vector3(10, 10, 10);
gi_probe = RS::get_singleton()->gi_probe_create();
set_disable_scale(true);
}

View file

@ -46,16 +46,16 @@ class GIProbeData : public Resource {
AABB bounds;
Vector3 octree_size;
float dynamic_range;
float energy;
float bias;
float normal_bias;
float propagation;
float anisotropy_strength;
float ao;
float ao_size;
bool interior;
bool use_two_bounces;
float dynamic_range = 4.0;
float energy = 1.0;
float bias = 1.5;
float normal_bias = 0.0;
float propagation = 0.7;
float anisotropy_strength = 0.5;
float ao = 0.0;
float ao_size = 0.5;
bool interior = false;
bool use_two_bounces = false;
protected:
static void _bind_methods();
@ -129,8 +129,8 @@ private:
RID gi_probe;
Subdiv subdiv;
Vector3 extents;
Subdiv subdiv = SUBDIV_128;
Vector3 extents = Vector3(10, 10, 10);
struct PlotMesh {
Ref<Material> override_material;

View file

@ -130,16 +130,16 @@ private:
LEAF_MASK = LEAF_BIT - 1
};
AABB bounds;
uint32_t children[2];
uint32_t children[2] = {};
};
struct FacePos {
Vector3 center;
uint32_t index;
uint32_t index = 0;
};
struct FaceSort {
uint32_t axis;
uint32_t axis = 0;
bool operator()(const FacePos &p_left, const FacePos &p_right) const {
return p_left.center[axis] < p_right.center[axis];
}
@ -148,13 +148,13 @@ private:
uint32_t _create_bvh(LocalVector<BVH> &bvh_tree, FacePos *p_faces, uint32_t p_face_count, const Face3 *p_triangles, float p_thickness);
struct ComputeSDFParams {
float *cells;
float *cells = nullptr;
Vector3i size;
float cell_size;
float cell_size = 0.0;
Vector3 cell_offset;
const BVH *bvh;
const Face3 *triangles;
float thickness;
const BVH *bvh = nullptr;
const Face3 *triangles = nullptr;
float thickness = 0.0;
};
void _find_closest_distance(const Vector3 &p_pos, const BVH *bvh, uint32_t p_bvh_cell, const Face3 *triangles, float thickness, float &closest_distance);

View file

@ -150,7 +150,6 @@ void ImmediateGeometry3D::_bind_methods() {
ImmediateGeometry3D::ImmediateGeometry3D() {
im = RenderingServer::get_singleton()->immediate_create();
set_base(im);
empty = true;
}
ImmediateGeometry3D::~ImmediateGeometry3D() {

View file

@ -41,7 +41,7 @@ class ImmediateGeometry3D : public GeometryInstance3D {
//a list of textures drawn need to be kept, to avoid references
// in RenderingServer from becoming invalid if the texture is no longer used
List<Ref<Texture2D>> cached_textures;
bool empty;
bool empty = true;
AABB aabb;
protected:

View file

@ -324,10 +324,6 @@ Light3D::Light3D(RenderingServer::LightType p_type) {
RS::get_singleton()->instance_set_base(get_instance(), light);
reverse_cull = false;
bake_mode = BAKE_DYNAMIC;
editor_only = false;
set_color(Color(1, 1, 1, 1));
set_shadow(false);
set_negative(false);
@ -357,7 +353,6 @@ Light3D::Light3D(RenderingServer::LightType p_type) {
}
Light3D::Light3D() {
type = RenderingServer::LIGHT_DIRECTIONAL;
ERR_PRINT("Light3D should not be instanced directly; use the DirectionalLight3D, OmniLight3D or SpotLight3D subtypes instead.");
}

View file

@ -71,16 +71,16 @@ public:
private:
Color color;
float param[PARAM_MAX];
float param[PARAM_MAX] = {};
Color shadow_color;
bool shadow;
bool negative;
bool reverse_cull;
uint32_t cull_mask;
RS::LightType type;
bool editor_only;
bool shadow = false;
bool negative = false;
bool reverse_cull = false;
uint32_t cull_mask = 0;
RS::LightType type = RenderingServer::LIGHT_DIRECTIONAL;
bool editor_only = false;
void _update_visibility();
BakeMode bake_mode;
BakeMode bake_mode = BAKE_DYNAMIC;
Ref<Texture2D> projector;
// bind helpers

View file

@ -159,8 +159,6 @@ void Listener3D::_bind_methods() {
}
Listener3D::Listener3D() {
current = false;
force_change = false;
set_notify_transform(true);
//active=false;
}

View file

@ -38,8 +38,8 @@ class Listener3D : public Node3D {
GDCLASS(Listener3D, Node3D);
private:
bool force_change;
bool current;
bool force_change = false;
bool current = false;
RID scenario_id;

View file

@ -428,7 +428,6 @@ void MeshInstance3D::_bind_methods() {
}
MeshInstance3D::MeshInstance3D() {
skeleton_path = NodePath("..");
}
MeshInstance3D::~MeshInstance3D() {

View file

@ -44,15 +44,11 @@ protected:
Ref<Skin> skin;
Ref<Skin> skin_internal;
Ref<SkinReference> skin_ref;
NodePath skeleton_path;
NodePath skeleton_path = NodePath("..");
struct BlendShapeTrack {
int idx;
float value;
BlendShapeTrack() {
idx = 0;
value = 0;
}
int idx = 0;
float value = 0.0;
};
Map<StringName, BlendShapeTrack> blend_shape_tracks;

View file

@ -110,8 +110,6 @@ Navigation3D::Navigation3D() {
set_cell_size(0.3);
set_edge_connection_margin(5.0); // Five meters, depends a lot on the agent's radius
up = Vector3(0, 1, 0);
}
Navigation3D::~Navigation3D() {

View file

@ -39,7 +39,7 @@ class Navigation3D : public Node3D {
RID map;
Vector3 up;
Vector3 up = Vector3(0, 1, 0);
real_t cell_size;
real_t edge_connection_margin;

View file

@ -150,7 +150,7 @@ Ref<NavigationMesh> NavigationRegion3D::get_navigation_mesh() const {
}
struct BakeThreadsArgs {
NavigationRegion3D *nav_region;
NavigationRegion3D *nav_region = nullptr;
};
void _bake_navigation_mesh(void *p_user_data) {

View file

@ -66,10 +66,10 @@ public:
private:
Path3D *path = nullptr;
real_t delta_offset = 0; // Change in offset since last _update_transform.
real_t offset = 0;
real_t h_offset = 0;
real_t v_offset = 0;
real_t delta_offset = 0.0; // Change in offset since last _update_transform.
real_t offset = 0.0;
real_t h_offset = 0.0;
real_t v_offset = 0.0;
bool cubic = true;
bool loop = true;
RotationMode rotation_mode = ROTATION_XYZ;

View file

@ -330,8 +330,8 @@ void RigidBody3D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap
struct _RigidBodyInOut {
ObjectID id;
int shape;
int local_shape;
int shape = 0;
int local_shape = 0;
};
void RigidBody3D::_direct_state_changed(Object *p_state) {
@ -825,24 +825,6 @@ void RigidBody3D::_bind_methods() {
RigidBody3D::RigidBody3D() :
PhysicsBody3D(PhysicsServer3D::BODY_MODE_RIGID) {
mode = MODE_RIGID;
mass = 1;
max_contacts_reported = 0;
state = nullptr;
gravity_scale = 1;
linear_damp = -1;
angular_damp = -1;
//angular_velocity=0;
sleeping = false;
ccd = false;
custom_integrator = false;
contact_monitor = nullptr;
can_sleep = true;
PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
}
@ -1221,11 +1203,6 @@ void KinematicBody3D::_direct_state_changed(Object *p_state) {
KinematicBody3D::KinematicBody3D() :
PhysicsBody3D(PhysicsServer3D::BODY_MODE_KINEMATIC) {
locked_axis = 0;
on_floor = false;
on_ceiling = false;
on_wall = false;
set_safe_margin(0.001);
PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
}

View file

@ -111,31 +111,31 @@ public:
};
protected:
bool can_sleep;
PhysicsDirectBodyState3D *state;
Mode mode;
bool can_sleep = true;
PhysicsDirectBodyState3D *state = nullptr;
Mode mode = MODE_RIGID;
real_t mass;
real_t mass = 1.0;
Ref<PhysicsMaterial> physics_material_override;
Vector3 linear_velocity;
Vector3 angular_velocity;
Basis inverse_inertia_tensor;
real_t gravity_scale;
real_t linear_damp;
real_t angular_damp;
real_t gravity_scale = 1.0;
real_t linear_damp = -1.0;
real_t angular_damp = -1.0;
bool sleeping;
bool ccd;
bool sleeping = false;
bool ccd = false;
int max_contacts_reported;
int max_contacts_reported = 0;
bool custom_integrator;
bool custom_integrator = false;
struct ShapePair {
int body_shape;
int local_shape;
bool tagged;
int body_shape = 0;
int local_shape = 0;
bool tagged = false;
bool operator<(const ShapePair &p_sp) const {
if (body_shape == p_sp.body_shape) {
return local_shape < p_sp.local_shape;
@ -157,16 +157,16 @@ protected:
};
struct BodyState {
//int rc;
bool in_tree;
bool in_tree = false;
VSet<ShapePair> shapes;
};
struct ContactMonitor {
bool locked;
bool locked = false;
Map<ObjectID, BodyState> body_map;
};
ContactMonitor *contact_monitor;
ContactMonitor *contact_monitor = nullptr;
void _body_enter_tree(ObjectID p_id);
void _body_exit_tree(ObjectID p_id);
@ -261,27 +261,27 @@ public:
Vector3 collider_vel;
ObjectID collider;
RID collider_rid;
int collider_shape;
int collider_shape = 0;
Variant collider_metadata;
Vector3 remainder;
Vector3 travel;
int local_shape;
int local_shape = 0;
};
private:
Vector3 linear_velocity;
Vector3 angular_velocity;
uint16_t locked_axis;
uint16_t locked_axis = 0;
real_t margin;
Vector3 floor_normal;
Vector3 floor_velocity;
RID on_floor_body;
bool on_floor;
bool on_ceiling;
bool on_wall;
bool on_floor = false;
bool on_ceiling = false;
bool on_wall = false;
Vector<Collision> colliders;
Vector<Ref<KinematicCollision3D>> slide_colliders;
Ref<KinematicCollision3D> motion_cache;
@ -385,10 +385,8 @@ public:
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
real_t bias = 0.3;
real_t damping = 1.;
real_t impulse_clamp = 0;
PinJointData() {}
real_t damping = 1.0;
real_t impulse_clamp = 0.0;
};
struct ConeJointData : public JointData {
@ -398,14 +396,11 @@ public:
virtual bool _get(const StringName &p_name, Variant &r_ret) const;
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
real_t swing_span;
real_t swing_span = Math_PI * 0.25;
real_t twist_span = Math_PI;
real_t bias = 0.3;
real_t softness = 0.8;
real_t relaxation = 1.;
ConeJointData() :
swing_span(Math_PI * 0.25) {}
};
struct HingeJointData : public JointData {
@ -416,16 +411,11 @@ public:
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
bool angular_limit_enabled = false;
real_t angular_limit_upper;
real_t angular_limit_lower;
real_t angular_limit_upper = Math_PI * 0.5;
real_t angular_limit_lower = -Math_PI * 0.5;
real_t angular_limit_bias = 0.3;
real_t angular_limit_softness = 0.9;
real_t angular_limit_relaxation = 1.;
HingeJointData() :
angular_limit_upper(Math_PI * 0.5),
angular_limit_lower(-Math_PI * 0.5) {}
};
struct SliderJointData : public JointData {
@ -435,45 +425,41 @@ public:
virtual bool _get(const StringName &p_name, Variant &r_ret) const;
virtual void _get_property_list(List<PropertyInfo> *p_list) const;
real_t linear_limit_upper = 1.;
real_t linear_limit_lower = -1.;
real_t linear_limit_softness = 1.;
real_t linear_limit_upper = 1.0;
real_t linear_limit_lower = -1.0;
real_t linear_limit_softness = 1.0;
real_t linear_limit_restitution = 0.7;
real_t linear_limit_damping = 1.;
real_t angular_limit_upper = 0;
real_t angular_limit_lower = 0;
real_t angular_limit_softness = 1.;
real_t linear_limit_damping = 1.0;
real_t angular_limit_upper = 0.0;
real_t angular_limit_lower = 0.0;
real_t angular_limit_softness = 1.0;
real_t angular_limit_restitution = 0.7;
real_t angular_limit_damping = 1.;
SliderJointData() {}
real_t angular_limit_damping = 1.0;
};
struct SixDOFJointData : public JointData {
struct SixDOFAxisData {
bool linear_limit_enabled = true;
real_t linear_limit_upper = 0;
real_t linear_limit_lower = 0;
real_t linear_limit_upper = 0.0;
real_t linear_limit_lower = 0.0;
real_t linear_limit_softness = 0.7;
real_t linear_restitution = 0.5;
real_t linear_damping = 1.;
real_t linear_damping = 1.0;
bool linear_spring_enabled = false;
real_t linear_spring_stiffness = 0;
real_t linear_spring_damping = 0;
real_t linear_equilibrium_point = 0;
real_t linear_spring_stiffness = 0.0;
real_t linear_spring_damping = 0.0;
real_t linear_equilibrium_point = 0.0;
bool angular_limit_enabled = true;
real_t angular_limit_upper = 0;
real_t angular_limit_lower = 0;
real_t angular_limit_upper = 0.0;
real_t angular_limit_lower = 0.0;
real_t angular_limit_softness = 0.5;
real_t angular_restitution = 0;
real_t angular_damping = 1.;
real_t angular_restitution = 0.0;
real_t angular_damping = 1.0;
real_t erp = 0.5;
bool angular_spring_enabled = false;
real_t angular_spring_stiffness = 0;
real_t angular_spring_damping = 0.;
real_t angular_equilibrium_point = 0;
SixDOFAxisData() {}
real_t angular_spring_stiffness = 0.0;
real_t angular_spring_damping = 0.0;
real_t angular_equilibrium_point = 0.0;
};
virtual JointType get_joint_type() { return JOINT_TYPE_6DOF; }
@ -505,12 +491,12 @@ private:
int bone_id = -1;
String bone_name;
real_t bounce = 0;
real_t mass = 1;
real_t friction = 1;
real_t gravity_scale = 1;
real_t linear_damp = -1;
real_t angular_damp = -1;
real_t bounce = 0.0;
real_t mass = 1.0;
real_t friction = 1.0;
real_t gravity_scale = 1.0;
real_t linear_damp = -1.0;
real_t angular_damp = -1.0;
bool can_sleep = true;
protected:

View file

@ -245,8 +245,6 @@ void Joint3D::_bind_methods() {
}
Joint3D::Joint3D() {
exclude_from_collision = true;
solver_priority = 1;
set_notify_transform(true);
}

View file

@ -44,8 +44,8 @@ class Joint3D : public Node3D {
NodePath a;
NodePath b;
int solver_priority;
bool exclude_from_collision;
int solver_priority = 1;
bool exclude_from_collision = true;
String warning;
protected:

View file

@ -392,13 +392,4 @@ void RayCast3D::_clear_debug_shape() {
}
RayCast3D::RayCast3D() {
enabled = true;
collided = false;
against_shape = 0;
collision_mask = 1;
target_position = Vector3(0, -1, 0);
debug_shape = nullptr;
exclude_parent_body = true;
collide_with_areas = false;
collide_with_bodies = true;
}

View file

@ -36,28 +36,28 @@
class RayCast3D : public Node3D {
GDCLASS(RayCast3D, Node3D);
bool enabled;
bool collided;
bool enabled = true;
bool collided = false;
ObjectID against;
int against_shape;
int against_shape = 0;
Vector3 collision_point;
Vector3 collision_normal;
Vector3 target_position;
Vector3 target_position = Vector3(0, -1, 0);
Set<RID> exclude;
uint32_t collision_mask;
bool exclude_parent_body;
uint32_t collision_mask = 1;
bool exclude_parent_body = true;
Node *debug_shape;
Node *debug_shape = nullptr;
Ref<Material> debug_material;
void _create_debug_shape();
void _update_debug_shape();
void _clear_debug_shape();
bool collide_with_areas;
bool collide_with_bodies;
bool collide_with_areas = false;
bool collide_with_bodies = true;
protected:
void _notification(int p_what);

View file

@ -257,20 +257,6 @@ void ReflectionProbe::_bind_methods() {
}
ReflectionProbe::ReflectionProbe() {
intensity = 1.0;
ambient_mode = AMBIENT_ENVIRONMENT;
ambient_color = Color(0, 0, 0);
ambient_color_energy = 1.0;
max_distance = 0;
extents = Vector3(1, 1, 1);
origin_offset = Vector3(0, 0, 0);
box_projection = false;
interior = false;
enable_shadows = false;
cull_mask = (1 << 20) - 1;
update_mode = UPDATE_ONCE;
lod_threshold = 1.0;
probe = RenderingServer::get_singleton()->reflection_probe_create();
RS::get_singleton()->instance_set_base(get_instance(), probe);
set_disable_scale(true);

View file

@ -53,20 +53,20 @@ public:
private:
RID probe;
float intensity;
float max_distance;
Vector3 extents;
Vector3 origin_offset;
bool box_projection;
bool enable_shadows;
bool interior;
AmbientMode ambient_mode;
Color ambient_color;
float ambient_color_energy;
float lod_threshold;
float intensity = 1.0;
float max_distance = 0.0;
Vector3 extents = Vector3(1, 1, 1);
Vector3 origin_offset = Vector3(0, 0, 0);
bool box_projection = false;
bool enable_shadows = false;
bool interior = false;
AmbientMode ambient_mode = AMBIENT_ENVIRONMENT;
Color ambient_color = Color(0, 0, 0);
float ambient_color_energy = 1.0;
float lod_threshold = 1.0;
uint32_t cull_mask;
UpdateMode update_mode;
uint32_t cull_mask = (1 << 20) - 1;
UpdateMode update_mode = UPDATE_ONCE;
protected:
static void _bind_methods();

View file

@ -217,10 +217,5 @@ void RemoteTransform3D::_bind_methods() {
}
RemoteTransform3D::RemoteTransform3D() {
use_global_coordinates = true;
update_remote_position = true;
update_remote_rotation = true;
update_remote_scale = true;
set_notify_transform(true);
}

Some files were not shown because too many files have changed in this diff Show more