Shader editor that can be used to tweak shaders on the fly, reloading them and exposing parameters for adjustements.
More...
#include <ShaderEditor.hpp>
|
|
Texture | _frame0 |
| | Content texture.
|
| |
|
Texture | _frame1 |
| | Content texture.
|
| |
|
Texture * | _currFrame |
| | Content texture indirection.
|
| |
|
Texture * | _prevFrame |
| | Content texture indirection.
|
| |
|
std::string | _shaderPath |
| | Path of the current shader on disk.
|
| |
|
std::string | _shaderName |
| | Name of the current shader (for display).
|
| |
|
std::unique_ptr< Program > | _currProgram |
| | Current shader program.
|
| |
|
Program * | _passthrough |
| | Passthrough program.
|
| |
|
GPUQuery | _timer = GPUQuery(GPUQuery::Type::TIME_ELAPSED) |
| | Timer for the user shader pass.
|
| |
|
std::vector< const Texture * > | _textures |
| | List of all predefined textures.
|
| |
|
Texture | _noise |
| | Random 2D RGBA uniform noise in [0,1].
|
| |
|
Texture | _perlin |
| | Random 2D RGBA periodic Perlin noise in [0,1].
|
| |
|
Texture | _directions |
| | Random 3D directions on the sphere.
|
| |
|
Texture | _noise3D |
| | Random 3D RGBA uniform noise in [0,1].
|
| |
|
Texture | _perlin3D |
| | Random 3D RGBA periodic Perlin noise in [0,1].
|
| |
|
const Texture * | _fallbackTex = nullptr |
| | Display texture for non-2D inputs.
|
| |
|
std::vector< BoolOption > | _flags |
| | Predefined boolean parameters.
|
| |
|
std::vector< IntOption > | _integers |
| | Predefined integer parameters.
|
| |
|
std::vector< FloatOption > | _floats |
| | Predefined float parameters.
|
| |
|
std::vector< VecOption > | _vectors |
| | Predefined vector parameters.
|
| |
|
std::vector< ColorOption > | _colors |
| | Predefined color parameters.
|
| |
|
uint | _frame = 0 |
| | Current frame ID.
|
| |
|
double | _currentTime = 0.0 |
| | Current time.
|
| |
|
double | _startTime = 0.0 |
| | Time at which the shader began to play.
|
| |
|
bool | _paused = false |
| | Should time/frame count flow.
|
| |
|
bool | _showGUI = true |
| | Show the GUI parameters panel.
|
| |
|
bool | _windowed = false |
| | Should the result be displayed in a subwindow.
|
| |
|
LayoutMode | _layout = LayoutMode::HORIZONTAL |
| | The GUI panel layout.
|
| |
|
std::string | _compilationLog |
| | Compilation log, will be displayed in a fixed panel if not empty.
|
| |
Shader editor that can be used to tweak shaders on the fly, reloading them and exposing parameters for adjustements.
Inherits CameraApp.
◆ LayoutMode
GUI layout options.
| Enumerator |
|---|
| HORIZONTAL | Panel to the left, result to the right.
|
| VERTICAL | Panel at the bottom, result at the top.
|
| FREEFORM | Panels can be freely moved around.
|
◆ ShaderEditor()
Constructor.
- Parameters
-
| config | the configuration to apply |
| window | the window to render to |
◆ ~ShaderEditor()
| ShaderEditor::~ShaderEditor |
( |
| ) |
|
|
override |
◆ displayUniforms()
| void ShaderEditor::displayUniforms |
( |
uint |
columnsCount | ) |
|
|
private |
Display the uniform GUI elements.
- Parameters
-
| columnsCount | maximum number of columns to use for small elements (booleans,...) |
◆ draw()
| void ShaderEditor::draw |
( |
| ) |
|
|
overridevirtual |
◆ generateParametersString()
| std::string ShaderEditor::generateParametersString |
( |
const std::string & |
prefix, |
|
|
bool |
exportValues |
|
) |
| |
|
private |
Helper generation of a string listing all predefined tweakable uniforms.
- Parameters
-
| prefix | prefix to append before each element type ("uniform" or "const" for instance) |
| exportValues | should the current values be writtent ("float f0 = 3.0;" for instance) |
- Returns
- the generated string
◆ handleShortcuts()
| void ShaderEditor::handleShortcuts |
( |
| ) |
|
|
private |
React to user key inputs.
◆ loadShader()
| void ShaderEditor::loadShader |
( |
const std::string & |
path | ) |
|
Load an external shader from disk.
- Parameters
-
| path | the path to the file on disk |
◆ reload()
| std::string ShaderEditor::reload |
( |
const std::string & |
shaderPath, |
|
|
bool |
syncUniforms |
|
) |
| |
|
private |
Reload the shader and get the potential error message.
- Parameters
-
| shaderPath | path to the shader to reload on disk |
| syncUniforms | should the predefined uniforms be extracted from the shader and their values transferred to the GUI |
- Returns
- the compilation error log or an empty string
◆ resize()
| void ShaderEditor::resize |
( |
| ) |
|
|
overridevirtual |
Handle a window resize event, the configuration has been updated with the new size.
Implements Application.
◆ restoreUniforms()
| void ShaderEditor::restoreUniforms |
( |
| ) |
|
|
private |
Restore the values of all predefined uniforms that are present in the shader with default values.
◆ update()
| void ShaderEditor::update |
( |
| ) |
|
|
overridevirtual |
Per-frame update.
Reimplemented from CameraApp.
The documentation for this class was generated from the following files: