Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-08-14 11:58:20 +0000
committerStijn Buys <ingar@osirion.org>2009-08-14 11:58:20 +0000
commit05928e35b08a47f5c80b7aa9a5b391a0c1d76ad5 (patch)
tree2d5fb3bb77c03a42195aba1ddc751802e31ed2d7 /src
parentbab6eff9da1927a4fc1e22d97e56199c1b677670 (diff)
implemented r_normalize cvar
Diffstat (limited to 'src')
-rw-r--r--src/render/draw.cc52
-rw-r--r--src/render/render.cc6
-rw-r--r--src/render/render.h2
3 files changed, 48 insertions, 12 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index a48908f..0b6fba2 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -1115,9 +1115,6 @@ void draw_pass_model_fx(float elapsed)
void draw_pass_model_radius()
{
- if (!(r_radius && r_radius->value()))
- return;
-
for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
core::Entity *entity = (*it);
@@ -1213,7 +1210,13 @@ void draw(float seconds)
gl::enable(GL_COLOR_MATERIAL); // enable color tracking
gl::enable(GL_LIGHTING); // enable lighting
- gl::enable(GL_NORMALIZE); // enable rescaling of normals
+ if (r_normalize && r_normalize->value()) {
+ // enable full normalization
+ gl::enable(GL_NORMALIZE);
+ } else {
+ // enable rescaling of normals
+ gl::enable(GL_RESCALE_NORMAL);
+ }
draw_pass_globes(); // draw globes
@@ -1221,7 +1224,13 @@ void draw(float seconds)
draw_pass_model_fragments();
- gl::disable(GL_NORMALIZE); // disable resaling of normals
+ if (r_normalize && r_normalize->value()) {
+ // disable full normalization
+ gl::disable(GL_NORMALIZE);
+ } else {
+ // disable resaling of normals
+ gl::disable(GL_RESCALE_NORMAL);
+ }
gl::disable(GL_LIGHTING); // disable lighting
gl::enable(GL_BLEND);
@@ -1233,19 +1242,40 @@ void draw(float seconds)
Dust::draw(zone_color); // draw spacedust
}
- draw_pass_model_fx(seconds); // draw entity lights and engines
+ // draw entity lights, flares and particles
+ draw_pass_model_fx(seconds);
+
+ // draw entity radius globe
+ if (r_radius && r_radius->value()) {
- gl::enable(GL_LIGHTING);
- gl::enable(GL_RESCALE_NORMAL);
+ if (r_normalize && r_normalize->value()) {
+ // enable full normalization
+ gl::enable(GL_NORMALIZE);
+ } else {
+ // enable rescaling of normals
+ gl::enable(GL_RESCALE_NORMAL);
+ }
- draw_pass_model_radius(); // draw entity radius
+ gl::enable(GL_LIGHTING);
+
+ draw_pass_model_radius();
+
+ gl::disable(GL_LIGHTING);
+
+ if (r_normalize && r_normalize->value()) {
+ // disable full normalization
+ gl::disable(GL_NORMALIZE);
+ } else {
+ // disable resaling of normals
+ gl::disable(GL_RESCALE_NORMAL);
+ }
+ }
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- gl::disable(GL_RESCALE_NORMAL);
- gl::disable(GL_LIGHTING);
+
gl::disable(GL_COLOR_MATERIAL); // disable color tracking
gl::disable(GL_CULL_FACE); // disable culling
diff --git a/src/render/render.cc b/src/render/render.cc
index e37f5f2..27204f6 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -35,6 +35,7 @@ core::Cvar *r_wireframe = 0;
core::Cvar *r_mipmap = 0;
core::Cvar *r_collision = 0;
core::Cvar *r_normals = 0;
+core::Cvar *r_normalize = 0;
void func_list_textures(std::string const &args)
{
@@ -72,6 +73,9 @@ void init(int width, int height)
r_normals = core::Cvar::get("r_normals", "0", core::Cvar::Archive);
r_normals->set_info("[bool] render face normals");
+ r_normalize = core::Cvar::get("r_normalize", "0", core::Cvar::Archive);
+ r_normalize->set_info("[bool] use GL_NORMALIZE instead of GL_RESCALE_NORMAL");
+
r_grid = core::Cvar::get("r_grid", "0", core::Cvar::Archive);
r_grid->set_info("[bool] render the space grid");
@@ -94,7 +98,7 @@ void init(int width, int height)
Screenshot::screenshotquality->set_info("[int] screenshot jpg quality");
// hardware generate mipmaps
- r_mipmap = core::Cvar::get("r_mipmap", "0", core::Cvar::Archive);
+ r_mipmap = core::Cvar::get("r_mipmap", "1", core::Cvar::Archive);
r_mipmap->set_info("[bool] use hardware generated mipmaps");
if (!State::has_generate_mipmaps()) {
con_print << " no hardware generated mipmap support" << std::endl;
diff --git a/src/render/render.h b/src/render/render.h
index 3d07796..0073f57 100644
--- a/src/render/render.h
+++ b/src/render/render.h
@@ -54,6 +54,8 @@ namespace render {
extern core::Cvar *r_collision;
/// use hardware generated mipmaps (requires OpenGL 1.4, does not work on all cards)
extern core::Cvar *r_mipmap;
+ /// use GL_NORMALIZE instead of GL_RESCALE_NORMAL
+ extern core::Cvar *r_normalize;
inline RenderExt *ext_render(core::Entity *entity) { return static_cast<RenderExt *>(entity->extension((size_t)core::Extension::Render)); }
}