Marbellous
Marbellous, a WebApp to generate paper marbling patterns.
Public Member Functions | List of all members
WGLRakeRenderer Class Reference

Implementation of raking. More...

#include <WGLRakeRenderer.hpp>

Inheritance diagram for WGLRakeRenderer:
Inheritance graph
Collaboration diagram for WGLRakeRenderer:
Collaboration graph

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ WGLRakeRenderer()

WGLRakeRenderer::WGLRakeRenderer ( WGLSceneRenderer sr,
Scene const &  s 
)

Construct a new WGLRakeRenderer object.

Parameters
srWGLSceneRenderer used to render a color code image from Scene s
sScene to use as initial state.
Here is the call graph for this function:

Member Function Documentation

◆ draw()

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.

Parameters
target_fboFramebuffer to draw to.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawToBuffer()

void WGLRakeRenderer::drawToBuffer ( void *  buf,
size_t  length 
)

Save the current rake state to a buffer.

Used for screenshots.

Parameters
bufPreallocated buffer to use.
lengthSize of the buffer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rake()

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).

Parameters
xx-direction of the stroke
yy-direction of the stroke
periodPeriod length of wavy movement.
amplitudeAmplitude of wavy movement.
phasePhase shift of wavy movement.
nailsRake representation. 1000 possible equally positioned tines with TRUE if the tine is present and FALSE otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void WGLRakeRenderer::reset ( WGLSceneRenderer sr,
Scene const &  s 
)

Resets the WGLRakeRenderer to a new initial state.

Parameters
srWGLSceneRenderer used to render a color code image from Scene s
sScene to use as initial state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize()

void WGLRakeRenderer::resize ( )
overridevirtual

Resize to the resolution set for rake state in WGLContext.

Implements WGLRenderer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActive()

void WGLRakeRenderer::setActive ( ) const
overridevirtual

Set the WebGL state needed for the shader.

Implements WGLRenderer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swapBuffers()

void WGLRakeRenderer::swapBuffers ( )

Swap internal rake state buffers.

This efficiently implements a one step undo.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: