diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-04-06 23:36:37 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-04-06 23:49:27 -0300 |
commit | 74808ac4d9176180dc7ecace99723edab8a73e0e (patch) | |
tree | 065e903073bbdebe864bb6322ca0abc2fca108bb /servers/visual/visual_server_scene.cpp | |
parent | 25d09b92be0f5d86cdee6eada80823cdcc2d42bc (diff) |
New particle system, mostly working, some small features missing.
Diffstat (limited to 'servers/visual/visual_server_scene.cpp')
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 9b77ca9e1c..acaf5dc792 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -29,6 +29,7 @@ #include "visual_server_scene.h" #include "os/os.h" #include "visual_server_global.h" +#include "visual_server_raster.h" /* CAMERA API */ RID VisualServerScene::camera_create() { @@ -609,7 +610,8 @@ void VisualServerScene::instance_set_base(RID p_instance, RID p_base) { } break; case VS::INSTANCE_MESH: case VS::INSTANCE_MULTIMESH: - case VS::INSTANCE_IMMEDIATE: { + case VS::INSTANCE_IMMEDIATE: + case VS::INSTANCE_PARTICLES: { InstanceGeometryData *geom = memnew(InstanceGeometryData); instance->base_data = geom; @@ -975,16 +977,6 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF switch (p_flags) { - case VS::INSTANCE_FLAG_BILLBOARD: { - - instance->billboard = p_enabled; - - } break; - case VS::INSTANCE_FLAG_BILLBOARD_FIX_Y: { - - instance->billboard_y = p_enabled; - - } break; case VS::INSTANCE_FLAG_CAST_SHADOW: { if (p_enabled == true) { instance->cast_shadows = VS::SHADOW_CASTING_SETTING_ON; @@ -995,11 +987,6 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF instance->base_material_changed(); // to actually compute if shadows are visible or not } break; - case VS::INSTANCE_FLAG_DEPH_SCALE: { - - instance->depth_scale = p_enabled; - - } break; case VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS: { instance->visible_in_all_rooms = p_enabled; @@ -1050,6 +1037,11 @@ void VisualServerScene::_update_instance(Instance *p_instance) { reflection_probe->reflection_dirty = true; } + if (p_instance->base_type == VS::INSTANCE_PARTICLES) { + + VSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform); + } + if (p_instance->aabb.has_no_surface()) return; @@ -1235,6 +1227,11 @@ void VisualServerScene::_update_instance_aabb(Instance *p_instance) { new_aabb = VSG::storage->immediate_get_aabb(p_instance->base); } break; + case VisualServer::INSTANCE_PARTICLES: { + + new_aabb = VSG::storage->particles_get_aabb(p_instance->base); + + } break; #if 0 case VisualServer::INSTANCE_PARTICLES: { @@ -1914,6 +1911,13 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform, const Cam InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(ins->base_data); + if (ins->base_type == VS::INSTANCE_PARTICLES) { + //particles visible? process them + VSG::storage->particles_request_process(ins->base); + //particles visible? request redraw + VisualServerRaster::redraw_request(); + } + if (geom->lighting_dirty) { int l = 0; //only called when lights AABB enter/exit this geometry |