Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue11 2 #253

Closed
wants to merge 87 commits into from
Closed

Issue11 2 #253

wants to merge 87 commits into from

Conversation

donbright
Copy link
Sponsor Member

Hi Marius

This is a proposed fix for issue #11 , cmdline output of images from OpenSCAD.
Currently it only works on CGAL, and has only been tested under Linux and Wine
I am submitting this now to see what you think - before I go any further down the road to get OpenCSG and --viewport working.

usage:

   openscad -o image.png file.scad --render

(In the future, omitting '--render' will cause OpenCSG to be used)

The patch is highly experimental - I had to refactor quite a bit. The big changes are as follows:

A. Rewrite the Offscreen PNG writing code to use std::ostream instead of filename
(because all other output, like STL, DXF, etc, was based on passing std::ostreams so I stuck with that convention)

A.1. This meant rewriting some of the Mac OSX code (imageutils-macosx.cc) when I don't actually have access to a Mac. I am very unsure about this.... but I tried to copy other examples I have seen of creating a DataConsumer from an std::ostream

A.2. I also refactored quite a bit of the image writing code in OffscreenContext.* and imageutils* to reduce duplication of code

B. Move a bunch of code from the Test Suite to the main 'src' directory

C. Refactor the Test Suite to actually be able to test against the gui cmdline.

I went for the 'most direct, easiest' approach here - I simply copied all the "regression/cgalpngtest" images to "regression/guicgalpngtest" and created a "guicgalpngtest" shell wrapper to 'fool' the existing infrastructure into calling the already-built GUI openscad binary using the '-o' parameter. This did reveal one issue with the "root modifier" (! character), which caused more refactoring of node.cc and several other files.

It is very inefficient space-wise for now to have duplicate sets of test images, but for now it works. In fact it enables the running of 'guicgalpngtest' without having to run 'make' under the testing directory and build all the other tests. For example -

     git submodule update --init # MCAD
     qmake && make
     cd tests && mkdir bin && cd bin && cmake ..
     ctest -R guicgalpngtest 

Gives a 100% pass. (for some reason tests in the SRC dir itself dont find MCAD)

Please let me know what you think...

@donbright
Copy link
Sponsor Member Author

closing. i had to add some compatability for win32 and am in the middle of doing opencsg. will re-request pull later.

@donbright donbright closed this Feb 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants