|
Marbellous
Marbellous, a WebApp to generate paper marbling patterns.
|
Implementation of raking. More...
#include <WGLRakeRenderer.hpp>


Public Member Functions | |
| WGLRakeRenderer (WGLSceneRenderer &sr, Scene const &s) | |
| Construct a new WGLRakeRenderer object. More... | |
| void | setActive () const override |
| Set the WebGL state needed for the shader. More... | |
| void | reset (WGLSceneRenderer &sr, Scene const &s) |
| Resets the WGLRakeRenderer to a new initial state. More... | |
| void | resize () override |
| Resize to the resolution set for rake state in WGLContext. More... | |
| void | rake (float x, float y, float period, float amplitude, float phase, GLint nails[1000]) |
| Compute a rake step. More... | |
| void | draw (GLuint target_fbo=0) |
Draw the current raked stated to target_fbo. More... | |
| void | drawToBuffer (void *buf, size_t length) |
| Save the current rake state to a buffer. More... | |
| void | swapBuffers () |
| Swap internal rake state buffers. More... | |
Implementation of raking.
For rakes the data and rendering are not decoupled as Scene objects and WGLSceneRenderer objects are. This was a more simple approach which was also very beneficial for performance due to offloading to GPU.
| WGLRakeRenderer::WGLRakeRenderer | ( | WGLSceneRenderer & | sr, |
| Scene const & | s | ||
| ) |
Construct a new WGLRakeRenderer object.
| sr | WGLSceneRenderer used to render a color code image from Scene s |
| s | Scene to use as initial state. |

| void WGLRakeRenderer::draw | ( | GLuint | target_fbo = 0 | ) |
Draw the current raked stated to target_fbo.
The default 0 is the visible context in the frontend.
| target_fbo | Framebuffer to draw to. |


| void WGLRakeRenderer::drawToBuffer | ( | void * | buf, |
| size_t | length | ||
| ) |
Save the current rake state to a buffer.
Used for screenshots.
| buf | Preallocated buffer to use. |
| length | Size of the buffer. |


| void WGLRakeRenderer::rake | ( | float | x, |
| float | y, | ||
| float | period, | ||
| float | amplitude, | ||
| float | phase, | ||
| GLint | nails[1000] | ||
| ) |
Compute a rake step.
For amplitude values greater than 0 this results in a wavy rake movement. curr_tex will be toggled afterwards so that the hidden color code buffers will be switched. The rake stroke strength is encoded by x and y though other directions than horizontal or vertical are not supported (yet).
| x | x-direction of the stroke |
| y | y-direction of the stroke |
| period | Period length of wavy movement. |
| amplitude | Amplitude of wavy movement. |
| phase | Phase shift of wavy movement. |
| nails | Rake representation. 1000 possible equally positioned tines with TRUE if the tine is present and FALSE otherwise. |


| void WGLRakeRenderer::reset | ( | WGLSceneRenderer & | sr, |
| Scene const & | s | ||
| ) |
Resets the WGLRakeRenderer to a new initial state.
| sr | WGLSceneRenderer used to render a color code image from Scene s |
| s | Scene to use as initial state. |


|
overridevirtual |
Resize to the resolution set for rake state in WGLContext.
Implements WGLRenderer.


|
overridevirtual |
Set the WebGL state needed for the shader.
Implements WGLRenderer.


| void WGLRakeRenderer::swapBuffers | ( | ) |
Swap internal rake state buffers.
This efficiently implements a one step undo.
