@@ -101,6 +101,12 @@ void CPUParticles3D::set_randomness_ratio(real_t p_ratio) {
101101 randomness_ratio = p_ratio;
102102}
103103
104+ void CPUParticles3D::set_visibility_aabb (const AABB &p_aabb) {
105+ RS::get_singleton ()->multimesh_set_custom_aabb (multimesh, p_aabb);
106+ visibility_aabb = p_aabb;
107+ update_gizmos ();
108+ }
109+
104110void CPUParticles3D::set_lifetime_randomness (double p_random) {
105111 lifetime_randomness = p_random;
106112}
@@ -141,6 +147,10 @@ real_t CPUParticles3D::get_randomness_ratio() const {
141147 return randomness_ratio;
142148}
143149
150+ AABB CPUParticles3D::get_visibility_aabb () const {
151+ return visibility_aabb;
152+ }
153+
144154double CPUParticles3D::get_lifetime_randomness () const {
145155 return lifetime_randomness;
146156}
@@ -520,6 +530,11 @@ bool CPUParticles3D::get_split_scale() {
520530 return split_scale;
521531}
522532
533+ AABB CPUParticles3D::capture_aabb () const {
534+ RS::get_singleton ()->multimesh_set_custom_aabb (multimesh, AABB ());
535+ return RS::get_singleton ()->multimesh_get_aabb (multimesh);
536+ }
537+
523538void CPUParticles3D::_validate_property (PropertyInfo &p_property) const {
524539 if (p_property.name == " emission_sphere_radius" && (emission_shape != EMISSION_SHAPE_SPHERE && emission_shape != EMISSION_SHAPE_SPHERE_SURFACE )) {
525540 p_property.usage = PROPERTY_USAGE_NONE ;
@@ -1341,6 +1356,7 @@ void CPUParticles3D::convert_from_particles(Node *p_particles) {
13411356 set_pre_process_time (gpu_particles->get_pre_process_time ());
13421357 set_explosiveness_ratio (gpu_particles->get_explosiveness_ratio ());
13431358 set_randomness_ratio (gpu_particles->get_randomness_ratio ());
1359+ set_visibility_aabb (gpu_particles->get_visibility_aabb ());
13441360 set_use_local_coordinates (gpu_particles->get_use_local_coordinates ());
13451361 set_fixed_fps (gpu_particles->get_fixed_fps ());
13461362 set_fractional_delta (gpu_particles->get_fractional_delta ());
@@ -1420,6 +1436,7 @@ void CPUParticles3D::_bind_methods() {
14201436 ClassDB::bind_method (D_METHOD (" set_pre_process_time" , " secs" ), &CPUParticles3D::set_pre_process_time);
14211437 ClassDB::bind_method (D_METHOD (" set_explosiveness_ratio" , " ratio" ), &CPUParticles3D::set_explosiveness_ratio);
14221438 ClassDB::bind_method (D_METHOD (" set_randomness_ratio" , " ratio" ), &CPUParticles3D::set_randomness_ratio);
1439+ ClassDB::bind_method (D_METHOD (" set_visibility_aabb" , " aabb" ), &CPUParticles3D::set_visibility_aabb);
14231440 ClassDB::bind_method (D_METHOD (" set_lifetime_randomness" , " random" ), &CPUParticles3D::set_lifetime_randomness);
14241441 ClassDB::bind_method (D_METHOD (" set_use_local_coordinates" , " enable" ), &CPUParticles3D::set_use_local_coordinates);
14251442 ClassDB::bind_method (D_METHOD (" set_fixed_fps" , " fps" ), &CPUParticles3D::set_fixed_fps);
@@ -1433,6 +1450,7 @@ void CPUParticles3D::_bind_methods() {
14331450 ClassDB::bind_method (D_METHOD (" get_pre_process_time" ), &CPUParticles3D::get_pre_process_time);
14341451 ClassDB::bind_method (D_METHOD (" get_explosiveness_ratio" ), &CPUParticles3D::get_explosiveness_ratio);
14351452 ClassDB::bind_method (D_METHOD (" get_randomness_ratio" ), &CPUParticles3D::get_randomness_ratio);
1453+ ClassDB::bind_method (D_METHOD (" get_visibility_aabb" ), &CPUParticles3D::get_visibility_aabb);
14361454 ClassDB::bind_method (D_METHOD (" get_lifetime_randomness" ), &CPUParticles3D::get_lifetime_randomness);
14371455 ClassDB::bind_method (D_METHOD (" get_use_local_coordinates" ), &CPUParticles3D::get_use_local_coordinates);
14381456 ClassDB::bind_method (D_METHOD (" get_fixed_fps" ), &CPUParticles3D::get_fixed_fps);
@@ -1461,6 +1479,7 @@ void CPUParticles3D::_bind_methods() {
14611479 ADD_PROPERTY (PropertyInfo (Variant::INT , " fixed_fps" , PROPERTY_HINT_RANGE , " 0,1000,1,suffix:FPS" ), " set_fixed_fps" , " get_fixed_fps" );
14621480 ADD_PROPERTY (PropertyInfo (Variant::BOOL , " fract_delta" ), " set_fractional_delta" , " get_fractional_delta" );
14631481 ADD_GROUP (" Drawing" , " " );
1482+ ADD_PROPERTY (PropertyInfo (Variant::AABB , " visibility_aabb" , PROPERTY_HINT_NONE , " suffix:m" ), " set_visibility_aabb" , " get_visibility_aabb" );
14641483 ADD_PROPERTY (PropertyInfo (Variant::BOOL , " local_coords" ), " set_use_local_coordinates" , " get_use_local_coordinates" );
14651484 ADD_PROPERTY (PropertyInfo (Variant::INT , " draw_order" , PROPERTY_HINT_ENUM , " Index,Lifetime,View Depth" ), " set_draw_order" , " get_draw_order" );
14661485 ADD_PROPERTY (PropertyInfo (Variant::OBJECT , " mesh" , PROPERTY_HINT_RESOURCE_TYPE , " Mesh" ), " set_mesh" , " get_mesh" );
@@ -1665,6 +1684,7 @@ CPUParticles3D::CPUParticles3D() {
16651684
16661685 set_emitting (true );
16671686 set_amount (8 );
1687+ set_visibility_aabb (AABB (Vector3 (-4 , -4 , -4 ), Vector3 (8 , 8 , 8 )));
16681688
16691689 set_param_min (PARAM_INITIAL_LINEAR_VELOCITY , 0 );
16701690 set_param_min (PARAM_ANGULAR_VELOCITY , 0 );
0 commit comments