Respackopts/docs/Shaders.md

28 lines
1.5 KiB
Markdown
Raw Normal View History

2021-10-03 19:26:26 +02:00
# Usage in fabulous/canvas/frex shaders
## Getting started
All you need to do to access respackotps values is paste the following in a file where you want them according to your renderer:
2021-11-10 17:23:15 +01:00
| Renderer | Include snippet |
| --- | --- |
| Canvas | `#include respackopts:config_supplier` |
| Vanilla/Fabulous | `//include respackopts:config_supplier` (this is done to avoid problems when loading shaders without respackopts) |
However, usually you will want to still have a pack that works if respackotps is not present. In that case, canvas will still load the file,
however, values that respackotps registers will not be available leading to compile errors.
To avoid this, I recommend creating a source file in your own shader which will load default values if respackotps isn't present. You can do that as follows:
2021-09-15 15:17:32 +02:00
```glsl
#include respackopts:config_supplier
2021-09-15 21:43:48 +02:00
#ifndef respackopts_loaded
// define your default values here
// Example:
// #define examplePack_someTexture
#endif
```
You will then need to include this file in the places you want to access its values.
## Using the values
All values respackotps exposes follow the form: `<id>_<entry>` or `<id>_<category>_<entry>`
To view the code respackotps generates for your pack, you can run the `/rpo dump glsl` command in minecraft (You must enable the `debugCommands` config option for this).
This will create a frex.frag file in your .minecraft/respackotps directory containing the generated shader code (available since 2.7.0).