diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/visual/rasterizer.h | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 40 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.h | 3 | ||||
-rw-r--r-- | servers/visual_server.h | 2 |
5 files changed, 43 insertions, 7 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 3b3cd4caa4..27268dcabf 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -105,6 +105,7 @@ public: bool billboard :8; bool billboard_y :8; bool receive_shadows : 8; + bool visible : 8; float depth; //used for sorting @@ -124,10 +125,12 @@ public: depth_scale=false; billboard=false; billboard_y=false; + visible=true; depth_layer=0; layer_mask=1; baked_light=NULL; + } }; diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index f68731bef5..0f75d7ab8b 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -978,6 +978,8 @@ public: BIND2(instance_attach_object_instance_ID,RID,ObjectID ) BIND3(instance_set_morph_target_weight,RID,int , float ) BIND3(instance_set_surface_material,RID,int , RID ) + BIND2(instance_set_visible,RID ,bool) + BIND2(instance_attach_skeleton,RID,RID ) BIND2(instance_set_exterior, RID, bool ) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 91694c3e12..816d423034 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -866,6 +866,41 @@ void VisualServerScene::instance_set_surface_material(RID p_instance,int p_surfa } +void VisualServerScene::instance_set_visible(RID p_instance,bool p_visible) { + + Instance *instance = instance_owner.get( p_instance ); + ERR_FAIL_COND( !instance ); + + if (instance->visible==p_visible) + return; + + instance->visible=p_visible; + + + switch(instance->base_type) { + case VS::INSTANCE_LIGHT: { + if (VSG::storage->light_get_type(instance->base)!=VS::LIGHT_DIRECTIONAL && instance->octree_id && instance->scenario) { + instance->scenario->octree.set_pairable(instance->octree_id,p_visible,1<<VS::INSTANCE_LIGHT,p_visible?VS::INSTANCE_GEOMETRY_MASK:0); + } + + } break; + case VS::INSTANCE_REFLECTION_PROBE: { + if (instance->octree_id && instance->scenario) { + instance->scenario->octree.set_pairable(instance->octree_id,p_visible,1<<VS::INSTANCE_REFLECTION_PROBE,p_visible?VS::INSTANCE_GEOMETRY_MASK:0); + } + + } break; + case VS::INSTANCE_GI_PROBE: { + if (instance->octree_id && instance->scenario) { + instance->scenario->octree.set_pairable(instance->octree_id,p_visible,1<<VS::INSTANCE_GI_PROBE,p_visible?(VS::INSTANCE_GEOMETRY_MASK|(1<<VS::INSTANCE_LIGHT)):0); + } + + } break; + + } + +} + void VisualServerScene::instance_attach_skeleton(RID p_instance,RID p_skeleton){ Instance *instance = instance_owner.get( p_instance ); @@ -981,11 +1016,6 @@ void VisualServerScene::instance_geometry_set_flag(RID p_instance,VS::InstanceFl switch(p_flags) { - case VS::INSTANCE_FLAG_VISIBLE: { - - instance->visible=p_enabled; - - } break; case VS::INSTANCE_FLAG_BILLBOARD: { instance->billboard=p_enabled; diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index aa498e2752..300db1b41c 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -214,7 +214,6 @@ public: AABB transformed_aabb; float extra_margin; uint32_t object_ID; - bool visible; float lod_begin; float lod_end; @@ -494,6 +493,8 @@ public: virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID); virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight); virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material); + virtual void instance_set_visible(RID p_instance,bool p_visible); + virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton); virtual void instance_set_exterior( RID p_instance, bool p_enabled ); diff --git a/servers/visual_server.h b/servers/visual_server.h index cf9fe0fe0b..16f14655df 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -716,6 +716,7 @@ public: virtual void instance_attach_object_instance_ID(RID p_instance,ObjectID p_ID)=0; virtual void instance_set_morph_target_weight(RID p_instance,int p_shape, float p_weight)=0; virtual void instance_set_surface_material(RID p_instance,int p_surface, RID p_material)=0; + virtual void instance_set_visible(RID p_instance,bool p_visible)=0; virtual void instance_attach_skeleton(RID p_instance,RID p_skeleton)=0; virtual void instance_set_exterior( RID p_instance, bool p_enabled )=0; @@ -729,7 +730,6 @@ public: virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane>& p_convex, RID p_scenario=RID()) const=0; enum InstanceFlags { - INSTANCE_FLAG_VISIBLE, INSTANCE_FLAG_BILLBOARD, INSTANCE_FLAG_BILLBOARD_FIX_Y, INSTANCE_FLAG_CAST_SHADOW, |