Use real_t and double where appropriate in Particles

This commit is contained in:
Aaron Franke 2021-08-12 09:07:47 -05:00
parent c89ad92c96
commit 03e2544d50
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
18 changed files with 154 additions and 151 deletions

View file

@ -285,7 +285,7 @@ namespace GodotTools.Build
break;
}
buildLog.CursorSetLine(line);
buildLog.SetCaretLine(line);
}
public void RestartBuild()
@ -384,7 +384,7 @@ namespace GodotTools.Build
buildLog = new TextEdit
{
Readonly = true,
Editable = false,
SizeFlagsVertical = (int)SizeFlags.ExpandFill,
SizeFlagsHorizontal = (int)SizeFlags.ExpandFill // Avoid being squashed by the issues list
};

View file

@ -81,12 +81,12 @@ void GPUParticles2D::set_pre_process_time(double p_time) {
RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
}
void GPUParticles2D::set_explosiveness_ratio(float p_ratio) {
void GPUParticles2D::set_explosiveness_ratio(real_t p_ratio) {
explosiveness_ratio = p_ratio;
RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
}
void GPUParticles2D::set_randomness_ratio(float p_ratio) {
void GPUParticles2D::set_randomness_ratio(real_t p_ratio) {
randomness_ratio = p_ratio;
RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
}
@ -176,7 +176,7 @@ bool GPUParticles2D::is_trail_enabled() const {
return trail_enabled;
}
real_t GPUParticles2D::get_trail_length() const {
double GPUParticles2D::get_trail_length() const {
return trail_length;
}
@ -355,19 +355,19 @@ void GPUParticles2D::_notification(int p_what) {
PackedInt32Array indices;
int total_segments = trail_sections * trail_section_subdivisions;
float depth = size.height * trail_sections;
real_t depth = size.height * trail_sections;
for (int j = 0; j <= total_segments; j++) {
float v = j;
real_t v = j;
v /= total_segments;
float y = depth * v;
real_t y = depth * v;
y = (depth * 0.5) - y;
int bone = j / trail_section_subdivisions;
float blend = 1.0 - float(j % trail_section_subdivisions) / float(trail_section_subdivisions);
real_t blend = 1.0 - real_t(j % trail_section_subdivisions) / real_t(trail_section_subdivisions);
float s = size.width;
real_t s = size.width;
points.push_back(Vector2(-s * 0.5, 0));
points.push_back(Vector2(+s * 0.5, 0));
@ -413,7 +413,7 @@ void GPUParticles2D::_notification(int p_what) {
for (int i = 0; i <= trail_sections; i++) {
Transform3D xform;
/*
xform.origin.y = depth / 2.0 - size.height * float(i);
xform.origin.y = depth / 2.0 - size.height * real_t(i);
xform.origin.y = -xform.origin.y; //bind is an inverse transform, so negate y */
xforms.push_back(xform);
}

View file

@ -53,8 +53,8 @@ private:
int amount;
double lifetime;
double pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
real_t explosiveness_ratio;
real_t randomness_ratio;
double speed_scale;
Rect2 visibility_rect;
bool local_coords;
@ -70,10 +70,10 @@ private:
void _update_particle_emission_transform();
NodePath sub_emitter;
float collision_base_size = 1.0;
real_t collision_base_size = 1.0;
bool trail_enabled = false;
float trail_length = 0.3;
double trail_length = 0.3;
int trail_sections = 8;
int trail_section_subdivisions = 4;
@ -92,8 +92,8 @@ public:
void set_lifetime(double p_lifetime);
void set_one_shot(bool p_enable);
void set_pre_process_time(double p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
void set_explosiveness_ratio(real_t p_ratio);
void set_randomness_ratio(real_t p_ratio);
void set_visibility_rect(const Rect2 &p_visibility_rect);
void set_use_local_coordinates(bool p_enable);
void set_process_material(const Ref<Material> &p_material);
@ -118,7 +118,7 @@ public:
real_t get_collision_base_size() const;
bool is_trail_enabled() const;
real_t get_trail_length() const;
double get_trail_length() const;
int get_trail_sections() const;
int get_trail_section_subdivisions() const;

View file

@ -86,12 +86,12 @@ void GPUParticles3D::set_pre_process_time(double p_time) {
RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
}
void GPUParticles3D::set_explosiveness_ratio(float p_ratio) {
void GPUParticles3D::set_explosiveness_ratio(real_t p_ratio) {
explosiveness_ratio = p_ratio;
RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
}
void GPUParticles3D::set_randomness_ratio(float p_ratio) {
void GPUParticles3D::set_randomness_ratio(real_t p_ratio) {
randomness_ratio = p_ratio;
RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
}
@ -123,7 +123,7 @@ void GPUParticles3D::set_speed_scale(double p_scale) {
RS::get_singleton()->particles_set_speed_scale(particles, p_scale);
}
void GPUParticles3D::set_collision_base_size(float p_size) {
void GPUParticles3D::set_collision_base_size(real_t p_size) {
collision_base_size = p_size;
RS::get_singleton()->particles_set_collision_base_size(particles, p_size);
}
@ -148,11 +148,11 @@ double GPUParticles3D::get_pre_process_time() const {
return pre_process_time;
}
float GPUParticles3D::get_explosiveness_ratio() const {
real_t GPUParticles3D::get_explosiveness_ratio() const {
return explosiveness_ratio;
}
float GPUParticles3D::get_randomness_ratio() const {
real_t GPUParticles3D::get_randomness_ratio() const {
return randomness_ratio;
}
@ -172,7 +172,7 @@ double GPUParticles3D::get_speed_scale() const {
return speed_scale;
}
float GPUParticles3D::get_collision_base_size() const {
real_t GPUParticles3D::get_collision_base_size() const {
return collision_base_size;
}
@ -186,7 +186,8 @@ void GPUParticles3D::set_trail_enabled(bool p_enabled) {
RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length);
update_configuration_warnings();
}
void GPUParticles3D::set_trail_length(float p_seconds) {
void GPUParticles3D::set_trail_length(double p_seconds) {
ERR_FAIL_COND(p_seconds < 0.001);
trail_length = p_seconds;
RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length);
@ -195,7 +196,8 @@ void GPUParticles3D::set_trail_length(float p_seconds) {
bool GPUParticles3D::is_trail_enabled() const {
return trail_enabled;
}
float GPUParticles3D::get_trail_length() const {
double GPUParticles3D::get_trail_length() const {
return trail_length;
}

View file

@ -66,8 +66,8 @@ private:
int amount;
double lifetime;
double pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
real_t explosiveness_ratio;
real_t randomness_ratio;
double speed_scale;
AABB visibility_aabb;
bool local_coords;
@ -75,10 +75,10 @@ private:
bool fractional_delta;
bool interpolate = true;
NodePath sub_emitter;
float collision_base_size = 0.01;
real_t collision_base_size = 0.01;
bool trail_enabled = false;
float trail_length = 0.3;
double trail_length = 0.3;
TransformAlign transform_align = TRANSFORM_ALIGN_DISABLED;
@ -107,30 +107,30 @@ public:
void set_lifetime(double p_lifetime);
void set_one_shot(bool p_one_shot);
void set_pre_process_time(double p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float p_ratio);
void set_explosiveness_ratio(real_t p_ratio);
void set_randomness_ratio(real_t p_ratio);
void set_visibility_aabb(const AABB &p_aabb);
void set_use_local_coordinates(bool p_enable);
void set_process_material(const Ref<Material> &p_material);
void set_speed_scale(double p_scale);
void set_collision_base_size(float p_ratio);
void set_collision_base_size(real_t p_ratio);
void set_trail_enabled(bool p_enabled);
void set_trail_length(float p_seconds);
void set_trail_length(double p_seconds);
bool is_emitting() const;
int get_amount() const;
double get_lifetime() const;
bool get_one_shot() const;
double get_pre_process_time() const;
float get_explosiveness_ratio() const;
float get_randomness_ratio() const;
real_t get_explosiveness_ratio() const;
real_t get_randomness_ratio() const;
AABB get_visibility_aabb() const;
bool get_use_local_coordinates() const;
Ref<Material> get_process_material() const;
double get_speed_scale() const;
float get_collision_base_size() const;
real_t get_collision_base_size() const;
bool is_trail_enabled() const;
float get_trail_length() const;
double get_trail_length() const;
void set_fixed_fps(int p_count);
int get_fixed_fps() const;

View file

@ -70,13 +70,13 @@ void GPUParticlesCollisionSphere::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius");
}
void GPUParticlesCollisionSphere::set_radius(float p_radius) {
void GPUParticlesCollisionSphere::set_radius(real_t p_radius) {
radius = p_radius;
RS::get_singleton()->particles_collision_set_sphere_radius(_get_collision(), radius);
update_gizmos();
}
float GPUParticlesCollisionSphere::get_radius() const {
real_t GPUParticlesCollisionSphere::get_radius() const {
return radius;
}
@ -217,7 +217,7 @@ uint32_t GPUParticlesCollisionSDF::_create_bvh(LocalVector<BVH> &bvh_tree, FaceP
return index;
}
static _FORCE_INLINE_ float Vector3_dot2(const Vector3 &p_vec3) {
static _FORCE_INLINE_ real_t Vector3_dot2(const Vector3 &p_vec3) {
return p_vec3.dot(p_vec3);
}
@ -738,31 +738,31 @@ uint32_t GPUParticlesAttractor3D::get_cull_mask() const {
return cull_mask;
}
void GPUParticlesAttractor3D::set_strength(float p_strength) {
void GPUParticlesAttractor3D::set_strength(real_t p_strength) {
strength = p_strength;
RS::get_singleton()->particles_collision_set_attractor_strength(collision, p_strength);
}
float GPUParticlesAttractor3D::get_strength() const {
real_t GPUParticlesAttractor3D::get_strength() const {
return strength;
}
void GPUParticlesAttractor3D::set_attenuation(float p_attenuation) {
void GPUParticlesAttractor3D::set_attenuation(real_t p_attenuation) {
attenuation = p_attenuation;
RS::get_singleton()->particles_collision_set_attractor_attenuation(collision, p_attenuation);
}
float GPUParticlesAttractor3D::get_attenuation() const {
real_t GPUParticlesAttractor3D::get_attenuation() const {
return attenuation;
}
void GPUParticlesAttractor3D::set_directionality(float p_directionality) {
void GPUParticlesAttractor3D::set_directionality(real_t p_directionality) {
directionality = p_directionality;
RS::get_singleton()->particles_collision_set_attractor_directionality(collision, p_directionality);
update_gizmos();
}
float GPUParticlesAttractor3D::get_directionality() const {
real_t GPUParticlesAttractor3D::get_directionality() const {
return directionality;
}
@ -803,13 +803,13 @@ void GPUParticlesAttractorSphere::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius");
}
void GPUParticlesAttractorSphere::set_radius(float p_radius) {
void GPUParticlesAttractorSphere::set_radius(real_t p_radius) {
radius = p_radius;
RS::get_singleton()->particles_collision_set_sphere_radius(_get_collision(), radius);
update_gizmos();
}
float GPUParticlesAttractorSphere::get_radius() const {
real_t GPUParticlesAttractorSphere::get_radius() const {
return radius;
}

View file

@ -60,14 +60,14 @@ public:
class GPUParticlesCollisionSphere : public GPUParticlesCollision3D {
GDCLASS(GPUParticlesCollisionSphere, GPUParticlesCollision3D);
float radius = 1.0;
real_t radius = 1.0;
protected:
static void _bind_methods();
public:
void set_radius(float p_radius);
float get_radius() const;
void set_radius(real_t p_radius);
real_t get_radius() const;
virtual AABB get_aabb() const override;
@ -253,9 +253,9 @@ class GPUParticlesAttractor3D : public VisualInstance3D {
uint32_t cull_mask = 0xFFFFFFFF;
RID collision;
float strength = 1.0;
float attenuation = 1.0;
float directionality = 0.0;
real_t strength = 1.0;
real_t attenuation = 1.0;
real_t directionality = 0.0;
protected:
_FORCE_INLINE_ RID _get_collision() { return collision; }
@ -267,14 +267,14 @@ public:
void set_cull_mask(uint32_t p_cull_mask);
uint32_t get_cull_mask() const;
void set_strength(float p_strength);
float get_strength() const;
void set_strength(real_t p_strength);
real_t get_strength() const;
void set_attenuation(float p_attenuation);
float get_attenuation() const;
void set_attenuation(real_t p_attenuation);
real_t get_attenuation() const;
void set_directionality(float p_directionality);
float get_directionality() const;
void set_directionality(real_t p_directionality);
real_t get_directionality() const;
virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override { return Vector<Face3>(); }
@ -284,14 +284,14 @@ public:
class GPUParticlesAttractorSphere : public GPUParticlesAttractor3D {
GDCLASS(GPUParticlesAttractorSphere, GPUParticlesAttractor3D);
float radius = 1.0;
real_t radius = 1.0;
protected:
static void _bind_methods();
public:
void set_radius(float p_radius);
float get_radius() const;
void set_radius(real_t p_radius);
real_t get_radius() const;
virtual AABB get_aabb() const override;

View file

@ -996,7 +996,7 @@ void ParticlesMaterial::set_emission_shape(EmissionShape p_shape) {
_queue_shader_change();
}
void ParticlesMaterial::set_emission_sphere_radius(float p_radius) {
void ParticlesMaterial::set_emission_sphere_radius(real_t p_radius) {
emission_sphere_radius = p_radius;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_sphere_radius, p_radius);
}
@ -1035,17 +1035,17 @@ void ParticlesMaterial::set_emission_ring_axis(Vector3 p_axis) {
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_ring_axis, p_axis);
}
void ParticlesMaterial::set_emission_ring_height(float p_height) {
void ParticlesMaterial::set_emission_ring_height(real_t p_height) {
emission_ring_height = p_height;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_ring_height, p_height);
}
void ParticlesMaterial::set_emission_ring_radius(float p_radius) {
void ParticlesMaterial::set_emission_ring_radius(real_t p_radius) {
emission_ring_radius = p_radius;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_ring_radius, p_radius);
}
void ParticlesMaterial::set_emission_ring_inner_radius(float p_radius) {
void ParticlesMaterial::set_emission_ring_inner_radius(real_t p_radius) {
emission_ring_inner_radius = p_radius;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->emission_ring_inner_radius, p_radius);
}
@ -1054,7 +1054,7 @@ ParticlesMaterial::EmissionShape ParticlesMaterial::get_emission_shape() const {
return emission_shape;
}
float ParticlesMaterial::get_emission_sphere_radius() const {
real_t ParticlesMaterial::get_emission_sphere_radius() const {
return emission_sphere_radius;
}
@ -1082,15 +1082,15 @@ Vector3 ParticlesMaterial::get_emission_ring_axis() const {
return emission_ring_axis;
}
float ParticlesMaterial::get_emission_ring_height() const {
real_t ParticlesMaterial::get_emission_ring_height() const {
return emission_ring_height;
}
float ParticlesMaterial::get_emission_ring_radius() const {
real_t ParticlesMaterial::get_emission_ring_radius() const {
return emission_ring_radius;
}
float ParticlesMaterial::get_emission_ring_inner_radius() const {
real_t ParticlesMaterial::get_emission_ring_inner_radius() const {
return emission_ring_inner_radius;
}
@ -1107,12 +1107,12 @@ Vector3 ParticlesMaterial::get_gravity() const {
return gravity;
}
void ParticlesMaterial::set_lifetime_randomness(float p_lifetime) {
void ParticlesMaterial::set_lifetime_randomness(double p_lifetime) {
lifetime_randomness = p_lifetime;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->lifetime_randomness, lifetime_randomness);
}
float ParticlesMaterial::get_lifetime_randomness() const {
double ParticlesMaterial::get_lifetime_randomness() const {
return lifetime_randomness;
}
@ -1169,11 +1169,12 @@ ParticlesMaterial::SubEmitterMode ParticlesMaterial::get_sub_emitter_mode() cons
return sub_emitter_mode;
}
void ParticlesMaterial::set_sub_emitter_frequency(float p_frequency) {
void ParticlesMaterial::set_sub_emitter_frequency(double p_frequency) {
sub_emitter_frequency = p_frequency;
RenderingServer::get_singleton()->material_set_param(_get_material(), shader_names->sub_emitter_frequency, 1.0 / p_frequency); //pass delta instead of frequency, since its easier to compute
}
float ParticlesMaterial::get_sub_emitter_frequency() const {
double ParticlesMaterial::get_sub_emitter_frequency() const {
return sub_emitter_frequency;
}

View file

@ -241,19 +241,19 @@ private:
Ref<Texture2D> emission_normal_texture;
Ref<Texture2D> emission_color_texture;
Vector3 emission_ring_axis;
float emission_ring_height;
float emission_ring_radius;
float emission_ring_inner_radius;
real_t emission_ring_height;
real_t emission_ring_radius;
real_t emission_ring_inner_radius;
int emission_point_count = 1;
bool anim_loop;
Vector3 gravity;
float lifetime_randomness;
double lifetime_randomness;
SubEmitterMode sub_emitter_mode;
float sub_emitter_frequency;
double sub_emitter_frequency;
int sub_emitter_amount_at_end;
bool sub_emitter_keep_velocity;
//do not save emission points here
@ -297,34 +297,34 @@ public:
bool get_particle_flag(ParticleFlags p_particle_flag) const;
void set_emission_shape(EmissionShape p_shape);
void set_emission_sphere_radius(float p_radius);
void set_emission_sphere_radius(real_t p_radius);
void set_emission_box_extents(Vector3 p_extents);
void set_emission_point_texture(const Ref<Texture2D> &p_points);
void set_emission_normal_texture(const Ref<Texture2D> &p_normals);
void set_emission_color_texture(const Ref<Texture2D> &p_colors);
void set_emission_ring_axis(Vector3 p_axis);
void set_emission_ring_height(float p_height);
void set_emission_ring_radius(float p_radius);
void set_emission_ring_inner_radius(float p_radius);
void set_emission_ring_height(real_t p_height);
void set_emission_ring_radius(real_t p_radius);
void set_emission_ring_inner_radius(real_t p_radius);
void set_emission_point_count(int p_count);
EmissionShape get_emission_shape() const;
float get_emission_sphere_radius() const;
real_t get_emission_sphere_radius() const;
Vector3 get_emission_box_extents() const;
Ref<Texture2D> get_emission_point_texture() const;
Ref<Texture2D> get_emission_normal_texture() const;
Ref<Texture2D> get_emission_color_texture() const;
Vector3 get_emission_ring_axis() const;
float get_emission_ring_height() const;
float get_emission_ring_radius() const;
float get_emission_ring_inner_radius() const;
real_t get_emission_ring_height() const;
real_t get_emission_ring_radius() const;
real_t get_emission_ring_inner_radius() const;
int get_emission_point_count() const;
void set_gravity(const Vector3 &p_gravity);
Vector3 get_gravity() const;
void set_lifetime_randomness(float p_lifetime);
float get_lifetime_randomness() const;
void set_lifetime_randomness(double p_lifetime);
double get_lifetime_randomness() const;
void set_attractor_interaction_enabled(bool p_enable);
bool is_attractor_interaction_enabled() const;
@ -348,8 +348,8 @@ public:
void set_sub_emitter_mode(SubEmitterMode p_sub_emitter_mode);
SubEmitterMode get_sub_emitter_mode() const;
void set_sub_emitter_frequency(float p_frequency);
float get_sub_emitter_frequency() const;
void set_sub_emitter_frequency(double p_frequency);
double get_sub_emitter_frequency() const;
void set_sub_emitter_amount_at_end(int p_amount);
int get_sub_emitter_amount_at_end() const;

View file

@ -461,12 +461,12 @@ bool StyleBoxFlat::is_anti_aliased() const {
return anti_aliased;
}
void StyleBoxFlat::set_aa_size(const real_t &p_aa_size) {
void StyleBoxFlat::set_aa_size(const real_t p_aa_size) {
aa_size = CLAMP(p_aa_size, 0.01, 10);
emit_changed();
}
float StyleBoxFlat::get_aa_size() const {
real_t StyleBoxFlat::get_aa_size() const {
return aa_size;
}

View file

@ -205,8 +205,8 @@ public:
void set_anti_aliased(const bool &p_anti_aliased);
bool is_anti_aliased() const;
void set_aa_size(const float &p_aa_size);
float get_aa_size() const;
void set_aa_size(const real_t p_aa_size);
real_t get_aa_size() const;
virtual Size2 get_center_size() const override;

View file

@ -543,8 +543,8 @@ public:
void particles_set_lifetime(RID p_particles, double p_lifetime) override {}
void particles_set_one_shot(RID p_particles, bool p_one_shot) override {}
void particles_set_pre_process_time(RID p_particles, double p_time) override {}
void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) override {}
void particles_set_randomness_ratio(RID p_particles, float p_ratio) override {}
void particles_set_explosiveness_ratio(RID p_particles, real_t p_ratio) override {}
void particles_set_randomness_ratio(RID p_particles, real_t p_ratio) override {}
void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) override {}
void particles_set_speed_scale(RID p_particles, double p_scale) override {}
void particles_set_use_local_coordinates(RID p_particles, bool p_enable) override {}
@ -554,11 +554,11 @@ public:
void particles_set_fractional_delta(RID p_particles, bool p_enable) override {}
void particles_set_subemitter(RID p_particles, RID p_subemitter_particles) override {}
void particles_set_view_axis(RID p_particles, const Vector3 &p_axis, const Vector3 &p_up_axis) override {}
void particles_set_collision_base_size(RID p_particles, float p_size) override {}
void particles_set_collision_base_size(RID p_particles, real_t p_size) override {}
void particles_set_transform_align(RID p_particles, RS::ParticlesTransformAlign p_transform_align) override {}
void particles_set_trails(RID p_particles, bool p_enable, float p_length) override {}
void particles_set_trails(RID p_particles, bool p_enable, double p_length) override {}
void particles_set_trail_bind_poses(RID p_particles, const Vector<Transform3D> &p_bind_poses) override {}
void particles_restart(RID p_particles) override {}
@ -591,11 +591,11 @@ public:
void particles_collision_initialize(RID p_rid) override {}
void particles_collision_set_collision_type(RID p_particles_collision, RS::ParticlesCollisionType p_type) override {}
void particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask) override {}
void particles_collision_set_sphere_radius(RID p_particles_collision, float p_radius) override {}
void particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) override {}
void particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents) override {}
void particles_collision_set_attractor_strength(RID p_particles_collision, float p_strength) override {}
void particles_collision_set_attractor_directionality(RID p_particles_collision, float p_directionality) override {}
void particles_collision_set_attractor_attenuation(RID p_particles_collision, float p_curve) override {}
void particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) override {}
void particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) override {}
void particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) override {}
void particles_collision_set_field_texture(RID p_particles_collision, RID p_texture) override {}
void particles_collision_height_field_update(RID p_particles_collision) override {}
void particles_collision_set_height_field_resolution(RID p_particles_collision, RS::ParticlesCollisionHeightfieldResolution p_resolution) override {}

View file

@ -4109,12 +4109,12 @@ void RendererStorageRD::particles_set_pre_process_time(RID p_particles, double p
ERR_FAIL_COND(!particles);
particles->pre_process_time = p_time;
}
void RendererStorageRD::particles_set_explosiveness_ratio(RID p_particles, float p_ratio) {
void RendererStorageRD::particles_set_explosiveness_ratio(RID p_particles, real_t p_ratio) {
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
particles->explosiveness = p_ratio;
}
void RendererStorageRD::particles_set_randomness_ratio(RID p_particles, float p_ratio) {
void RendererStorageRD::particles_set_randomness_ratio(RID p_particles, real_t p_ratio) {
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
particles->randomness = p_ratio;
@ -4170,7 +4170,7 @@ void RendererStorageRD::particles_set_fractional_delta(RID p_particles, bool p_e
particles->fractional_delta = p_enable;
}
void RendererStorageRD::particles_set_trails(RID p_particles, bool p_enable, float p_length) {
void RendererStorageRD::particles_set_trails(RID p_particles, bool p_enable, double p_length) {
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
ERR_FAIL_COND(p_length < 0.1);
@ -4206,7 +4206,7 @@ void RendererStorageRD::particles_set_trail_bind_poses(RID p_particles, const Ve
particles->dependency.changed_notify(DEPENDENCY_CHANGED_PARTICLES);
}
void RendererStorageRD::particles_set_collision_base_size(RID p_particles, float p_size) {
void RendererStorageRD::particles_set_collision_base_size(RID p_particles, real_t p_size) {
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
@ -5464,7 +5464,7 @@ void RendererStorageRD::particles_collision_set_cull_mask(RID p_particles_collis
particles_collision->cull_mask = p_cull_mask;
}
void RendererStorageRD::particles_collision_set_sphere_radius(RID p_particles_collision, float p_radius) {
void RendererStorageRD::particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) {
ParticlesCollision *particles_collision = particles_collision_owner.getornull(p_particles_collision);
ERR_FAIL_COND(!particles_collision);
@ -5480,21 +5480,21 @@ void RendererStorageRD::particles_collision_set_box_extents(RID p_particles_coll
particles_collision->dependency.changed_notify(DEPENDENCY_CHANGED_AABB);
}
void RendererStorageRD::particles_collision_set_attractor_strength(RID p_particles_collision, float p_strength) {
void RendererStorageRD::particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) {
ParticlesCollision *particles_collision = particles_collision_owner.getornull(p_particles_collision);
ERR_FAIL_COND(!particles_collision);
particles_collision->attractor_strength = p_strength;
}
void RendererStorageRD::particles_collision_set_attractor_directionality(RID p_particles_collision, float p_directionality) {
void RendererStorageRD::particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) {
ParticlesCollision *particles_collision = particles_collision_owner.getornull(p_particles_collision);
ERR_FAIL_COND(!particles_collision);
particles_collision->attractor_directionality = p_directionality;
}
void RendererStorageRD::particles_collision_set_attractor_attenuation(RID p_particles_collision, float p_curve) {
void RendererStorageRD::particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) {
ParticlesCollision *particles_collision = particles_collision_owner.getornull(p_particles_collision);
ERR_FAIL_COND(!particles_collision);

View file

@ -663,19 +663,19 @@ private:
uint32_t type;
uint32_t texture_index; //texture index for vector field
float scale;
real_t scale;
uint32_t pad[2];
};
uint32_t emitting;
float system_phase;
float prev_system_phase;
double system_phase;
double prev_system_phase;
uint32_t cycle;
float explosiveness;
float randomness;
float time;
float delta;
real_t explosiveness;
real_t randomness;
double time;
double delta;
uint32_t frame;
uint32_t pad0;
@ -721,8 +721,8 @@ private:
int amount = 0;
double lifetime = 1.0;
double pre_process_time = 0.0;
float explosiveness = 0.0;
float randomness = 0.0;
real_t explosiveness = 0.0;
real_t randomness = 0.0;
bool restart_request = false;
AABB custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8));
bool use_local_coords = true;
@ -766,8 +766,8 @@ private:
RID sub_emitter;
float phase = 0.0;
float prev_phase = 0.0;
double phase = 0.0;
double prev_phase = 0.0;
uint64_t prev_ticks = 0;
uint32_t random_seed = 0;
@ -779,7 +779,7 @@ private:
bool interpolate = true;
bool fractional_delta = false;
double frame_remainder = 0;
float collision_base_size = 0.01;
real_t collision_base_size = 0.01;
bool clear = true;
@ -796,7 +796,7 @@ private:
Dependency dependency;
float trail_length = 1.0;
double trail_length = 1.0;
bool trails_enabled = false;
LocalVector<ParticlesFrameParams> frame_history;
LocalVector<ParticlesFrameParams> trail_params;
@ -2147,8 +2147,8 @@ public:
void particles_set_lifetime(RID p_particles, double p_lifetime);
void particles_set_one_shot(RID p_particles, bool p_one_shot);
void particles_set_pre_process_time(RID p_particles, double p_time);
void particles_set_explosiveness_ratio(RID p_particles, float p_ratio);
void particles_set_randomness_ratio(RID p_particles, float p_ratio);
void particles_set_explosiveness_ratio(RID p_particles, real_t p_ratio);
void particles_set_randomness_ratio(RID p_particles, real_t p_ratio);
void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb);
void particles_set_speed_scale(RID p_particles, double p_scale);
void particles_set_use_local_coordinates(RID p_particles, bool p_enable);
@ -2156,10 +2156,10 @@ public:
void particles_set_fixed_fps(RID p_particles, int p_fps);
void particles_set_interpolate(RID p_particles, bool p_enable);
void particles_set_fractional_delta(RID p_particles, bool p_enable);
void particles_set_collision_base_size(RID p_particles, float p_size);
void particles_set_collision_base_size(RID p_particles, real_t p_size);
void particles_set_transform_align(RID p_particles, RS::ParticlesTransformAlign p_transform_align);
void particles_set_trails(RID p_particles, bool p_enable, float p_length);
void particles_set_trails(RID p_particles, bool p_enable, double p_length);
void particles_set_trail_bind_poses(RID p_particles, const Vector<Transform3D> &p_bind_poses);
void particles_restart(RID p_particles);
@ -2252,11 +2252,11 @@ public:
virtual void particles_collision_set_collision_type(RID p_particles_collision, RS::ParticlesCollisionType p_type);
virtual void particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask);
virtual void particles_collision_set_sphere_radius(RID p_particles_collision, float p_radius); //for spheres
virtual void particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius); //for spheres
virtual void particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents); //for non-spheres
virtual void particles_collision_set_attractor_strength(RID p_particles_collision, float p_strength);
virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, float p_directionality);
virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, float p_curve);
virtual void particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength);
virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality);
virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve);
virtual void particles_collision_set_field_texture(RID p_particles_collision, RID p_texture); //for SDF and vector field, heightfield is dynamic
virtual void particles_collision_height_field_update(RID p_particles_collision); //for SDF and vector field
virtual void particles_collision_set_height_field_resolution(RID p_particles_collision, RS::ParticlesCollisionHeightfieldResolution p_resolution); //for SDF and vector field

View file

@ -471,8 +471,8 @@ public:
virtual void particles_set_lifetime(RID p_particles, double p_lifetime) = 0;
virtual void particles_set_one_shot(RID p_particles, bool p_one_shot) = 0;
virtual void particles_set_pre_process_time(RID p_particles, double p_time) = 0;
virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0;
virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0;
virtual void particles_set_explosiveness_ratio(RID p_particles, real_t p_ratio) = 0;
virtual void particles_set_randomness_ratio(RID p_particles, real_t p_ratio) = 0;
virtual void particles_set_custom_aabb(RID p_particles, const AABB &p_aabb) = 0;
virtual void particles_set_speed_scale(RID p_particles, double p_scale) = 0;
virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0;
@ -480,11 +480,11 @@ public:
virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0;
virtual void particles_set_interpolate(RID p_particles, bool p_enable) = 0;
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0;
virtual void particles_set_collision_base_size(RID p_particles, float p_size) = 0;
virtual void particles_set_collision_base_size(RID p_particles, real_t p_size) = 0;
virtual void particles_set_transform_align(RID p_particles, RS::ParticlesTransformAlign p_transform_align) = 0;
virtual void particles_set_trails(RID p_particles, bool p_enable, float p_length) = 0;
virtual void particles_set_trails(RID p_particles, bool p_enable, double p_length) = 0;
virtual void particles_set_trail_bind_poses(RID p_particles, const Vector<Transform3D> &p_bind_poses) = 0;
virtual void particles_restart(RID p_particles) = 0;
@ -523,11 +523,11 @@ public:
virtual void particles_collision_set_collision_type(RID p_particles_collision, RS::ParticlesCollisionType p_type) = 0;
virtual void particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask) = 0;
virtual void particles_collision_set_sphere_radius(RID p_particles_collision, float p_radius) = 0; //for spheres
virtual void particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) = 0; //for spheres
virtual void particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents) = 0; //for non-spheres
virtual void particles_collision_set_attractor_strength(RID p_particles_collision, float p_strength) = 0;
virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, float p_directionality) = 0;
virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, float p_curve) = 0;
virtual void particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) = 0;
virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) = 0;
virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) = 0;
virtual void particles_collision_set_field_texture(RID p_particles_collision, RID p_texture) = 0; //for SDF and vector field, heightfield is dynamic
virtual void particles_collision_height_field_update(RID p_particles_collision) = 0; //for SDF and vector field
virtual void particles_collision_set_height_field_resolution(RID p_particles_collision, RS::ParticlesCollisionHeightfieldResolution p_resolution) = 0; //for SDF and vector field

View file

@ -478,11 +478,11 @@ public:
FUNC2(particles_collision_set_collision_type, RID, ParticlesCollisionType)
FUNC2(particles_collision_set_cull_mask, RID, uint32_t)
FUNC2(particles_collision_set_sphere_radius, RID, float)
FUNC2(particles_collision_set_sphere_radius, RID, real_t)
FUNC2(particles_collision_set_box_extents, RID, const Vector3 &)
FUNC2(particles_collision_set_attractor_strength, RID, float)
FUNC2(particles_collision_set_attractor_directionality, RID, float)
FUNC2(particles_collision_set_attractor_attenuation, RID, float)
FUNC2(particles_collision_set_attractor_strength, RID, real_t)
FUNC2(particles_collision_set_attractor_directionality, RID, real_t)
FUNC2(particles_collision_set_attractor_attenuation, RID, real_t)
FUNC2(particles_collision_set_field_texture, RID, RID)
FUNC1(particles_collision_height_field_update, RID)
FUNC2(particles_collision_set_height_field_resolution, RID, ParticlesCollisionHeightfieldResolution)

View file

@ -687,11 +687,11 @@ public:
virtual void particles_collision_set_collision_type(RID p_particles_collision, ParticlesCollisionType p_type) = 0;
virtual void particles_collision_set_cull_mask(RID p_particles_collision, uint32_t p_cull_mask) = 0;
virtual void particles_collision_set_sphere_radius(RID p_particles_collision, float p_radius) = 0; //for spheres
virtual void particles_collision_set_sphere_radius(RID p_particles_collision, real_t p_radius) = 0; //for spheres
virtual void particles_collision_set_box_extents(RID p_particles_collision, const Vector3 &p_extents) = 0; //for non-spheres
virtual void particles_collision_set_attractor_strength(RID p_particles_collision, float p_strength) = 0;
virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, float p_directionality) = 0;
virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, float p_curve) = 0;
virtual void particles_collision_set_attractor_strength(RID p_particles_collision, real_t p_strength) = 0;
virtual void particles_collision_set_attractor_directionality(RID p_particles_collision, real_t p_directionality) = 0;
virtual void particles_collision_set_attractor_attenuation(RID p_particles_collision, real_t p_curve) = 0;
virtual void particles_collision_set_field_texture(RID p_particles_collision, RID p_texture) = 0; //for SDF and vector field, heightfield is dynamic
virtual void particles_collision_height_field_update(RID p_particles_collision) = 0; //for SDF and vector field

View file

@ -63,7 +63,7 @@ public:
}
// Disable heuristic completely.
float _compute_cost(int p_from, int p_to) {
real_t _compute_cost(int p_from, int p_to) {
if (p_from == A && p_to == C) {
return 1000;
}