summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-03-04 02:08:04 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-03-04 02:08:04 (GMT)
commit689fdad0acfd17aa2676bd5bcf34ebba29c383a5 (patch)
tree2d080d032c80bb281eea89cb3f1cf718037afe46 /src
parent50fcfe63c960d925318b5b9a613599d2e11c0f97 (diff)
move FAR_FAR_AWAY (gl clipping limit) to rendersettings
Diffstat (limited to 'src')
-rw-r--r--src/GLView.cc9
-rw-r--r--src/GLView.h27
-rw-r--r--src/rendersettings.cc1
-rw-r--r--src/rendersettings.h2
4 files changed, 20 insertions, 19 deletions
diff --git a/src/GLView.cc b/src/GLView.cc
index aff3583..9f51cd0 100644
--- a/src/GLView.cc
+++ b/src/GLView.cc
@@ -17,6 +17,7 @@ GLView::GLView()
showcrosshairs = false;
renderer = NULL;
cam = Camera();
+ far_far_away = RenderSettings->inst()->far_gl_clip_limit;
#ifdef ENABLE_OPENCSG
is_opencsg_capable = false;
has_shaders = false;
@@ -48,7 +49,7 @@ void GLView::setupGimbalCamPerspective()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-w_h_ratio, +w_h_ratio, -(1/w_h_ratio), +(1/w_h_ratio), +10.0, +FAR_FAR_AWAY);
+ glFrustum(-w_h_ratio, +w_h_ratio, -(1/w_h_ratio), +(1/w_h_ratio), +10.0, +far_far_away);
gluLookAt(0.0, -cam.viewer_distance, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
}
@@ -61,7 +62,7 @@ void GLView::setupGimbalCamOrtho(double distance, bool offset)
double l = distance/10;
glOrtho(-w_h_ratio*l, +w_h_ratio*l,
-(1/w_h_ratio)*l, +(1/w_h_ratio)*l,
- -FAR_FAR_AWAY, +FAR_FAR_AWAY);
+ -far_far_away, +far_far_away);
gluLookAt(0.0, -cam.viewer_distance, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
}
@@ -81,7 +82,7 @@ void GLView::setupVectorCamOrtho(bool offset)
double l = (cam.center - cam.eye).norm() / 10;
glOrtho(-w_h_ratio*l, +w_h_ratio*l,
-(1/w_h_ratio)*l, +(1/w_h_ratio)*l,
- -FAR_FAR_AWAY, +FAR_FAR_AWAY);
+ -far_far_away, +far_far_away);
}
void GLView::setCamera( Camera &cam )
@@ -249,7 +250,7 @@ void GLView::enable_opencsg_shaders()
void GLView::initializeGL()
{
glEnable(GL_DEPTH_TEST);
- glDepthRange(-FAR_FAR_AWAY, +FAR_FAR_AWAY);
+ glDepthRange(-far_far_away, +far_far_away);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
diff --git a/src/GLView.h b/src/GLView.h
index e06296b..b3d4f3c 100644
--- a/src/GLView.h
+++ b/src/GLView.h
@@ -28,8 +28,6 @@ Some actions (showCrossHairs) only work properly on Gimbal Camera.
#include "renderer.h"
#include "Camera.h"
-#define FAR_FAR_AWAY 100000.0
-
class GLView
{
public:
@@ -58,25 +56,26 @@ public:
virtual bool save(const char *filename) = 0;
virtual std::string getRendererInfo() const = 0;
+ size_t far_far_away;
size_t width;
size_t height;
- double w_h_ratio;
- bool orthomode;
- bool showaxes;
- bool showfaces;
- bool showedges;
- bool showcrosshairs;
+ double w_h_ratio;
+ bool orthomode;
+ bool showaxes;
+ bool showfaces;
+ bool showedges;
+ bool showcrosshairs;
Camera cam;
#ifdef ENABLE_OPENCSG
- GLint shaderinfo[11];
- bool is_opencsg_capable;
- bool has_shaders;
- void enable_opencsg_shaders();
+ GLint shaderinfo[11];
+ bool is_opencsg_capable;
+ bool has_shaders;
+ void enable_opencsg_shaders();
virtual void display_opencsg_warning() = 0;
- bool opencsg_support;
- int opencsg_id;
+ bool opencsg_support;
+ int opencsg_id;
#endif
};
diff --git a/src/rendersettings.cc b/src/rendersettings.cc
index 0777324..e9c2f63 100644
--- a/src/rendersettings.cc
+++ b/src/rendersettings.cc
@@ -13,6 +13,7 @@ RenderSettings *RenderSettings::inst(bool erase)
RenderSettings::RenderSettings()
{
openCSGTermLimit = 2000;
+ far_gl_clip_limit = 100000.0;
img_width = 512;
img_height = 512;
this->colors[BACKGROUND_COLOR] = Color4f(0xff, 0xff, 0xe5);
diff --git a/src/rendersettings.h b/src/rendersettings.h
index cb33981..3d51495 100644
--- a/src/rendersettings.h
+++ b/src/rendersettings.h
@@ -25,7 +25,7 @@ public:
void setColors(const std::map<RenderColor, Color4f> &colors);
Color4f color(RenderColor idx);
- unsigned int openCSGTermLimit, img_width, img_height;
+ unsigned int openCSGTermLimit, img_width, img_height, far_gl_clip_limit;
private:
RenderSettings();
contact: Jan Huwald // Impressum