-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving from core shaders to Satin Managed Core Shaders (#25)
- Loading branch information
1 parent
2f4d6e8
commit 0c55e88
Showing
14 changed files
with
40 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 27 additions & 11 deletions
38
src/main/java/dev/kir/sync/client/render/CustomGameRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,51 @@ | ||
package dev.kir.sync.client.render; | ||
|
||
import dev.kir.sync.Sync; | ||
import ladysnake.satin.api.managed.ManagedCoreShader; | ||
import ladysnake.satin.api.managed.ShaderEffectManager; | ||
import ladysnake.satin.api.managed.uniform.Uniform1f; | ||
import ladysnake.satin.api.managed.uniform.UniformMat4; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.render.BufferBuilderStorage; | ||
import net.minecraft.client.render.GameRenderer; | ||
import net.minecraft.client.render.Shader; | ||
import net.minecraft.client.render.VertexFormats; | ||
import net.minecraft.resource.ResourceManager; | ||
import net.minecraft.util.math.Matrix4f; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public final class CustomGameRenderer extends GameRenderer { | ||
private static Shader renderTypeEntityTranslucentPartiallyTexturedShader = null; | ||
private static Shader renderTypeVoxelShader = null; | ||
private static final ManagedCoreShader RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER; | ||
private static final Uniform1f RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER_UNIFORM_CUTOUT_Y; | ||
private static final UniformMat4 RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER_UNIFORM_MODEL_MAT; | ||
|
||
private static final ManagedCoreShader RENDER_TYPE_VOXEL_SHADER; | ||
|
||
private CustomGameRenderer(MinecraftClient client, ResourceManager resourceManager, BufferBuilderStorage buffers) { | ||
super(client, resourceManager, buffers); | ||
} | ||
|
||
public static void setRenderTypeEntityTranslucentPartiallyTexturedShader(Shader shader) { | ||
renderTypeEntityTranslucentPartiallyTexturedShader = shader; | ||
public static void initRenderTypeEntityTranslucentPartiallyTexturedShader(float cutoutY, Matrix4f modelMatrix) { | ||
RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER_UNIFORM_CUTOUT_Y.set(cutoutY); | ||
RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER_UNIFORM_MODEL_MAT.set(modelMatrix); | ||
} | ||
|
||
public static Shader getRenderTypeEntityTranslucentPartiallyTexturedShader() { | ||
return renderTypeEntityTranslucentPartiallyTexturedShader; | ||
public static ManagedCoreShader getRenderTypeEntityTranslucentPartiallyTexturedShader() { | ||
return RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER; | ||
} | ||
|
||
public static void setRenderTypeVoxelShader(Shader shader) { | ||
renderTypeVoxelShader = shader; | ||
public static ManagedCoreShader getRenderTypeVoxelShader() { | ||
return RENDER_TYPE_VOXEL_SHADER; | ||
} | ||
|
||
public static Shader getRenderTypeVoxelShader() { | ||
return renderTypeVoxelShader; | ||
public static void initClient() { } | ||
|
||
static { | ||
RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER = ShaderEffectManager.getInstance().manageCoreShader(Sync.locate("rendertype_entity_translucent_partially_textured"), VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL); | ||
RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER_UNIFORM_CUTOUT_Y = RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER.findUniform1f("CutoutY"); | ||
RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER_UNIFORM_MODEL_MAT = RENDER_TYPE_ENTITY_TRANSLUCENT_PARTIALLY_TEXTURED_SHADER.findUniformMat4("ModelMat"); | ||
|
||
RENDER_TYPE_VOXEL_SHADER = ShaderEffectManager.getInstance().manageCoreShader(Sync.locate("rendertype_voxel"), CustomVertexFormats.POSITION_COLOR_OVERLAY_LIGHT_NORMAL); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters