From de5281c3989fd4071cf57e5b7bc0cbbc174524e8 Mon Sep 17 00:00:00 2001 From: Saracen Date: Sun, 31 Jan 2016 12:56:53 +0000 Subject: Ability to colourize baked lighting in real time. --- servers/visual/visual_server_raster.cpp | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'servers/visual/visual_server_raster.cpp') diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 3675194325..7ee8431e10 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -1081,6 +1081,9 @@ RID VisualServerRaster::baked_light_create() { baked_light->data.octree_lattice_divide=0; baked_light->data.octree_steps=1; baked_light->data.lightmap_multiplier=1.0; + baked_light->data.realtime_color_enabled=false; + baked_light->data.realtime_color=Color(1.0, 1.0, 1.0); + baked_light->data.realtime_energy = 1.0; return baked_light_owner.make_rid( baked_light ); @@ -1326,6 +1329,63 @@ void VisualServerRaster::baked_light_clear_lightmaps(RID p_baked_light){ } +void VisualServerRaster::baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.realtime_color_enabled = p_enabled; + +} + +bool VisualServerRaster::baked_light_get_realtime_color_enabled(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light, false); + + return baked_light->data.realtime_color_enabled; + +} + +void VisualServerRaster::baked_light_set_realtime_color(RID p_baked_light, const Color& p_color) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.realtime_color = p_color; + +} + +Color VisualServerRaster::baked_light_get_realtime_color(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light, Color(1.0, 1.0, 1.0)); + + return baked_light->data.realtime_color; + +} + +void VisualServerRaster::baked_light_set_realtime_energy(RID p_baked_light, const float p_energy) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.realtime_energy = p_energy; + +} + +float VisualServerRaster::baked_light_get_realtime_energy(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light, 1.0f); + + return baked_light->data.realtime_energy; + +} + /* BAKED LIGHT SAMPLER */ -- cgit v1.2.3