diff options
author | Stijn Buys <ingar@osirion.org> | 2010-03-13 13:02:01 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-03-13 13:02:01 +0000 |
commit | b16f437accb2db2effde95d7c6afa7dc5dd70bf6 (patch) | |
tree | b6570816ab01fc9fd9d9b765f9c4591dca0b043c /src/render | |
parent | 6694c79aedea3f5989dd3befdafb7906557f155d (diff) |
lighting cvars patch by megatog615
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 10 | ||||
-rw-r--r-- | src/render/render.cc | 13 | ||||
-rw-r--r-- | src/render/render.h | 6 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 0016bcf..9e6bb5a 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -60,9 +60,9 @@ void pass_prepare(float seconds) // lighting settings for the default light GL_LIGHT0 GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 }; - GLfloat ambient_light[] = { 0.01f, 0.01f, 0.01f, 1.0f }; - GLfloat diffuse_light[] = { 0.2f, 0.2f, 0.2f, 1.0f }; - GLfloat specular_light[] = { 0.2f, 0.2f, 0.2f, 1.0f }; + GLfloat ambient_light[] = { r_ambient->value(), r_ambient->value(), r_ambient->value(), 1.0f }; + GLfloat diffuse_light[] = { r_diffuse->value(), r_diffuse->value(), r_diffuse->value(), 1.0f }; + GLfloat specular_light[] = { r_specular->value(), r_specular->value(), r_specular->value(), 1.0f }; for (size_t i = 0; i < 3; i++) { light_position[i] = Camera::eye()[i]; @@ -107,12 +107,12 @@ void pass_prepare(float seconds) // bright globes set level light GLfloat diffuse_light[4]; GLfloat ambient_light[] = { 0.0f, 0.0f, 0.0f, 1.0f }; - GLfloat specular_light[] = { 0.2f, 0.2f, 0.2f, 1.0f }; + GLfloat specular_light[] = { r_specular->value(), r_specular->value(), r_specular->value(), 1.0f }; for (size_t i = 0; i < 3; i++) { zone_light[i] = globe->location()[i]; zone_color[i] = globe->color()[i]; - diffuse_light[i] = globe->color()[i] * 0.4f; + diffuse_light[i] = globe->color()[i] * (r_diffuse->value() * 2); } zone_light[3] = 1.0f; diffuse_light[3] = 1.0f; diff --git a/src/render/render.cc b/src/render/render.cc index 66b7d42..384280c 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -39,6 +39,10 @@ core::Cvar *r_collision = 0; core::Cvar *r_normals = 0; core::Cvar *r_normalize = 0; +core::Cvar *r_ambient = 0; +core::Cvar *r_diffuse = 0; +core::Cvar *r_specular = 0; + void func_list_textures(std::string const &args) { Textures::list(); @@ -92,6 +96,15 @@ void init(int width, int height) r_particles = core::Cvar::get("r_particles", "1", core::Cvar::Archive); r_particles->set_info("[bool] render particles"); + + r_ambient = core::Cvar::get("r_ambient", "0.1", core::Cvar::Archive); + r_ambient->set_info("[float] ambient light intensity"); + + r_diffuse = core::Cvar::get("r_diffuse", "0.2", core::Cvar::Archive); + r_diffuse->set_info("[float] diffuse light intensity"); + + r_specular = core::Cvar::get("r_specular", "0.2", core::Cvar::Archive); + r_specular->set_info("[float] specular light intensity"); /* r_collision = core::Cvar::get("r_collision", "1", core::Cvar::Archive); r_collision->set_info("[bool] render collision (server side only)"); diff --git a/src/render/render.h b/src/render/render.h index 4d2e9c2..190cdb5 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -62,6 +62,12 @@ extern core::Cvar *r_collision; extern core::Cvar *r_mipmap; /// use GL_NORMALIZE instead of GL_RESCALE_NORMAL extern core::Cvar *r_normalize; +/// ambient light intensity +extern core::Cvar *r_ambient; +/// diffuse light intensity +extern core::Cvar *r_diffuse; +/// specular light intensity +extern core::Cvar *r_specular; inline RenderExt *ext_render(const core::Entity *entity) { |