Merge pull request #3528 from SaracenOne/baked_light_realtime_colourize
Ability to colourize baked lighting in real time.
This commit is contained in:
commit
aec4f57f95
9 changed files with 165 additions and 1 deletions
|
|
@ -528,6 +528,10 @@ public:
|
|||
int octree_steps;
|
||||
Vector2 octree_tex_pixel_size;
|
||||
Vector2 light_tex_pixel_size;
|
||||
|
||||
bool realtime_color_enabled;
|
||||
Color realtime_color;
|
||||
float realtime_energy;
|
||||
};
|
||||
|
||||
struct InstanceData {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -949,6 +949,15 @@ public:
|
|||
virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id);
|
||||
virtual void baked_light_clear_lightmaps(RID p_baked_light);
|
||||
|
||||
virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled);
|
||||
virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const;
|
||||
|
||||
virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color);
|
||||
virtual Color baked_light_get_realtime_color(RID p_baked_light) const;
|
||||
|
||||
virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy);
|
||||
virtual float baked_light_get_realtime_energy(RID p_baked_light) const;
|
||||
|
||||
/* BAKED LIGHT SAMPLER */
|
||||
|
||||
virtual RID baked_light_sampler_create();
|
||||
|
|
|
|||
|
|
@ -391,6 +391,14 @@ public:
|
|||
FUNC3(baked_light_add_lightmap,RID,RID,int);
|
||||
FUNC1(baked_light_clear_lightmaps,RID);
|
||||
|
||||
FUNC2(baked_light_set_realtime_color_enabled, RID, const bool);
|
||||
FUNC1RC(bool, baked_light_get_realtime_color_enabled, RID);
|
||||
|
||||
FUNC2(baked_light_set_realtime_color, RID, const Color&);
|
||||
FUNC1RC(Color, baked_light_get_realtime_color, RID);
|
||||
|
||||
FUNC2(baked_light_set_realtime_energy, RID, const float);
|
||||
FUNC1RC(float, baked_light_get_realtime_energy, RID);
|
||||
|
||||
FUNC0R(RID,baked_light_sampler_create);
|
||||
|
||||
|
|
|
|||
|
|
@ -626,6 +626,15 @@ public:
|
|||
virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id)=0;
|
||||
virtual void baked_light_clear_lightmaps(RID p_baked_light)=0;
|
||||
|
||||
virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled)=0;
|
||||
virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const=0;
|
||||
|
||||
virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color)=0;
|
||||
virtual Color baked_light_get_realtime_color(RID p_baked_light) const=0;
|
||||
|
||||
virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy) = 0;
|
||||
virtual float baked_light_get_realtime_energy(RID p_baked_light) const = 0;
|
||||
|
||||
/* BAKED LIGHT SAMPLER */
|
||||
|
||||
virtual RID baked_light_sampler_create()=0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue