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

typesetting test

parent 616fe750
No related branches found
No related tags found
No related merge requests found
......@@ -88,70 +88,74 @@ Todo
Note that this class relies on the caller to its methods to take care of the Opengl state (using shaders, binding buffers, etc.).
See `DrawingHandler` for more information on how this class is to be used.
- **Constructors and Destructors**
- `Drawer(Toolbox&)`
- `Drawer(const Drawer&)`
- `~Drawer()`
**Constructors and Destructors**
- **Public Function Members**
- `void start_drawing(const float x, const float y)`:
`Drawer(Toolbox&)`
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.
`Drawer(const Drawer&)`
- `bool draw(const float x, const float y, Toolbox& tb, bool drawing)`
`~Drawer()`
**Public Function Members**
- `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`.
Draws a stroke from the last position to (`x`, `y`).
The `tb` and `drawing` arguments are passed on to `calculate_points`.
First updates the position and calculates the new points, uploads them to the current `GL_ARRAY_BUFFER` and finally draws them via `glDrawArrays`.
First 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).
Returns `true` if something was drawn, and `false` else (typically if the new point is equal to the previous point).
- `void redraw(Toolbox&)`
- `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).
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)`
- `void erase(const float x, const float y, Toolbox& tb)`
Deprecated, use `draw(x, y, tb, false)` instead.
Deprecated, use `draw(x, y, tb, false)` instead.
- `int num_drawn()`
- `int num_drawn()`
Returns the number of calls to `draw` and `erase` performed by this object.
Returns the number of calls to `draw` and `erase` performed by this object.
- **Private Function Members**
- `bool calculate_points_(Toolbox& tb, bool drawing)`
**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`.
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).
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**
**Public Data Members**
N/A
N/A
- **Private Data Members**
- `float x0_, y0_, x1_, y1_`
**Private Data Members**
- `float x0_, y0_, x1_, y1_`
Internal representation of old ('0') and new ('1') points.
- `int num_drawn_`
Internal representation of old ('0') and new ('1') points.
- `int num_drawn_`
Number of calls to `draw` and `erase`.
Number of calls to `draw` and `erase`.
- `std::vector<float> points_`
- `std::vector<float> points_`
Vertex coordinates that represent the stroke between old and new points, as calculated by `calculate_points_`.
Vertex coordinates that represent the stroke between old and new points, as calculated by `calculate_points_`.
**Notes**
- **Notes**
N/A
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.
Finish editing this message first!
Please register or to comment