From 74808ac4d9176180dc7ecace99723edab8a73e0e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 6 Apr 2017 23:36:37 -0300 Subject: New particle system, mostly working, some small features missing. --- servers/visual/visual_server_scene.cpp | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'servers/visual/visual_server_scene.cpp') 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; @@ -994,11 +986,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: { @@ -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(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 -- cgit v1.2.3