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

View File

@ -627,20 +627,8 @@ void Area2D::_bind_methods() {
Area2D::Area2D() : Area2D::Area2D() :
CollisionObject2D(PhysicsServer2D::get_singleton()->area_create(), true) { CollisionObject2D(PhysicsServer2D::get_singleton()->area_create(), true) {
space_override = SPACE_OVERRIDE_DISABLED;
set_gravity(98); set_gravity(98);
set_gravity_vector(Vector2(0, 1)); 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_monitoring(true);
set_monitorable(true); set_monitorable(true);
} }

View File

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

View File

@ -503,21 +503,6 @@ void AudioStreamPlayer2D::_bind_methods() {
} }
AudioStreamPlayer2D::AudioStreamPlayer2D() { 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)); AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer2D::_bus_layout_changed));
} }

View File

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

View File

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

View File

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

View File

@ -749,9 +749,6 @@ void Camera2D::_bind_methods() {
} }
Camera2D::Camera2D() { Camera2D::Camera2D() {
anchor_mode = ANCHOR_MODE_DRAG_CENTER;
rotating = false;
current = false;
limit[SIDE_LEFT] = -10000000; limit[SIDE_LEFT] = -10000000;
limit[SIDE_TOP] = -10000000; limit[SIDE_TOP] = -10000000;
limit[SIDE_RIGHT] = 10000000; limit[SIDE_RIGHT] = 10000000;
@ -761,27 +758,6 @@ Camera2D::Camera2D() {
drag_margin[SIDE_TOP] = 0.2; drag_margin[SIDE_TOP] = 0.2;
drag_margin[SIDE_RIGHT] = 0.2; drag_margin[SIDE_RIGHT] = 0.2;
drag_margin[SIDE_BOTTOM] = 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); set_notify_transform(true);
} }

View File

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

View File

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

View File

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

View File

@ -37,35 +37,29 @@
class CollisionObject2D : public Node2D { class CollisionObject2D : public Node2D {
GDCLASS(CollisionObject2D, Node2D); GDCLASS(CollisionObject2D, Node2D);
bool area; bool area = false;
RID rid; RID rid;
bool pickable; bool pickable = false;
struct ShapeData { struct ShapeData {
Object *owner; Object *owner = nullptr;
Transform2D xform; Transform2D xform;
struct Shape { struct Shape {
Ref<Shape2D> shape; Ref<Shape2D> shape;
int index; int index = 0;
}; };
Vector<Shape> shapes; Vector<Shape> shapes;
bool disabled;
bool one_way_collision;
real_t one_way_collision_margin;
ShapeData() { bool disabled = false;
disabled = false; bool one_way_collision = false;
one_way_collision = false; real_t one_way_collision_margin = 0.0;
one_way_collision_margin = 0;
owner = nullptr;
}
}; };
int total_subshapes; int total_subshapes = 0;
Map<uint32_t, ShapeData> shapes; 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: protected:
CollisionObject2D(RID p_rid, bool p_area); CollisionObject2D(RID p_rid, bool p_area);

View File

@ -310,12 +310,5 @@ void CollisionPolygon2D::_bind_methods() {
} }
CollisionPolygon2D::CollisionPolygon2D() { CollisionPolygon2D::CollisionPolygon2D() {
aabb = Rect2(-10, -10, 20, 20);
build_mode = BUILD_SOLIDS;
set_notify_local_transform(true); 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: protected:
Rect2 aabb; Rect2 aabb = Rect2(-10, -10, 20, 20);
BuildMode build_mode; BuildMode build_mode = BUILD_SOLIDS;
Vector<Point2> polygon; Vector<Point2> polygon;
uint32_t owner_id; uint32_t owner_id = 0;
CollisionObject2D *parent; CollisionObject2D *parent = nullptr;
bool disabled; bool disabled = false;
bool one_way_collision; bool one_way_collision = false;
real_t one_way_collision_margin; real_t one_way_collision_margin = 1.0;
Vector<Vector<Vector2>> _decompose_in_convex(); Vector<Vector<Vector2>> _decompose_in_convex();

View File

@ -243,11 +243,5 @@ void CollisionShape2D::_bind_methods() {
} }
CollisionShape2D::CollisionShape2D() { CollisionShape2D::CollisionShape2D() {
rect = Rect2(-Point2(10, 10), Point2(20, 20));
set_notify_local_transform(true); 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 { class CollisionShape2D : public Node2D {
GDCLASS(CollisionShape2D, Node2D); GDCLASS(CollisionShape2D, Node2D);
Ref<Shape2D> shape; Ref<Shape2D> shape;
Rect2 rect; Rect2 rect = Rect2(-Point2(10, 10), Point2(20, 20));
uint32_t owner_id; uint32_t owner_id = 0;
CollisionObject2D *parent; CollisionObject2D *parent = nullptr;
void _shape_changed(); void _shape_changed();
bool disabled; bool disabled = false;
bool one_way_collision; bool one_way_collision = false;
real_t one_way_collision_margin; real_t one_way_collision_margin = 1.0;
void _update_in_shape_owner(bool p_xform_only = false); void _update_in_shape_owner(bool p_xform_only = false);

View File

@ -1369,34 +1369,14 @@ void CPUParticles2D::_bind_methods() {
} }
CPUParticles2D::CPUParticles2D() { CPUParticles2D::CPUParticles2D() {
time = 0;
inactive_time = 0;
frame_remainder = 0;
cycle = 0;
redraw = false;
emitting = false;
mesh = RenderingServer::get_singleton()->mesh_create(); mesh = RenderingServer::get_singleton()->mesh_create();
multimesh = RenderingServer::get_singleton()->multimesh_create(); multimesh = RenderingServer::get_singleton()->multimesh_create();
RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh); RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh);
set_emitting(true); set_emitting(true);
set_one_shot(false);
set_amount(8); 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_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_INITIAL_LINEAR_VELOCITY, 0);
set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0);
@ -1409,11 +1389,6 @@ CPUParticles2D::CPUParticles2D() {
set_param(PARAM_HUE_VARIATION, 0); set_param(PARAM_HUE_VARIATION, 0);
set_param(PARAM_ANIM_SPEED, 0); set_param(PARAM_ANIM_SPEED, 0);
set_param(PARAM_ANIM_OFFSET, 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++) { for (int i = 0; i < PARAM_MAX; i++) {
set_param_randomness(Parameter(i), 0); set_param_randomness(Parameter(i), 0);

View File

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

View File

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

View File

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

View File

@ -300,22 +300,6 @@ void Light2D::_bind_methods() {
Light2D::Light2D() { Light2D::Light2D() {
canvas_light = RenderingServer::get_singleton()->canvas_light_create(); 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); set_notify_transform(true);
} }

View File

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

View File

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

View File

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

View File

@ -40,15 +40,6 @@ VARIANT_ENUM_CAST(Line2D::LineCapMode)
VARIANT_ENUM_CAST(Line2D::LineTextureMode) VARIANT_ENUM_CAST(Line2D::LineTextureMode)
Line2D::Line2D() { 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 #ifdef TOOLS_ENABLED

View File

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

View File

@ -94,20 +94,6 @@ static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
LineBuilder::LineBuilder() { 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() { void LineBuilder::clear_output() {

View File

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

View File

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

View File

@ -185,9 +185,5 @@ void ParallaxBackground::_bind_methods() {
} }
ParallaxBackground::ParallaxBackground() { ParallaxBackground::ParallaxBackground() {
scale = 1.0;
set_layer(-100); //behind all by default 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); GDCLASS(ParallaxBackground, CanvasLayer);
Point2 offset; Point2 offset;
float scale; float scale = 1.0;
Point2 base_offset; Point2 base_offset;
Point2 base_scale; Point2 base_scale = Vector2(1, 1);
Point2 screen_offset; Point2 screen_offset;
String group_name; String group_name;
Point2 limit_begin; Point2 limit_begin;
Point2 limit_end; Point2 limit_end;
Point2 final_offset; Point2 final_offset;
bool ignore_camera_zoom; bool ignore_camera_zoom = false;
void _update_scroll(); void _update_scroll();

View File

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

View File

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

View File

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

View File

@ -64,10 +64,10 @@ class PathFollow2D : public Node2D {
public: public:
private: private:
Path2D *path = nullptr; Path2D *path = nullptr;
real_t offset = 0; real_t offset = 0.0;
real_t h_offset = 0; real_t h_offset = 0.0;
real_t v_offset = 0; real_t v_offset = 0.0;
real_t lookahead = 4; real_t lookahead = 4.0;
bool cubic = true; bool cubic = true;
bool loop = true; bool loop = true;
bool rotates = 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) : PhysicsBody2D::PhysicsBody2D(PhysicsServer2D::BodyMode p_mode) :
CollisionObject2D(PhysicsServer2D::get_singleton()->body_create(), false) { CollisionObject2D(PhysicsServer2D::get_singleton()->body_create(), false) {
PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), p_mode); PhysicsServer2D::get_singleton()->body_set_mode(get_rid(), p_mode);
collision_layer = 1;
collision_mask = 1;
set_pickable(false); set_pickable(false);
} }
@ -197,7 +195,6 @@ void StaticBody2D::_bind_methods() {
StaticBody2D::StaticBody2D() : StaticBody2D::StaticBody2D() :
PhysicsBody2D(PhysicsServer2D::BODY_MODE_STATIC) { PhysicsBody2D(PhysicsServer2D::BODY_MODE_STATIC) {
constant_angular_velocity = 0;
} }
StaticBody2D::~StaticBody2D() { StaticBody2D::~StaticBody2D() {
@ -320,8 +317,8 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap
struct _RigidBody2DInOut { struct _RigidBody2DInOut {
ObjectID id; ObjectID id;
int shape; int shape = 0;
int local_shape; 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) { 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() : RigidBody2D::RigidBody2D() :
PhysicsBody2D(PhysicsServer2D::BODY_MODE_RIGID) { 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"); 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 { class PhysicsBody2D : public CollisionObject2D {
GDCLASS(PhysicsBody2D, CollisionObject2D); GDCLASS(PhysicsBody2D, CollisionObject2D);
uint32_t collision_layer; uint32_t collision_layer = 1;
uint32_t collision_mask; uint32_t collision_mask = 1;
protected: protected:
void _notification(int p_what); void _notification(int p_what);
@ -74,7 +74,7 @@ class StaticBody2D : public PhysicsBody2D {
GDCLASS(StaticBody2D, PhysicsBody2D); GDCLASS(StaticBody2D, PhysicsBody2D);
Vector2 constant_linear_velocity; Vector2 constant_linear_velocity;
real_t constant_angular_velocity; real_t constant_angular_velocity = 0.0;
Ref<PhysicsMaterial> physics_material_override; Ref<PhysicsMaterial> physics_material_override;
@ -116,30 +116,30 @@ public:
}; };
private: private:
bool can_sleep; bool can_sleep = true;
PhysicsDirectBodyState2D *state; PhysicsDirectBodyState2D *state = nullptr;
Mode mode; Mode mode = MODE_RIGID;
real_t mass; real_t mass = 1.0;
Ref<PhysicsMaterial> physics_material_override; Ref<PhysicsMaterial> physics_material_override;
real_t gravity_scale; real_t gravity_scale = 1.0;
real_t linear_damp; real_t linear_damp = -1.0;
real_t angular_damp; real_t angular_damp = -1.0;
Vector2 linear_velocity; Vector2 linear_velocity;
real_t angular_velocity; real_t angular_velocity = 0.0;
bool sleeping; 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 { struct ShapePair {
int body_shape; int body_shape = 0;
int local_shape; int local_shape = 0;
bool tagged; bool tagged = false;
bool operator<(const ShapePair &p_sp) const { bool operator<(const ShapePair &p_sp) const {
if (body_shape == p_sp.body_shape) { if (body_shape == p_sp.body_shape) {
return local_shape < p_sp.local_shape; return local_shape < p_sp.local_shape;
@ -160,16 +160,16 @@ private:
}; };
struct BodyState { struct BodyState {
//int rc; //int rc;
bool in_scene; bool in_scene = false;
VSet<ShapePair> shapes; VSet<ShapePair> shapes;
}; };
struct ContactMonitor { struct ContactMonitor {
bool locked; bool locked = false;
Map<ObjectID, BodyState> body_map; Map<ObjectID, BodyState> body_map;
}; };
ContactMonitor *contact_monitor; ContactMonitor *contact_monitor = nullptr;
void _body_enter_tree(ObjectID p_id); void _body_enter_tree(ObjectID p_id);
void _body_exit_tree(ObjectID p_id); void _body_exit_tree(ObjectID p_id);
@ -268,11 +268,11 @@ public:
Vector2 collider_vel; Vector2 collider_vel;
ObjectID collider; ObjectID collider;
RID collider_rid; RID collider_rid;
int collider_shape; int collider_shape = 0;
Variant collider_metadata; Variant collider_metadata;
Vector2 remainder; Vector2 remainder;
Vector2 travel; Vector2 travel;
int local_shape; int local_shape = 0;
}; };
private: private:

View File

@ -155,7 +155,7 @@ void Polygon2D::_notification(int p_what) {
Rect2 bounds; Rect2 bounds;
int highest_idx = -1; int highest_idx = -1;
float highest_y = -1e20; float highest_y = -1e20;
float sum = 0; float sum = 0.0;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (i == 0) { if (i == 0) {
@ -273,7 +273,7 @@ void Polygon2D::_notification(int p_what) {
//normalize the weights //normalize the weights
for (int i = 0; i < vc; i++) { for (int i = 0; i < vc; i++) {
float tw = 0; float tw = 0.0;
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
tw += weightsw[i * 4 + j]; tw += weightsw[i * 4 + j];
} }
@ -649,13 +649,4 @@ void Polygon2D::_bind_methods() {
} }
Polygon2D::Polygon2D() { 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<Vector2> uv;
Vector<Color> vertex_colors; Vector<Color> vertex_colors;
Array polygons; Array polygons;
int internal_vertices; int internal_vertices = 0;
struct Bone { struct Bone {
NodePath path; NodePath path;
@ -49,19 +49,19 @@ class Polygon2D : public Node2D {
Vector<Bone> bone_weights; Vector<Bone> bone_weights;
Color color; Color color = Color(1, 1, 1);
Ref<Texture2D> texture; Ref<Texture2D> texture;
Size2 tex_scale; Size2 tex_scale = Vector2(1, 1);
Vector2 tex_ofs; Vector2 tex_ofs;
bool tex_tile; bool tex_tile = true;
float tex_rot; float tex_rot = 0.0;
bool invert; bool invert = false;
float invert_border; float invert_border = 100.0;
bool antialiased; bool antialiased = false;
Vector2 offset; Vector2 offset;
mutable bool rect_cache_dirty; mutable bool rect_cache_dirty = true;
mutable Rect2 item_rect; mutable Rect2 item_rect;
NodePath skeleton; NodePath skeleton;

View File

@ -173,7 +173,7 @@ void RayCast2D::_notification(int p_what) {
} }
draw_line(Vector2(), target_position, draw_col, 2); draw_line(Vector2(), target_position, draw_col, 2);
Vector<Vector2> pts; Vector<Vector2> pts;
float tsize = 8; float tsize = 8.0;
pts.push_back(xf.xform(Vector2(tsize, 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)));
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() { 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 { class RayCast2D : public Node2D {
GDCLASS(RayCast2D, Node2D); GDCLASS(RayCast2D, Node2D);
bool enabled; bool enabled = true;
bool collided; bool collided = false;
ObjectID against; ObjectID against;
int against_shape; int against_shape = 0;
Vector2 collision_point; Vector2 collision_point;
Vector2 collision_normal; Vector2 collision_normal;
Set<RID> exclude; Set<RID> exclude;
uint32_t collision_mask; uint32_t collision_mask = 1;
bool exclude_parent_body; bool exclude_parent_body = true;
Vector2 target_position; Vector2 target_position = Vector2(0, 50);
bool collide_with_areas; bool collide_with_areas = false;
bool collide_with_bodies; bool collide_with_bodies = true;
protected: protected:
void _notification(int p_what); void _notification(int p_what);

View File

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

View File

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

View File

@ -157,10 +157,6 @@ String Bone2D::get_configuration_warning() const {
} }
Bone2D::Bone2D() { Bone2D::Bone2D() {
skeleton = nullptr;
parent_bone = nullptr;
skeleton_index = -1;
default_length = 16;
set_notify_local_transform(true); 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. //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++) { for (int i = 0; i < 3; i++) {
@ -293,9 +289,6 @@ void Skeleton2D::_bind_methods() {
} }
Skeleton2D::Skeleton2D() { Skeleton2D::Skeleton2D() {
bone_setup_dirty = true;
transform_dirty = true;
skeleton = RS::get_singleton()->skeleton_create(); skeleton = RS::get_singleton()->skeleton_create();
set_notify_transform(true); set_notify_transform(true);
} }

View File

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

View File

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

View File

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

View File

@ -70,22 +70,22 @@ private:
}; };
Ref<TileSet> tile_set; Ref<TileSet> tile_set;
Size2i cell_size; Size2i cell_size = Size2(64, 64);
int quadrant_size; int quadrant_size = 16;
Mode mode; Mode mode = MODE_SQUARE;
Transform2D custom_transform; Transform2D custom_transform = Transform2D(64, 0, 0, 64, 0, 0);
HalfOffset half_offset; HalfOffset half_offset = HALF_OFFSET_DISABLED;
bool use_parent; bool use_parent = false;
CollisionObject2D *collision_parent; CollisionObject2D *collision_parent = nullptr;
bool use_kinematic; bool use_kinematic = false;
Navigation2D *navigation; Navigation2D *navigation = nullptr;
union PosKey { union PosKey {
struct { struct {
int16_t x; int16_t x;
int16_t y; int16_t y;
}; };
uint32_t key; uint32_t key = 0;
//using a more precise comparison so the regions can be sorted later //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; } 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; int16_t autotile_coord_y : 16;
}; };
uint64_t _u64t; uint64_t _u64t = 0;
Cell() { _u64t = 0; }
}; };
Map<PosKey, Cell> tile_map; Map<PosKey, Cell> tile_map;
@ -130,7 +129,7 @@ private:
Vector2 pos; Vector2 pos;
List<RID> canvas_items; List<RID> canvas_items;
RID body; RID body;
uint32_t shape_owner_id; uint32_t shape_owner_id = 0;
SelfList<Quadrant> dirty_list; SelfList<Quadrant> dirty_list;
@ -176,27 +175,27 @@ private:
SelfList<Quadrant>::List dirty_quadrant_list; SelfList<Quadrant>::List dirty_quadrant_list;
bool pending_update; bool pending_update = false;
Rect2 rect_cache; Rect2 rect_cache;
bool rect_cache_dirty; bool rect_cache_dirty = true;
Rect2 used_size_cache; Rect2 used_size_cache;
bool used_size_cache_dirty; bool used_size_cache_dirty = true;
bool quadrant_order_dirty; bool quadrant_order_dirty = false;
bool use_y_sort; bool use_y_sort = false;
bool compatibility_mode; bool compatibility_mode = false;
bool centered_textures; bool centered_textures = false;
bool clip_uv; bool clip_uv = false;
float fp_adjust; float fp_adjust = 0.00001;
float friction; float friction = 1.0;
float bounce; float bounce = 0.0;
uint32_t collision_layer; uint32_t collision_layer = 1;
uint32_t collision_mask; uint32_t collision_mask = 1;
mutable DataFormat format; 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); 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() { 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 = Ref<RectangleShape2D>(memnew(RectangleShape2D));
unit_rect->set_size(Vector2(1, 1)); unit_rect->set_size(Vector2(1, 1));
} }

View File

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

View File

@ -363,6 +363,4 @@ VisibilityEnabler2D::VisibilityEnabler2D() {
} }
enabler[ENABLER_PARENT_PROCESS] = false; enabler[ENABLER_PARENT_PROCESS] = false;
enabler[ENABLER_PARENT_PHYSICS_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_enter() override;
virtual void _screen_exit() override; virtual void _screen_exit() override;
bool visible; bool visible = false;
void _find_nodes(Node *p_node); void _find_nodes(Node *p_node);

View File

@ -48,6 +48,5 @@ void YSort::_bind_methods() {
} }
YSort::YSort() { YSort::YSort() {
sort_enabled = true;
RS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(), 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 { class YSort : public Node2D {
GDCLASS(YSort, Node2D); GDCLASS(YSort, Node2D);
bool sort_enabled; bool sort_enabled = true;
static void _bind_methods(); static void _bind_methods();
public: public:

View File

@ -681,29 +681,10 @@ void Area3D::_bind_methods() {
Area3D::Area3D() : Area3D::Area3D() :
CollisionObject3D(PhysicsServer3D::get_singleton()->area_create(), true) { CollisionObject3D(PhysicsServer3D::get_singleton()->area_create(), true) {
space_override = SPACE_OVERRIDE_DISABLED;
set_gravity(9.8); set_gravity(9.8);
locked = false;
set_gravity_vector(Vector3(0, -1, 0)); 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_monitoring(true);
set_monitorable(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() { Area3D::~Area3D() {

View File

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

View File

@ -42,8 +42,8 @@ class Spcap {
private: private:
struct Speaker { struct Speaker {
Vector3 direction; Vector3 direction;
real_t effective_number_of_speakers; // precalculated real_t effective_number_of_speakers = 0; // precalculated
mutable real_t squared_gain; // temporary mutable real_t squared_gain = 0; // temporary
}; };
Vector<Speaker> speakers; Vector<Speaker> speakers;
@ -1002,31 +1002,6 @@ void AudioStreamPlayer3D::_bind_methods() {
} }
AudioStreamPlayer3D::AudioStreamPlayer3D() { 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(); velocity_tracker.instance();
AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer3D::_bus_layout_changed)); AudioServer::get_singleton()->connect("bus_layout_changed", callable_mp(this, &AudioStreamPlayer3D::_bus_layout_changed));
set_disable_scale(true); set_disable_scale(true);

View File

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

View File

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

View File

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

View File

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

View File

@ -653,24 +653,10 @@ Vector3 Camera3D::get_doppler_tracked_velocity() const {
Camera3D::Camera3D() { Camera3D::Camera3D() {
camera = RenderingServer::get_singleton()->camera_create(); 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); 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); RenderingServer::get_singleton()->camera_set_cull_mask(camera, layers);
//active=false; //active=false;
velocity_tracker.instance(); velocity_tracker.instance();
doppler_tracking = DOPPLER_TRACKING_DISABLED;
set_notify_transform(true); set_notify_transform(true);
set_disable_scale(true); set_disable_scale(true);
} }
@ -882,16 +868,10 @@ void ClippedCamera3D::_bind_methods() {
} }
ClippedCamera3D::ClippedCamera3D() { ClippedCamera3D::ClippedCamera3D() {
margin = 0;
clip_offset = 0;
process_mode = CLIP_PROCESS_PHYSICS;
set_physics_process_internal(true); set_physics_process_internal(true);
collision_mask = 1;
set_notify_local_transform(Engine::get_singleton()->is_editor_hint()); set_notify_local_transform(Engine::get_singleton()->is_editor_hint());
points.resize(5); points.resize(5);
pyramid_shape = PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON); pyramid_shape = PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_CONVEX_POLYGON);
clip_to_areas = false;
clip_to_bodies = true;
} }
ClippedCamera3D::~ClippedCamera3D() { ClippedCamera3D::~ClippedCamera3D() {

View File

@ -57,26 +57,27 @@ public:
}; };
private: private:
bool force_change; bool force_change = false;
bool current; bool current = false;
Viewport *viewport; Viewport *viewport = nullptr;
Projection mode; Projection mode = PROJECTION_PERSPECTIVE;
float fov; float fov = 0.0;
float size; float size = 1.0;
Vector2 frustum_offset; Vector2 frustum_offset;
float near, far; float near = 0.0;
float v_offset; float far = 0.0;
float h_offset; float v_offset = 0.0;
KeepAspect keep_aspect; float h_offset = 0.0;
KeepAspect keep_aspect = KEEP_HEIGHT;
RID camera; RID camera;
RID scenario_id; RID scenario_id;
// String camera_group; // String camera_group;
uint32_t layers; uint32_t layers = 0xfffff;
Ref<Environment> environment; Ref<Environment> environment;
Ref<CameraEffects> effects; Ref<CameraEffects> effects;
@ -87,7 +88,7 @@ private:
friend class Viewport; friend class Viewport;
void _update_audio_listener_state(); void _update_audio_listener_state();
DopplerTracking doppler_tracking; DopplerTracking doppler_tracking = DOPPLER_TRACKING_DISABLED;
Ref<VelocityTracker3D> velocity_tracker; Ref<VelocityTracker3D> velocity_tracker;
protected: protected:
@ -191,13 +192,13 @@ public:
}; };
private: private:
ProcessMode process_mode; ProcessMode process_mode = CLIP_PROCESS_PHYSICS;
RID pyramid_shape; RID pyramid_shape;
float margin; float margin = 0.0;
float clip_offset; float clip_offset = 0.0;
uint32_t collision_mask; uint32_t collision_mask = 1;
bool clip_to_areas; bool clip_to_areas = false;
bool clip_to_bodies; bool clip_to_bodies = true;
Set<RID> exclude; 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) { CollisionObject3D::CollisionObject3D(RID p_rid, bool p_area) {
rid = p_rid; rid = p_rid;
area = p_area; area = p_area;
capture_input_on_drag = false;
ray_pickable = true;
set_notify_transform(true); set_notify_transform(true);
total_subshapes = 0;
if (p_area) { if (p_area) {
PhysicsServer3D::get_singleton()->area_attach_object_instance_id(rid, get_instance_id()); PhysicsServer3D::get_singleton()->area_attach_object_instance_id(rid, get_instance_id());
@ -360,8 +357,6 @@ String CollisionObject3D::get_configuration_warning() const {
} }
CollisionObject3D::CollisionObject3D() { CollisionObject3D::CollisionObject3D() {
capture_input_on_drag = false;
ray_pickable = true;
set_notify_transform(true); set_notify_transform(true);
//owner= //owner=

View File

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

View File

@ -197,10 +197,5 @@ void CollisionPolygon3D::_bind_methods() {
} }
CollisionPolygon3D::CollisionPolygon3D() { CollisionPolygon3D::CollisionPolygon3D() {
aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
depth = 1.0;
set_notify_local_transform(true); 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); GDCLASS(CollisionPolygon3D, Node3D);
protected: protected:
real_t depth; real_t depth = 1.0;
AABB aabb; AABB aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2));
Vector<Point2> polygon; Vector<Point2> polygon;
uint32_t owner_id; uint32_t owner_id = 0;
CollisionObject3D *parent; CollisionObject3D *parent = nullptr;
bool disabled; bool disabled = false;
void _build_polygon(); void _build_polygon();

View File

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

View File

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

View File

@ -1445,13 +1445,6 @@ void CPUParticles3D::_bind_methods() {
} }
CPUParticles3D::CPUParticles3D() { CPUParticles3D::CPUParticles3D() {
time = 0;
inactive_time = 0;
frame_remainder = 0;
cycle = 0;
redraw = false;
emitting = false;
set_notify_transform(true); set_notify_transform(true);
multimesh = RenderingServer::get_singleton()->multimesh_create(); multimesh = RenderingServer::get_singleton()->multimesh_create();
@ -1459,23 +1452,8 @@ CPUParticles3D::CPUParticles3D() {
set_base(multimesh); set_base(multimesh);
set_emitting(true); set_emitting(true);
set_one_shot(false);
set_amount(8); 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_INITIAL_LINEAR_VELOCITY, 0);
set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0);
@ -1488,23 +1466,6 @@ CPUParticles3D::CPUParticles3D() {
set_param(PARAM_HUE_VARIATION, 0); set_param(PARAM_HUE_VARIATION, 0);
set_param(PARAM_ANIM_SPEED, 0); set_param(PARAM_ANIM_SPEED, 0);
set_param(PARAM_ANIM_OFFSET, 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() { CPUParticles3D::~CPUParticles3D() {

View File

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

View File

@ -220,18 +220,6 @@ void Decal::_bind_methods() {
} }
Decal::Decal() { 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(); decal = RenderingServer::get_singleton()->decal_create();
RS::get_singleton()->instance_set_base(get_instance(), decal); RS::get_singleton()->instance_set_base(get_instance(), decal);
} }

View File

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

View File

@ -286,17 +286,6 @@ void GIProbeData::_bind_methods() {
} }
GIProbeData::GIProbeData() { 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(); probe = RS::get_singleton()->gi_probe_create();
} }
@ -553,9 +542,6 @@ void GIProbe::_bind_methods() {
} }
GIProbe::GIProbe() { GIProbe::GIProbe() {
subdiv = SUBDIV_128;
extents = Vector3(10, 10, 10);
gi_probe = RS::get_singleton()->gi_probe_create(); gi_probe = RS::get_singleton()->gi_probe_create();
set_disable_scale(true); set_disable_scale(true);
} }

View File

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

View File

@ -130,16 +130,16 @@ private:
LEAF_MASK = LEAF_BIT - 1 LEAF_MASK = LEAF_BIT - 1
}; };
AABB bounds; AABB bounds;
uint32_t children[2]; uint32_t children[2] = {};
}; };
struct FacePos { struct FacePos {
Vector3 center; Vector3 center;
uint32_t index; uint32_t index = 0;
}; };
struct FaceSort { struct FaceSort {
uint32_t axis; uint32_t axis = 0;
bool operator()(const FacePos &p_left, const FacePos &p_right) const { bool operator()(const FacePos &p_left, const FacePos &p_right) const {
return p_left.center[axis] < p_right.center[axis]; 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); 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 { struct ComputeSDFParams {
float *cells; float *cells = nullptr;
Vector3i size; Vector3i size;
float cell_size; float cell_size = 0.0;
Vector3 cell_offset; Vector3 cell_offset;
const BVH *bvh; const BVH *bvh = nullptr;
const Face3 *triangles; const Face3 *triangles = nullptr;
float thickness; 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); 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() { ImmediateGeometry3D::ImmediateGeometry3D() {
im = RenderingServer::get_singleton()->immediate_create(); im = RenderingServer::get_singleton()->immediate_create();
set_base(im); set_base(im);
empty = true;
} }
ImmediateGeometry3D::~ImmediateGeometry3D() { ImmediateGeometry3D::~ImmediateGeometry3D() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -66,10 +66,10 @@ public:
private: private:
Path3D *path = nullptr; Path3D *path = nullptr;
real_t delta_offset = 0; // Change in offset since last _update_transform. real_t delta_offset = 0.0; // Change in offset since last _update_transform.
real_t offset = 0; real_t offset = 0.0;
real_t h_offset = 0; real_t h_offset = 0.0;
real_t v_offset = 0; real_t v_offset = 0.0;
bool cubic = true; bool cubic = true;
bool loop = true; bool loop = true;
RotationMode rotation_mode = ROTATION_XYZ; 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 { struct _RigidBodyInOut {
ObjectID id; ObjectID id;
int shape; int shape = 0;
int local_shape; int local_shape = 0;
}; };
void RigidBody3D::_direct_state_changed(Object *p_state) { void RigidBody3D::_direct_state_changed(Object *p_state) {
@ -825,24 +825,6 @@ void RigidBody3D::_bind_methods() {
RigidBody3D::RigidBody3D() : RigidBody3D::RigidBody3D() :
PhysicsBody3D(PhysicsServer3D::BODY_MODE_RIGID) { 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"); 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() : KinematicBody3D::KinematicBody3D() :
PhysicsBody3D(PhysicsServer3D::BODY_MODE_KINEMATIC) { PhysicsBody3D(PhysicsServer3D::BODY_MODE_KINEMATIC) {
locked_axis = 0;
on_floor = false;
on_ceiling = false;
on_wall = false;
set_safe_margin(0.001); set_safe_margin(0.001);
PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed"); PhysicsServer3D::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -257,20 +257,6 @@ void ReflectionProbe::_bind_methods() {
} }
ReflectionProbe::ReflectionProbe() { 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(); probe = RenderingServer::get_singleton()->reflection_probe_create();
RS::get_singleton()->instance_set_base(get_instance(), probe); RS::get_singleton()->instance_set_base(get_instance(), probe);
set_disable_scale(true); set_disable_scale(true);

View File

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

View File

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

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