Record Class VfxMaterial
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.client.vfx.VfxMaterial
- Record Components:
texture- a full texture path, such asmymod:textures/vfx/ember.png; drawn with linear filteringsoftness- over how many blocks the effect fades out as it nears whatever is behind it, so it never ends in a hard line where it passes through a wall or the ground; 0 for a hard edgeshader- the fragment shader the material is drawn with, such asmymod:vfx/portalforassets/mymod/shaders/vfx/portal.fsh; null for the built-in textured one. SeewithShader(Identifier)
public record VfxMaterial(net.minecraft.resources.Identifier texture, VfxBlend blend, float softness, @Nullable net.minecraft.resources.Identifier shader)
extends Record
What a world effect is drawn with: a texture, how it blends, and how softly it meets solid things. Everything drawn
with equal materials in a frame goes out in one draw call.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final net.minecraft.resources.IdentifierA round, soft glow: the bread and butter of light effects.static final net.minecraft.resources.IdentifierThe procedural rift shader CoolCatLib ships (WorldRiftsdraws with it).static final net.minecraft.resources.IdentifierA thin ring, for shockwaves and pulses.static final net.minecraft.resources.IdentifierA cloudy puff, for smoke and mist.static final net.minecraft.resources.IdentifierA small bright core with a wide faint halo.static final net.minecraft.resources.IdentifierA four-pointed star with thin rays.static final net.minecraft.resources.IdentifierA streak that is bright along its middle and fades to both ends: for sparks, beams and trails. -
Constructor Summary
ConstructorsConstructorDescriptionVfxMaterial(net.minecraft.resources.Identifier texture, VfxBlend blend, float softness) VfxMaterial(net.minecraft.resources.Identifier texture, VfxBlend blend, float softness, @Nullable net.minecraft.resources.Identifier shader) Creates an instance of aVfxMaterialrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic VfxMaterialadditive(net.minecraft.resources.Identifier texture) An additive material with the default softness.static VfxMaterialalpha(net.minecraft.resources.Identifier texture) blend()Returns the value of theblendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static VfxMaterialluminous(net.minecraft.resources.Identifier texture) @Nullable net.minecraft.resources.Identifiershader()Returns the value of theshaderrecord component.floatsoftness()Returns the value of thesoftnessrecord component.net.minecraft.resources.Identifiertexture()Returns the value of thetexturerecord component.final StringtoString()Returns a string representation of this record class.withShader(net.minecraft.resources.Identifier fragmentShader) The same material drawn with a fragment shader of the mod's own, for what a texture cannot do: portals, rifts, heat haze, anything procedural.withSoftness(float softness)
-
Field Details
-
RIFT_SHADER
public static final net.minecraft.resources.Identifier RIFT_SHADERThe procedural rift shader CoolCatLib ships (WorldRiftsdraws with it). -
GLOW
public static final net.minecraft.resources.Identifier GLOWA round, soft glow: the bread and butter of light effects. -
SPARKLE
public static final net.minecraft.resources.Identifier SPARKLEA small bright core with a wide faint halo. -
STAR
public static final net.minecraft.resources.Identifier STARA four-pointed star with thin rays. -
RING
public static final net.minecraft.resources.Identifier RINGA thin ring, for shockwaves and pulses. -
SMOKE
public static final net.minecraft.resources.Identifier SMOKEA cloudy puff, for smoke and mist. -
STREAK
public static final net.minecraft.resources.Identifier STREAKA streak that is bright along its middle and fades to both ends: for sparks, beams and trails. -
DEFAULT_SOFTNESS
public static final float DEFAULT_SOFTNESS- See Also:
-
-
Constructor Details
-
VfxMaterial
-
VfxMaterial
public VfxMaterial(net.minecraft.resources.Identifier texture, VfxBlend blend, float softness, @Nullable net.minecraft.resources.Identifier shader) Creates an instance of aVfxMaterialrecord class.
-
-
Method Details
-
additive
An additive material with the default softness. -
alpha
-
luminous
-
withSoftness
-
withShader
The same material drawn with a fragment shader of the mod's own, for what a texture cannot do: portals, rifts, heat haze, anything procedural. The shader takes the place ofcoolcatcanvas:vfx/quad:
It should multiply its alpha by#version 330 #moj_import <coolcatcanvas:vfx.glsl> // VfxTime.x (seconds), vfx_depth_fade(...) uniform sampler2D Sampler0; // the material's texture uniform sampler2D DepthSampler; // the scene's depth in vec2 texCoord; // the quad's UVs, as given to VfxDraw in vec4 vertexColor; // the colour given to VfxDraw out vec4 fragColor;vfx_depth_fade(texelFetch(DepthSampler, ivec2(gl_FragCoord.xy), 0).r, gl_FragCoord.z)to hide behind solid things. A shader has no uniforms of its own; what changes from one shape to the next travels in the colour and in the UVs (VfxDraw.quad(net.minecraft.world.phys.Vec3, net.minecraft.world.phys.Vec3, net.minecraft.world.phys.Vec3, net.minecraft.world.phys.Vec3, float, float, float, float, int)takes any UV range). -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
texture
-
blend
Returns the value of theblendrecord component.- Returns:
- the value of the
blendrecord component
-
softness
-
shader
-