mirror of https://github.com/vitalif/openscad
cleanup tab spacing
parent
689fdad0ac
commit
94d4acf765
|
@ -514,7 +514,7 @@ main()
|
|||
dep_minver=$find_min_version_result
|
||||
compare_version $dep_minver $dep_sysver
|
||||
dep_compare=$compare_version_result
|
||||
pretty_print $depname $dep_minver $dep_sysver $dep_compare
|
||||
pretty_print $depname $dep_minver $dep_sysver $dep_compare
|
||||
done
|
||||
check_old_local
|
||||
check_misc
|
||||
|
|
|
@ -33,7 +33,7 @@ get_freebsd_deps()
|
|||
get_netbsd_deps()
|
||||
{
|
||||
sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \
|
||||
qt4 glew cgal opencsg modular-xorg
|
||||
qt4 glew cgal opencsg modular-xorg python27 py27-paramiko
|
||||
}
|
||||
|
||||
get_opensuse_deps()
|
||||
|
|
|
@ -15,9 +15,9 @@ GLView::GLView()
|
|||
showfaces = true;
|
||||
showaxes = false;
|
||||
showcrosshairs = false;
|
||||
renderer = NULL;
|
||||
cam = Camera();
|
||||
far_far_away = RenderSettings->inst()->far_gl_clip_limit;
|
||||
renderer = NULL;
|
||||
cam = Camera();
|
||||
far_far_away = RenderSettings->inst()->far_gl_clip_limit;
|
||||
#ifdef ENABLE_OPENCSG
|
||||
is_opencsg_capable = false;
|
||||
has_shaders = false;
|
||||
|
@ -30,7 +30,7 @@ GLView::GLView()
|
|||
|
||||
void GLView::setRenderer(Renderer* r)
|
||||
{
|
||||
renderer = r;
|
||||
renderer = r;
|
||||
}
|
||||
|
||||
void GLView::resizeGL(int w, int h)
|
||||
|
@ -57,8 +57,7 @@ void GLView::setupGimbalCamOrtho(double distance, bool offset)
|
|||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
if(offset)
|
||||
glTranslated(-0.8, -0.8, 0);
|
||||
if (offset) glTranslated(-0.8, -0.8, 0);
|
||||
double l = distance/10;
|
||||
glOrtho(-w_h_ratio*l, +w_h_ratio*l,
|
||||
-(1/w_h_ratio)*l, +(1/w_h_ratio)*l,
|
||||
|
@ -87,16 +86,16 @@ void GLView::setupVectorCamOrtho(bool offset)
|
|||
|
||||
void GLView::setCamera( Camera &cam )
|
||||
{
|
||||
this->cam = cam;
|
||||
this->cam = cam;
|
||||
}
|
||||
|
||||
void GLView::paintGL()
|
||||
{
|
||||
if (cam.type == Camera::GIMBAL) gimbalCamPaintGL();
|
||||
else if (cam.type == Camera::VECTOR) vectorCamPaintGL();
|
||||
else if (cam.type == Camera::NONE) {
|
||||
fprintf(stderr,"paintGL with null camera\n");
|
||||
}
|
||||
if (cam.type == Camera::GIMBAL) gimbalCamPaintGL();
|
||||
else if (cam.type == Camera::VECTOR) vectorCamPaintGL();
|
||||
else if (cam.type == Camera::NONE) {
|
||||
fprintf(stderr,"paintGL with null camera\n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_OPENCSG
|
||||
|
@ -271,7 +270,7 @@ void GLView::initializeGL()
|
|||
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
#ifdef ENABLE_OPENCSG
|
||||
enable_opencsg_shaders();
|
||||
enable_opencsg_shaders();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -317,9 +316,9 @@ void GLView::gimbalCamPaintGL()
|
|||
glEnable(GL_LIGHTING);
|
||||
|
||||
if (cam.projection == Camera::ORTHOGONAL)
|
||||
GLView::setupGimbalCamOrtho(cam.viewer_distance);
|
||||
GLView::setupGimbalCamOrtho(cam.viewer_distance);
|
||||
else
|
||||
GLView::setupGimbalCamPerspective();
|
||||
GLView::setupGimbalCamPerspective();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
@ -357,12 +356,12 @@ void GLView::gimbalCamPaintGL()
|
|||
|
||||
void GLView::showSmallaxes()
|
||||
{
|
||||
// Fixme - this doesnt work in Vector Camera mode
|
||||
// Fixme - this doesnt work in Vector Camera mode
|
||||
|
||||
// Small axis cross in the lower left corner
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
|
||||
GLView::setupGimbalCamOrtho(1000,true);
|
||||
GLView::setupGimbalCamOrtho(1000,true);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
@ -411,10 +410,10 @@ void GLView::showSmallaxes()
|
|||
|
||||
// FIXME: This was an attempt to keep contrast with background, but is suboptimal
|
||||
// (e.g. nearly invisible against a gray background).
|
||||
// int r,g,b;
|
||||
// r=g=b=0;
|
||||
// bgcol.getRgb(&r, &g, &b);
|
||||
// glColor3f((255.0f-r)/255.0f, (255.0f-g)/255.0f, (255.0f-b)/255.0f);
|
||||
// int r,g,b;
|
||||
// r=g=b=0;
|
||||
// bgcol.getRgb(&r, &g, &b);
|
||||
// glColor3f((255.0f-r)/255.0f, (255.0f-g)/255.0f, (255.0f-b)/255.0f);
|
||||
glColor3f(0.0f, 0.0f, 0.0f);
|
||||
glBegin(GL_LINES);
|
||||
// X Label
|
||||
|
@ -427,8 +426,8 @@ void GLView::showSmallaxes()
|
|||
glVertex3d(zlabel_x-3, zlabel_y-3, 0); glVertex3d(zlabel_x+3, zlabel_y-3, 0);
|
||||
glVertex3d(zlabel_x-3, zlabel_y+3, 0); glVertex3d(zlabel_x+3, zlabel_y+3, 0);
|
||||
glVertex3d(zlabel_x-3, zlabel_y-3, 0); glVertex3d(zlabel_x+3, zlabel_y+3, 0);
|
||||
// FIXME - depends on gimbal camera 'viewer distance'.. how to fix this
|
||||
// for VectorCamera?
|
||||
// FIXME - depends on gimbal camera 'viewer distance'.. how to fix this
|
||||
// for VectorCamera?
|
||||
glEnd();
|
||||
|
||||
//Restore perspective for next paint
|
||||
|
@ -438,9 +437,9 @@ void GLView::showSmallaxes()
|
|||
|
||||
void GLView::showAxes()
|
||||
{
|
||||
// FIXME: doesn't work under Vector Camera
|
||||
// Large gray axis cross inline with the model
|
||||
// FIXME: This is always gray - adjust color to keep contrast with background
|
||||
// FIXME: doesn't work under Vector Camera
|
||||
// Large gray axis cross inline with the model
|
||||
// FIXME: This is always gray - adjust color to keep contrast with background
|
||||
glLineWidth(1);
|
||||
glColor3d(0.5, 0.5, 0.5);
|
||||
glBegin(GL_LINES);
|
||||
|
|
|
@ -33,7 +33,6 @@ class GLView
|
|||
public:
|
||||
GLView();
|
||||
void setRenderer(Renderer* r);
|
||||
Renderer *renderer;
|
||||
|
||||
void initializeGL();
|
||||
void resizeGL(int w, int h);
|
||||
|
@ -56,6 +55,8 @@ public:
|
|||
virtual bool save(const char *filename) = 0;
|
||||
virtual std::string getRendererInfo() const = 0;
|
||||
|
||||
Renderer *renderer;
|
||||
Camera cam;
|
||||
size_t far_far_away;
|
||||
size_t width;
|
||||
size_t height;
|
||||
|
@ -66,8 +67,6 @@ public:
|
|||
bool showedges;
|
||||
bool showcrosshairs;
|
||||
|
||||
Camera cam;
|
||||
|
||||
#ifdef ENABLE_OPENCSG
|
||||
GLint shaderinfo[11];
|
||||
bool is_opencsg_capable;
|
||||
|
|
|
@ -126,8 +126,8 @@ bool create_wgl_dummy_context(OffscreenContext &ctx)
|
|||
int chosenformat;
|
||||
HDC dev_context = GetDC( window );
|
||||
if ( dev_context == NULL ) {
|
||||
cerr << "MS GDI - GetDC failed\n";
|
||||
return false;
|
||||
cerr << "MS GDI - GetDC failed\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
ZeroMemory( &pixformat, sizeof( pixformat ) );
|
||||
|
@ -187,7 +187,7 @@ OffscreenContext *create_offscreen_context(int w, int h)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return create_offscreen_context_common( ctx );
|
||||
return create_offscreen_context_common( ctx );
|
||||
}
|
||||
|
||||
bool teardown_offscreen_context(OffscreenContext *ctx)
|
||||
|
@ -207,8 +207,8 @@ bool teardown_offscreen_context(OffscreenContext *ctx)
|
|||
|
||||
bool save_framebuffer(OffscreenContext *ctx, std::ostream &output)
|
||||
{
|
||||
if (!ctx) return false;
|
||||
if (!ctx) return false;
|
||||
wglSwapLayerBuffers( ctx->dev_context, WGL_SWAP_MAIN_PLANE );
|
||||
return save_framebuffer_common( ctx, output );
|
||||
return save_framebuffer_common( ctx, output );
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ OffscreenView::~OffscreenView()
|
|||
#ifdef ENABLE_OPENCSG
|
||||
void OffscreenView::display_opencsg_warning()
|
||||
{
|
||||
fprintf(stderr, "OpenSCAD recommended OpenGL version is 2.0. \n");
|
||||
fprintf(stderr, "OpenSCAD recommended OpenGL version is 2.0. \n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
// overrides
|
||||
bool save(const char *filename);
|
||||
std::string getRendererInfo() const;
|
||||
std::string getRendererInfo() const;
|
||||
#ifdef ENABLE_OPENCSG
|
||||
void display_opencsg_warning();
|
||||
#endif
|
||||
|
|
|
@ -63,7 +63,7 @@ static bool running_under_wine = false;
|
|||
|
||||
void QGLView::init()
|
||||
{
|
||||
cam.type = Camera::GIMBAL;
|
||||
cam.type = Camera::GIMBAL;
|
||||
cam.object_rot << 35, 0, -25;
|
||||
cam.object_trans << 0, 0, 0;
|
||||
cam.viewer_distance = 500;
|
||||
|
@ -89,7 +89,7 @@ void QGLView::initializeGL()
|
|||
if (GLEW_OK != err) {
|
||||
fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
|
||||
}
|
||||
GLView::initializeGL();
|
||||
GLView::initializeGL();
|
||||
}
|
||||
|
||||
std::string QGLView::getRendererInfo() const
|
||||
|
|
|
@ -42,7 +42,7 @@ void export_stl(CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
|||
CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION);
|
||||
try {
|
||||
CGAL_Polyhedron P;
|
||||
root_N->p3->convert_to_Polyhedron(P);
|
||||
root_N->p3->convert_to_Polyhedron(P);
|
||||
|
||||
typedef CGAL_Polyhedron::Vertex Vertex;
|
||||
typedef CGAL_Polyhedron::Vertex_const_iterator VCI;
|
||||
|
|
|
@ -75,22 +75,22 @@ void export_png_with_opencsg(Tree &tree, Camera &cam, std::ostream &output)
|
|||
|
||||
if (cam.type == Camera::NONE) {
|
||||
cam.type = Camera::VECTOR;
|
||||
double radius = 1.0;
|
||||
if (csgInfo.root_chain) {
|
||||
BoundingBox bbox = csgInfo.root_chain->getBoundingBox();
|
||||
cam.center = (bbox.min() + bbox.max()) / 2;
|
||||
radius = (bbox.max() - bbox.min()).norm() / 2;
|
||||
}
|
||||
Vector3d cameradir(1, 1, -0.5);
|
||||
cam.eye = cam.center - radius*1.8*cameradir;
|
||||
double radius = 1.0;
|
||||
if (csgInfo.root_chain) {
|
||||
BoundingBox bbox = csgInfo.root_chain->getBoundingBox();
|
||||
cam.center = (bbox.min() + bbox.max()) / 2;
|
||||
radius = (bbox.max() - bbox.min()).norm() / 2;
|
||||
}
|
||||
Vector3d cameradir(1, 1, -0.5);
|
||||
cam.eye = cam.center - radius*1.8*cameradir;
|
||||
}
|
||||
|
||||
csgInfo.glview->setCamera( cam );
|
||||
csgInfo.glview->setRenderer(&opencsgRenderer);
|
||||
OpenCSG::setContext(0);
|
||||
OpenCSG::setOption(OpenCSG::OffscreenSetting, OpenCSG::FrameBufferObject);
|
||||
csgInfo.glview->paintGL();
|
||||
csgInfo.glview->save(output);
|
||||
csgInfo.glview->setRenderer(&opencsgRenderer);
|
||||
OpenCSG::setContext(0);
|
||||
OpenCSG::setOption(OpenCSG::OffscreenSetting, OpenCSG::FrameBufferObject);
|
||||
csgInfo.glview->paintGL();
|
||||
csgInfo.glview->save(output);
|
||||
#else
|
||||
fprintf(stderr,"This openscad was built without OpenCSG support\n");
|
||||
#endif
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
|
||||
void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize, size_t width, size_t height)
|
||||
{
|
||||
assert( src && dst );
|
||||
size_t rowBytes = pixelsize * width;
|
||||
for (size_t i = 0 ; i < height ; i++) {
|
||||
assert( src && dst );
|
||||
size_t rowBytes = pixelsize * width;
|
||||
for (size_t i = 0 ; i < height ; i++) {
|
||||
memmove(dst + (height - i - 1) * rowBytes, src + i * rowBytes, rowBytes);
|
||||
}
|
||||
}
|
||||
|
||||
bool write_png(const char *filename, unsigned char *pixels, int width, int height) {
|
||||
assert( filename && pixels );
|
||||
assert( filename && pixels );
|
||||
std::ofstream fstream( filename, std::ios::binary );
|
||||
if (fstream.is_open()) {
|
||||
write_png( fstream, pixels, width, height );
|
||||
|
|
|
@ -194,7 +194,7 @@ int main(int argc, char **argv)
|
|||
("version,v", "print the version")
|
||||
("render", "if exporting a png image, do a full CGAL render")
|
||||
("camera", po::value<string>(), "parameters for camera when exporting png")
|
||||
("imgsize", po::value<string>(), "=width,height for exporting png")
|
||||
("imgsize", po::value<string>(), "=width,height for exporting png")
|
||||
("projection", po::value<string>(), "(o)rtho or (p)erspective when exporting png")
|
||||
("o,o", po::value<string>(), "out-file")
|
||||
("s,s", po::value<string>(), "stl-file")
|
||||
|
|
Loading…
Reference in New Issue