1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

New particle system, mostly working, some small features missing.

This commit is contained in:
Juan Linietsky
2017-04-06 23:36:37 -03:00
parent 25d09b92be
commit 74808ac4d9
76 changed files with 5509 additions and 1911 deletions

View File

@@ -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<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