Record Class ScreenEffectDefinition
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.effect.ScreenEffectDefinition
public record ScreenEffectDefinition(Map<net.minecraft.resources.Identifier, net.minecraft.client.renderer.PostChainConfig.InternalTarget> targets, List<ScreenEffectDefinition.Pass> passes)
extends Record
The passes and targets of a screen effect: the vanilla
post_effect format, so vanilla's own effects load as
is. Loaded from assets/<namespace>/post_effect/<path>.json, or built with builder().
Vanilla parses every post_effect file too, so keep them valid for it (a "vertex_shader" on every
pass; minecraft:core/screenquad is the usual one). Differences from vanilla:
- Every uniform needs a
"name"(vanilla's files all have one), by which the effect sets it. - Every pass also gets an
EffectInfouniform block (seecoolcatlib:screen_effect.glsl), and vanilla'sGlobalsblock. - The only external target is
minecraft:main; its depth can be read with"use_depth_buffer": true.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final recordOne draw of a fragment shader over its output target.static final classstatic final recordA named uniform and its default value:{"name": "Amount", "type": "float", "value": 0.5}. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.IdentifierCopies itsInsampler, no uniforms.static final com.mojang.serialization.Codec<ScreenEffectDefinition> static final net.minecraft.resources.IdentifierUniform block names taken by the runtime.static final net.minecraft.resources.Identifier -
Constructor Summary
ConstructorsConstructorDescriptionScreenEffectDefinition(Map<net.minecraft.resources.Identifier, net.minecraft.client.renderer.PostChainConfig.InternalTarget> targets, List<ScreenEffectDefinition.Pass> passes) Creates an instance of aScreenEffectDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.passes()Returns the value of thepassesrecord component.static ScreenEffectDefinitionsimple(net.minecraft.resources.Identifier fragmentShader, String uniformBlock, ScreenEffectDefinition.UniformSpec... uniforms) One fragment shader over the screen: readsminecraft:mainasIn, writes a swap target, then copies it back.Map<net.minecraft.resources.Identifier, net.minecraft.client.renderer.PostChainConfig.InternalTarget> targets()Returns the value of thetargetsrecord component.final StringtoString()Returns a string representation of this record class.Every uniform name any pass declares.
-
Field Details
-
MAIN_TARGET
public static final net.minecraft.resources.Identifier MAIN_TARGET -
SCREENQUAD_VERTEX_SHADER
public static final net.minecraft.resources.Identifier SCREENQUAD_VERTEX_SHADER -
BLIT_FRAGMENT_SHADER
public static final net.minecraft.resources.Identifier BLIT_FRAGMENT_SHADERCopies itsInsampler, no uniforms. -
RESERVED_UNIFORM_BLOCKS
-
CODEC
-
-
Constructor Details
-
ScreenEffectDefinition
public ScreenEffectDefinition(Map<net.minecraft.resources.Identifier, net.minecraft.client.renderer.PostChainConfig.InternalTarget> targets, List<ScreenEffectDefinition.Pass> passes) Creates an instance of aScreenEffectDefinitionrecord class.- Parameters:
targets- the value for thetargetsrecord componentpasses- the value for thepassesrecord component
-
-
Method Details
-
builder
-
simple
public static ScreenEffectDefinition simple(net.minecraft.resources.Identifier fragmentShader, String uniformBlock, ScreenEffectDefinition.UniformSpec... uniforms) One fragment shader over the screen: readsminecraft:mainasIn, writes a swap target, then copies it back. The simplest effect there is.- Parameters:
uniformBlock- the shader's uniform block name, ignored ifuniformsis emptyuniforms- the block's uniforms, in declaration order
-
uniformNames
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
targets
public Map<net.minecraft.resources.Identifier, net.minecraft.client.renderer.PostChainConfig.InternalTarget> targets()Returns the value of thetargetsrecord component.- Returns:
- the value of the
targetsrecord component
-
passes
Returns the value of thepassesrecord component.- Returns:
- the value of the
passesrecord component
-