mirror of https://github.com/vitalif/openscad
move FAR_FAR_AWAY (gl clipping limit) to rendersettings
parent
50fcfe63c9
commit
689fdad0ac
|
@ -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);
|
||||
|
|
27
src/GLView.h
27
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
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue