diff --git a/README.md b/README.md index a26d6d081f4130629889393d6ce9912f365c41d5..5f284e18a63ab44632df42f2264ea6eee0123356 100644 --- a/README.md +++ b/README.md @@ -1403,47 +1403,47 @@ Handles simulation and rendering of the wave. **Public Function Members** -- `bool initialize(const std::string damping_file, const std::string palette_file)` +- **`bool initialize(const std::string damping_file, const std::string palette_file)`** - Description: Fully initialize the object (especially shaders, textures, framebuffers and other OpenGL infrastructure) - Preconditions: N/A - Postconditions: The object is fully initialized - Notes: Without a call to this function, the object is not functional. -- `void update(Toolbox&)` +- **`void update(Toolbox&)`** - Description: Handle all messages addressed to this object - Preconditions: N/A - Postconditions: All relevant messages have been handled - Notes: N/A -- `void prepare_step()` +- **`void prepare_step()`** - Description: Prepare for timestepping by combining the dynamic and static damping textures into one texture. - Preconditions: N/A - Postconditions: The texture `tex_comp_damp_` has been updated - Notes: N/A -- `bool step(Toolbox& tb, const int num_dsteps)` +- **`bool step(Toolbox& tb, const int num_dsteps)`** - Description: Perform `num_dsteps` double-timesteps on the wave - Preconditions: N/A - Postconditions: 2*`num_dsteps` timesteps have been performed and the latest step is stored in `tex_comp_wave_1_`. - Notes: Always returns `true` -- `bool render()` +- **`bool render()`** - Description: Render `tex_comp_damp_` and `tex_wave_1_` using the color scheme `tex_palette_` to the current screenbuffer using shader `shdr_2d_` - Preconditions: N/A - Postconditions: The state has been rendered - Notes: Always returns `true` -- `GLuint get_damping_tex() const` +- **`GLuint get_damping_tex() const`** - Description: Get the combined damping texture - Preconditions: N/A - Postconditions: The combined damping texture handler is returned - Notes: N/A -- `unsigned get_width() const` +- **`unsigned get_width() const`** - Description: Get the window width - Preconditions: N/A - Postconditions: The window width is returned - Notes: N/A -- `unsigned get_height() const` +- **`unsigned get_height() const`** - Description: Get the window height - Preconditions: N/A - Postconditions: The window height is returned - Notes: N/A -- `void generate_and_transfer_textures(Toolbox&)` +- **`void generate_and_transfer_textures(Toolbox&)`** - Description: Generate textures and transfer these and existing textures to the `Toolbox`. - Preconditions: N/A - Postconditions: Three textures have been generated and initialized correctly: `tb.tex_damp_clean`, `tb.tex_wave_clean`, `tb.tex_const_zero`. @@ -1452,17 +1452,17 @@ Handles simulation and rendering of the wave. **Private Function Members** -- `bool initialize_2D_data_()` +- **`bool initialize_2D_data_()`** - Description: Initialize OpenGL infrastructure to perform timesteps - Preconditions: N/A - Postconditions: The objects `num_elements_2d`, `vao_2d_`, `vbo_2d_`, `ebo_2d_` have been initialized - Notes: N/A -- `bool initialize_3D_data_()` +- **`bool initialize_3D_data_()`** - Description: Do not call - Preconditions: N/A - Postconditions: N/A - Notes: N/A -- `bool initialize_comp_data_(const std::string)` +- **`bool initialize_comp_data_(const std::string)`** - Description: Initialize damping and wave textures, and time stepping framebuffers - Preconditions: The argument specifies the damping file, without extension. - Postconditions: The vanilla damping profile has been loaded from file, or a backup has been generated in case the file is missing. @@ -1470,24 +1470,24 @@ Handles simulation and rendering of the wave. The wave textures `tex_comp_wave_0_` and `tex_comp_wave_1_` have been generated and initialized. The framebuffers `fb_comp_0_`, `fb_comp_1_`, `fb_comp_damp_` have been generated and initialized. - Notes: Always returns `true` -- `bool initialize_render_data_(const std::string)` +- **`bool initialize_render_data_(const std::string)`** - Description: Load the colour palette and upload it to the GPU, initialize rendering infrastructure - Preconditions: The argument specifies a file where the colour palette texture can be found (without extension) - Postconditions: The colour palette has been loaded from file and uploaded to the GPU in texture `tex_palette_`. The rendering infrastructure, namely `vao_render_`, `vbo_render_`, `ebo_render_` have been generated and initialized. - Notes: Always returns `true`, except when the colour palette file is invalid. -- `bool initialize_shaders_()` +- **`bool initialize_shaders_()`** - Description: Initialize all shaders - Preconditions: N/A - Postconditions: The following shaders have been initialized from source: `shdr_step_`(stepwave), `shdr_2d_`(render2d), `shdr_2d_dbg_`(render2d), `shdr_damp_`(combine_damping) and their uniforms have been set - Notes: Always returns `true` -- `bool load_damping_(const std::string)` +- **`bool load_damping_(const std::string)`** - Description: Load a damping texture from file into `tex_damp_data_` - Preconditions: The argument specifies a damping file without file extension - Postconditions: The damping texture has been loaded into `tex_damp_data_`. On success, `true` has been returned, `false` else. - Notes: In the same directory, there needs to be a `.conf` and a `.texture` file with the specified name. This function is very inefficient and can be optimized. -- `bool load_palette_(const std::string)` +- **`bool load_palette_(const std::string)`** - Description: Load the colour palette texture from file into `palette_` - Preconditions: The argument specifies the palette file without file extension - Postconditions: The colour palette texture has been loaded into `palette_`. On success, `true` has been returned, `false` else. @@ -1566,7 +1566,7 @@ The ImGui library has been customized in the following way: - To run `ImGui` demos, one must revert the change to `ImGui_ImplSDL2_NewFrame` (see comments). ## GLSL Shaders -### **[`combine_damping.vert`](shaders/combine_damping.vert) [`combine_damping.frag`](shaders/combine_damping.frag)** +### **combine_damping** ([`combine_damping.vert`](shaders/combine_damping.vert), [`combine_damping.frag`](shaders/combine_damping.frag)) This shader takes two damping textures and renders the combination of the two. Combination is performed using `min`. @@ -1582,7 +1582,7 @@ uniform sampler2D tex_damping_static; //static damping uniform sampler2D tex_damping_dynamic; //dynamic damping ``` -### **[`copy_texture.vert`](shaders/copy_texture.vert) [`copy_texture.frag`](shaders/copy_texture.frag)** +### **copy_texture** ([`copy_texture.vert`](shaders/copy_texture.vert), [`copy_texture.frag`](shaders/copy_texture.frag)) This shader copies a `source_texture` to the output @@ -1597,7 +1597,7 @@ Uniforms: uniform sampler2D source_texture; ``` -### **[`draw.vert`](shaders/draw.vert) [`draw.frag`](shaders/draw.frag)** +### **draw** ([`draw.vert`](shaders/draw.vert), [`draw.frag`](shaders/draw.frag)) This shader is used to draw, in the sense of "Zeichnen" and "Radieren". @@ -1611,7 +1611,7 @@ Uniforms: uniform sampler2D source_texture; ``` -### **[`draw_blocks.vert`](shaders/draw_blocks.vert) [`draw_blocks.frag`](shaders/draw_blocks.frag)** +### **draw_blocks** ([`draw_blocks.vert`](shaders/draw_blocks.vert), [`draw_blocks.frag`](shaders/draw_blocks.frag)) This shader is used to draw blocks (see `SlimBlockchainHandler`). @@ -1627,7 +1627,7 @@ uniform float color_multiplier; uniform sampler2D source_texture; ``` -### **[`render2d.vert`](shaders/render2d.vert) [`render2d.frag`](shaders/render2d.frag)** +### **render2d** ([`render2d.vert`](shaders/render2d.vert), [`render2d.frag`](shaders/render2d.frag)) This shader is used to render the current wave state with a custom colour palette, along with the current damping. @@ -1644,7 +1644,7 @@ uniform sampler2D tex_damp; //damping uniform sampler1D tex_palette; //colour palette ``` -### **[`stepwave.vert`](shaders/stepwave.vert) [`stepwave.frag`](shaders/stepwave.frag)** +### **stepwave** ([`stepwave.vert`](shaders/stepwave.vert), [`stepwave.frag`](shaders/stepwave.frag)) This shader takes an input wave and damping texture, and renders the state of the wave one timestep in the future.