Respackopts/docs/Canvas.md

1.4 KiB

Canvas/FREX integration

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:

#include respackopts:config_supplier

#ifdef 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. This will create a frex.frag file in your .minecraft/respackotps directory containing the generated shader code (available since 2.7.0).