Class ShaderModification
java.lang.Object
com.hbm_m.client.render.shader.modification.ShaderModification
Lightweight GLSL source modifier inspired by Veil's ShaderModification system,
but reimplemented from scratch (no glslprocessor dependency).
Supports:
- Injection of
#define KEY [VALUE]directives right after the#versionline. - Insertion of arbitrary GLSL text before/after a regex marker.
- Replacement of a regex match.
This class is intentionally small and synchronous; it is meant to be used at shader
registration / load time, not during rendering. It also serves as a foundation for
future Iris TransformPatcher integration (Variant B).
-
Method Summary
Modifier and TypeMethodDescriptionApplies all steps tosourceand returns the modified text.static ShaderModificationbuilder()Convenience: emit#define KEY.Adds a#define KEY VALUEdirective to be injected after the#versionline.insertAfter(String markerRegex, String inject) Inserts arbitrary text after the first match ofmarkerRegex.insertBefore(String markerRegex, String inject) Inserts arbitrary text before the first match ofmarkerRegex.Replaces every match ofregexwithreplacement.
-
Method Details
-
builder
-
define
Adds a#define KEY VALUEdirective to be injected after the#versionline. Ifvalueisnullor empty, only#define KEYis emitted. -
define
Convenience: emit#define KEY. -
insertAfter
Inserts arbitrary text after the first match ofmarkerRegex. If the marker is not found the source is returned unchanged (a debug log is emitted). -
insertBefore
Inserts arbitrary text before the first match ofmarkerRegex. -
replace
Replaces every match ofregexwithreplacement. -
apply
Applies all steps tosourceand returns the modified text.
-