summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-07-23 12:28:15 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-07-23 12:28:50 -0300
commitec85fd554b0ae9861fddabbda1667a93bdd52450 (patch)
tree09d58f29ab90d951c040f971552355b3d54e5f20 /servers
parent0e8f2c81cc58399746fd8f7401cea65a11709acf (diff)
Fix issues with CPUParticles and related conversion from Particles. Closes #20126
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer.h5
-rw-r--r--servers/visual/visual_server_scene.cpp9
-rw-r--r--servers/visual_server.cpp1
-rw-r--r--servers/visual_server.h1
4 files changed, 15 insertions, 1 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 0b37d266e7..731a61890c 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -104,10 +104,12 @@ public:
VS::ShadowCastingSetting cast_shadows;
+ //fit in 32 bits
bool mirror : 8;
bool receive_shadows : 8;
bool visible : 8;
- bool baked_light : 8; //this flag is only to know if it actually did use baked light
+ bool baked_light : 4; //this flag is only to know if it actually did use baked light
+ bool redraw_if_visible : 4;
float depth; //used for sorting
@@ -131,6 +133,7 @@ public:
depth_layer = 0;
layer_mask = 1;
baked_light = false;
+ redraw_if_visible = false;
lightmap_capture = NULL;
}
};
diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp
index 34a1f1458a..887cd7429a 100644
--- a/servers/visual/visual_server_scene.cpp
+++ b/servers/visual/visual_server_scene.cpp
@@ -820,6 +820,11 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance, VS::InstanceF
instance->baked_light = p_enabled;
} break;
+ case VS::INSTANCE_FLAG_REDRAW_FRAME_IF_VISIBLE: {
+
+ instance->redraw_if_visible = p_enabled;
+
+ } break;
}
}
void VisualServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting) {
@@ -1873,6 +1878,10 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(ins->base_data);
+ if (ins->redraw_if_visible) {
+ VisualServerRaster::redraw_request();
+ }
+
if (ins->base_type == VS::INSTANCE_PARTICLES) {
//particles visible? process them
VSG::storage->particles_request_process(ins->base);
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index a48f1cccae..143e56b848 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -2066,6 +2066,7 @@ void VisualServer::_bind_methods() {
BIND_ENUM_CONSTANT(INSTANCE_GEOMETRY_MASK);
BIND_ENUM_CONSTANT(INSTANCE_FLAG_USE_BAKED_LIGHT);
+ BIND_ENUM_CONSTANT(INSTANCE_FLAG_REDRAW_FRAME_IF_VISIBLE);
BIND_ENUM_CONSTANT(INSTANCE_FLAG_MAX);
BIND_ENUM_CONSTANT(SHADOW_CASTING_SETTING_OFF);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 968cb852ed..a76cad24a2 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -805,6 +805,7 @@ public:
enum InstanceFlags {
INSTANCE_FLAG_USE_BAKED_LIGHT,
+ INSTANCE_FLAG_REDRAW_FRAME_IF_VISIBLE,
INSTANCE_FLAG_MAX
};