diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-03-15 10:22:09 +0100 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-03-15 10:22:09 +0100 |
commit | aec4f57f9507208f9aef499d8a8e8d1642bf2c72 (patch) | |
tree | fc326c281798915e9f6f38ab96d3b2ee30b69672 /servers/visual/visual_server_raster.cpp | |
parent | c1a1adae280c6a25fa776dfd083b6d7a48f580c0 (diff) | |
parent | de5281c3989fd4071cf57e5b7bc0cbbc174524e8 (diff) |
Merge pull request #3528 from SaracenOne/baked_light_realtime_colourize
Ability to colourize baked lighting in real time.
Diffstat (limited to 'servers/visual/visual_server_raster.cpp')
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 6d293f0ce8..1db7971d3b 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 */ |