benl23x5/gloss — pull request #11 by elisehuard (2014-11-14 11:53:31+00:00)
Title: Separate rendering into gloss-rendering package

Main result: Graphics.Gloss now exports a render function, which come from gloss-rendering. This renders a gloss Picture (see gloss-render example in gloss-examples).
It was not a small refactor, so I'm submitting this pull request for feedback:

* had to change signature of renderPicture and renderAction (so as not to use viewstate and backend, but only the bits relevant to rendering, which is windowsize and viewport)
* renderAction and renderPicture are now exported by Graphics.Gloss.Render

Examples:
* had to change to import Graphics.Gloss instead of importing the Graphics.Gloss.Data modules directly
* World is a qualified import because it has a render function
* in occlusion I had to refer to gloss-rendering directly, as it requires Extent and QuadTree

So it does break backwards compatibility in that current users of Gloss cannot refer to most of the Graphics.Gloss.Data modules without explicitly requiring gloss-rendering (see gloss-occlusion example). They can get the most commone one by importing Graphics.Gloss instead. I'm happy to change this if you have any idea of how to do that.

possible TODOs:

* version number for gloss-rendering in cabal files (also, what number to start at)
* initializing of clear color happens on every loop, which is unavoidable if we want a functional interface with just one 'render' function
* render example is a little clunky
* Graphics.Gloss.Algorithms.RayCast module: does it belong in rendering? (no explicit dependencies)
* Graphics.Gloss.Internals.Color is exposed (glColor4OfColor), so no longer internals to rendering - change name? (same with Graphics.Gloss.Internals.Render.State)

All the examples run fine, and I didn't change any features that I know of.

Let me know what you think