Ability to change indirect light energy.
This commit is contained in:
parent
ecf80fbbba
commit
98cb49283d
5 changed files with 10 additions and 4 deletions
|
@ -4466,6 +4466,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type) {
|
|||
light->type = p_type;
|
||||
|
||||
light->param[VS::LIGHT_PARAM_ENERGY] = 1.0;
|
||||
light->param[VS::LIGHT_PARAM_INDIRECT_ENERGY] = 1.0;
|
||||
light->param[VS::LIGHT_PARAM_SPECULAR] = 0.5;
|
||||
light->param[VS::LIGHT_PARAM_RANGE] = 1.0;
|
||||
light->param[VS::LIGHT_PARAM_SPOT_ANGLE] = 45;
|
||||
|
|
|
@ -222,6 +222,7 @@ void Light::_bind_methods() {
|
|||
ADD_GROUP("Light", "light_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "light_color", PROPERTY_HINT_COLOR_NO_ALPHA), "set_color", "get_color");
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_ENERGY);
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_indirect_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_INDIRECT_ENERGY);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "light_negative"), "set_negative", "is_negative");
|
||||
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "light_specular", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param", "get_param", PARAM_SPECULAR);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "light_cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_cull_mask", "get_cull_mask");
|
||||
|
@ -236,6 +237,7 @@ void Light::_bind_methods() {
|
|||
ADD_GROUP("", "");
|
||||
|
||||
BIND_ENUM_CONSTANT(PARAM_ENERGY);
|
||||
BIND_ENUM_CONSTANT(PARAM_INDIRECT_ENERGY);
|
||||
BIND_ENUM_CONSTANT(PARAM_SPECULAR);
|
||||
BIND_ENUM_CONSTANT(PARAM_RANGE);
|
||||
BIND_ENUM_CONSTANT(PARAM_ATTENUATION);
|
||||
|
@ -273,6 +275,7 @@ Light::Light(VisualServer::LightType p_type) {
|
|||
set_cull_mask(0xFFFFFFFF);
|
||||
|
||||
set_param(PARAM_ENERGY, 1);
|
||||
set_param(PARAM_INDIRECT_ENERGY, 1);
|
||||
set_param(PARAM_SPECULAR, 0.5);
|
||||
set_param(PARAM_RANGE, 5);
|
||||
set_param(PARAM_ATTENUATION, 1);
|
||||
|
|
|
@ -46,6 +46,7 @@ class Light : public VisualInstance {
|
|||
public:
|
||||
enum Param {
|
||||
PARAM_ENERGY = VS::LIGHT_PARAM_ENERGY,
|
||||
PARAM_INDIRECT_ENERGY = VS::LIGHT_PARAM_INDIRECT_ENERGY,
|
||||
PARAM_SPECULAR = VS::LIGHT_PARAM_SPECULAR,
|
||||
PARAM_RANGE = VS::LIGHT_PARAM_RANGE,
|
||||
PARAM_ATTENUATION = VS::LIGHT_PARAM_ATTENUATION,
|
||||
|
|
|
@ -1279,7 +1279,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_view
|
|||
camera->zfar,
|
||||
camera->vaspect
|
||||
|
||||
);
|
||||
);
|
||||
ortho = true;
|
||||
} break;
|
||||
case Camera::PERSPECTIVE: {
|
||||
|
@ -1291,7 +1291,7 @@ void VisualServerScene::render_camera(RID p_camera, RID p_scenario, Size2 p_view
|
|||
camera->zfar,
|
||||
camera->vaspect
|
||||
|
||||
);
|
||||
);
|
||||
ortho = false;
|
||||
|
||||
} break;
|
||||
|
@ -2562,7 +2562,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
|||
InstanceGIProbeData::LightCache lc;
|
||||
lc.type = VSG::storage->light_get_type(E->get()->base);
|
||||
lc.color = VSG::storage->light_get_color(E->get()->base);
|
||||
lc.energy = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_ENERGY);
|
||||
lc.energy = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_ENERGY) * VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_INDIRECT_ENERGY);
|
||||
lc.radius = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_RANGE);
|
||||
lc.attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_ATTENUATION);
|
||||
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
|
||||
|
@ -2582,7 +2582,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
|||
InstanceGIProbeData::LightCache lc;
|
||||
lc.type = VSG::storage->light_get_type(E->get()->base);
|
||||
lc.color = VSG::storage->light_get_color(E->get()->base);
|
||||
lc.energy = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_ENERGY);
|
||||
lc.energy = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_ENERGY) * VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_INDIRECT_ENERGY);
|
||||
lc.radius = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_RANGE);
|
||||
lc.attenuation = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_ATTENUATION);
|
||||
lc.spot_angle = VSG::storage->light_get_param(E->get()->base, VS::LIGHT_PARAM_SPOT_ANGLE);
|
||||
|
|
|
@ -360,6 +360,7 @@ public:
|
|||
enum LightParam {
|
||||
|
||||
LIGHT_PARAM_ENERGY,
|
||||
LIGHT_PARAM_INDIRECT_ENERGY,
|
||||
LIGHT_PARAM_SPECULAR,
|
||||
LIGHT_PARAM_RANGE,
|
||||
LIGHT_PARAM_ATTENUATION,
|
||||
|
|
Loading…
Reference in a new issue