26 lines
1.5 KiB
Markdown
26 lines
1.5 KiB
Markdown
# Usage in canvas/frex shaders
|
|
## Background
|
|
The FREX shader API (which shaders targeting the Canvas renderer utilize) allows other mods to register config code which shaders may `#include`.
|
|
Respackopts is one of such mods and utilizes this feature to expose the packs respackopts config.
|
|
|
|
## Getting started
|
|
All you need to do to access respackotps values is paste the following in a file where you want them: `#include respackopts:config_supplier`
|
|
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:
|
|
```glsl
|
|
#include respackopts:config_supplier
|
|
|
|
#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 frex` 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).
|