Skip to content
Snippets Groups Projects
Commit b6a3b32d authored by Pascal Engeler's avatar Pascal Engeler
Browse files

drawer readme complete

parent f5d936bc
No related branches found
No related tags found
No related merge requests found
......@@ -98,23 +98,64 @@ Todo
- `~Drawer()`
- **Public Function Members**
- `void start_drawing(const float x, const float y)`
- `void start_drawing(const float x, const float y)`:
Signal that this object's drawing starts at coordinates (`x`, `y`) (typically the fingerdown location).
The two arguments are both in $[-1, 1]$.
Nothing is drawn by this function.
- `bool draw(const float x, const float y, Toolbox& tb, bool drawing)`
Draws a stroke from the last position to (`x`, `y`).
The `tb` and `drawing` arguments are passed on to `calculate_points`.
First calculates updates the position and calculates the new points, uploads them to the current `GL_ARRAY_BUFFER` and finally draws them via `glDrawArrays`.
Returns `true` if something was drawn, and `false` else (typically if the new point is equal to the previous point).
- `void redraw(Toolbox&)`
Issues a drawcall (`glDrawArrays`).
The argument is unused.
Correct usage first calls `draw`, then calls `redraw` without changing the state of `GL_ARRAY_BUFFER` in between (typically, framebuffer and texture bindings are changed in between).
- `void erase(const float x, const float y, Toolbox& tb)`
Deprecated, use `draw(x, y, tb, false)` instead.
- `int num_drawn()`
Returns the number of calls to `draw` and `erase` performed by this object.
- **Private Function Members**
- `bool calculate_points_(Toolbox& tb, bool drawing)`
Calculates the triangulation of the stroke represented by the internal parameters and stores them in `points_`.
The `drawing` argument switches the stroke width (`true`->`tb.drawing_width`, `false`->`tb.erasing_width`).
Uses `tb.texture_w`.
Returns `true` if new points were calculated, and `false` else (typically if the internal state represents an equal new and old point).
- **Public Data Members**
N/A
- **Private Data Members**
- `float x0_, y0_, x1_, y1_`
Internal representation of old ('0') and new ('1') points.
- `int num_drawn_`
Number of calls to `draw` and `erase`.
- `std::vector<float> points_`
Vertex coordinates that represent the stroke between old and new points, as calculated by `calculate_points_`.
- **Notes**
N/A
### DrawingHandler (`drawing_handler.hpp`, `drawing_handler.cpp`)
Todo
### EfficientBlock (`efficient_block.hpp`, `efficient_block.cpp`)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment