diff --git a/build.gradle b/build.gradle index 272b342..b4e5620 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.8-SNAPSHOT' } version = project.mod_version @@ -44,10 +44,10 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation("foundry.veil:Veil-fabric-${project.minecraft_version}:${project.veil_version}") { + modImplementation("foundry.veil:veil-fabric-${project.minecraft_version}:${project.veil_version}") { exclude group: "maven.modrinth" } - modRuntimeOnly "maven.modrinth:modmenu:7.2.2" + modRuntimeOnly "maven.modrinth:modmenu:11.0.3" // modRuntimeOnly "maven.modrinth:sodium:mc1.20.1-0.5.3" } diff --git a/gradle.properties b/gradle.properties index d08f2b9..db6fad3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,8 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.10 -loader_version=0.15.11 +minecraft_version=1.21 +loader_version=0.16.9 # Mod Properties mod_version=1.0.0 @@ -14,6 +13,6 @@ maven_group=foundry archives_base_name=veil-example-mod # Dependencies -fabric_version=0.92.0+1.20.1 -#veil_version=1.0.0 -veil_version=1.0.0.285 +fabric_version=0.102.0+1.21 +veil_version=1.0.0 +#veil_version=1.0.0.10 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..e2847c8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/foundry/veil/example/VeilExampleMod.java b/src/main/java/foundry/veil/example/VeilExampleMod.java index 42d1d68..4807f04 100644 --- a/src/main/java/foundry/veil/example/VeilExampleMod.java +++ b/src/main/java/foundry/veil/example/VeilExampleMod.java @@ -23,7 +23,7 @@ public class VeilExampleMod implements ModInitializer { private static final ResourceKey ITEM_GROUP = ResourceKey.create(Registries.CREATIVE_MODE_TAB, VeilExampleMod.path("items")); public static ResourceLocation path(String path) { - return new ResourceLocation(MODID, path); + return ResourceLocation.fromNamespaceAndPath(MODID, path); } @Override diff --git a/src/main/java/foundry/veil/example/VeilExampleModClient.java b/src/main/java/foundry/veil/example/VeilExampleModClient.java index b086f20..258d6f9 100644 --- a/src/main/java/foundry/veil/example/VeilExampleModClient.java +++ b/src/main/java/foundry/veil/example/VeilExampleModClient.java @@ -1,9 +1,11 @@ package foundry.veil.example; import com.mojang.blaze3d.platform.NativeImage; +import foundry.veil.Veil; import foundry.veil.api.client.render.VeilRenderBridge; import foundry.veil.api.client.render.framebuffer.AdvancedFbo; import foundry.veil.api.client.render.framebuffer.AdvancedFboAttachment; +import foundry.veil.api.client.render.rendertype.VeilRenderType; import foundry.veil.api.client.render.texture.DynamicCubemapTexture; import foundry.veil.api.event.VeilRenderLevelStageEvent; import foundry.veil.example.blockentity.MapBlockEntity; @@ -15,11 +17,14 @@ import foundry.veil.fabric.event.FabricVeilRenderLevelStageEvent; import foundry.veil.fabric.event.FabricVeilRendererEvent; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import org.lwjgl.glfw.GLFW; import java.util.Random; @@ -32,9 +37,9 @@ public void onInitializeClient() { BlockEntityRenderers.register(VeilExampleBlocks.MIRROR_BE, MirrorBlockEntityRenderer::new); FabricVeilRendererEvent.EVENT.register(renderer -> renderer.getEditorManager().add(new VeilExampleModEditor())); - FabricVeilRenderLevelStageEvent.EVENT.register((stage, levelRenderer, bufferSource, poseStack, projectionMatrix, renderTick, partialTicks, camera, frustum) -> { + FabricVeilRenderLevelStageEvent.EVENT.register((stage, levelRenderer, bufferSource, matrixStack, frustumMatrix, projectionMatrix, renderTick, deltaTracker, camera, frustum) -> { if (stage == VeilRenderLevelStageEvent.Stage.AFTER_LEVEL) { - MirrorBlockEntityRenderer.renderLevel(Minecraft.getInstance().level, projectionMatrix, partialTicks, VeilRenderBridge.create(frustum), camera); + MirrorBlockEntityRenderer.renderLevel(Minecraft.getInstance().level, projectionMatrix, deltaTracker, VeilRenderBridge.create(frustum), camera); } }); @@ -51,6 +56,12 @@ public void onInitializeClient() { fbo.setColorAttachmentTexture(0, cubemap.getId(), 1); AdvancedFbo.unbind(); }); + ClientTickEvents.START_CLIENT_TICK.register(client -> { + if (GLFW.glfwGetKey(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_KEY_U) == GLFW.GLFW_PRESS) { + RenderType test = VeilRenderType.get(VeilExampleMod.path("test"), "test.png"); + System.out.println(test); + } + }); } private static NativeImage genTest(int width, int height) { diff --git a/src/main/java/foundry/veil/example/client/render/MapBlockEntityRenderer.java b/src/main/java/foundry/veil/example/client/render/MapBlockEntityRenderer.java index cc1096c..3cc6d4c 100644 --- a/src/main/java/foundry/veil/example/client/render/MapBlockEntityRenderer.java +++ b/src/main/java/foundry/veil/example/client/render/MapBlockEntityRenderer.java @@ -12,6 +12,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import org.joml.Matrix4fStack; import org.lwjgl.opengl.GL11C; import org.lwjgl.opengl.GL32C; @@ -40,16 +41,16 @@ public void render(MapBlockEntity blockEntity, float partialTicks, PoseStack pos return; } - PoseStack modelViewStack = RenderSystem.getModelViewStack(); - modelViewStack.pushPose(); - modelViewStack.mulPoseMatrix(poseStack.last().pose()); + Matrix4fStack modelViewStack = RenderSystem.getModelViewStack(); + modelViewStack.pushMatrix(); + modelViewStack.mul(poseStack.last().pose()); // modelViewStack.scale(25, 20, 25); this.vbo.bind(); this.vbo.upload(render(20)); shader.applyRenderSystem(); - shader.setMatrix("ModelViewMat", modelViewStack.last().pose()); + shader.setMatrix("ModelViewMat", modelViewStack); shader.setup(); if (VeilExampleModEditor.tessellationWireframe()) { glPolygonMode(GL_FRONT_AND_BACK, GL11C.GL_LINE); @@ -66,34 +67,29 @@ public void render(MapBlockEntity blockEntity, float partialTicks, PoseStack pos VertexBuffer.unbind(); - modelViewStack.popPose(); + modelViewStack.popMatrix(); } - private static BufferBuilder.RenderedBuffer render(int resolution) { + private static MeshData render(int resolution) { Tesselator tesselator = RenderSystem.renderThreadTesselator(); - BufferBuilder builder = tesselator.getBuilder(); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + BufferBuilder builder = tesselator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); for (int z = 0; z <= resolution - 1; z++) { for (int x = 0; x <= resolution - 1; x++) { - builder.vertex(x / (float) resolution, 0, z / (float) resolution) - .uv(x / (float) resolution, z / (float) resolution) - .endVertex(); + builder.addVertex(x / (float) resolution, 0, z / (float) resolution) + .setUv(x / (float) resolution, z / (float) resolution); - builder.vertex((x + 1) / (float) resolution, 0, z / (float) resolution) - .uv((x + 1) / (float) resolution, z / (float) resolution) - .endVertex(); + builder.addVertex((x + 1) / (float) resolution, 0, z / (float) resolution) + .setUv((x + 1) / (float) resolution, z / (float) resolution); - builder.vertex(x / (float) resolution, 0, (z + 1) / (float) resolution) - .uv(x / (float) resolution, (z + 1) / (float) resolution) - .endVertex(); + builder.addVertex(x / (float) resolution, 0, (z + 1) / (float) resolution) + .setUv(x / (float) resolution, (z + 1) / (float) resolution); - builder.vertex((x + 1) / (float) resolution, 0, (z + 1) / (float) resolution) - .uv((x + 1) / (float) resolution, (z + 1) / (float) resolution) - .endVertex(); + builder.addVertex((x + 1) / (float) resolution, 0, (z + 1) / (float) resolution) + .setUv((x + 1) / (float) resolution, (z + 1) / (float) resolution); } } - return builder.end(); + return builder.buildOrThrow(); } } diff --git a/src/main/java/foundry/veil/example/client/render/MirrorBlockEntityRenderer.java b/src/main/java/foundry/veil/example/client/render/MirrorBlockEntityRenderer.java index b4bb261..5520ba9 100644 --- a/src/main/java/foundry/veil/example/client/render/MirrorBlockEntityRenderer.java +++ b/src/main/java/foundry/veil/example/client/render/MirrorBlockEntityRenderer.java @@ -25,6 +25,7 @@ import it.unimi.dsi.fastutil.objects.ObjectSet; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.minecraft.client.Camera; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.MultiBufferSource; @@ -93,17 +94,15 @@ public void render(MirrorBlockEntity blockEntity, float f, PoseStack poseStack, poseStack.translate(-0.5, -0.5, -0.5); Matrix4f pose = poseStack.last().pose(); - Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder builder = tesselator.getBuilder(); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); - builder.vertex(pose, 0, 0, 0.125F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(1.0F, 0.0F).uv2(i).endVertex(); - builder.vertex(pose, 1, 0, 0.125F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(0.0F, 0.0F).uv2(i).endVertex(); - builder.vertex(pose, 1, 1, 0.125F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(0.0F, 1.0F).uv2(i).endVertex(); - builder.vertex(pose, 0, 1, 0.125F).color(1.0F, 1.0F, 1.0F, 1.0F).uv(1.0F, 1.0F).uv2(i).endVertex(); + BufferBuilder builder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP); + builder.addVertex(pose, 0, 0, 0.125F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(1.0F, 0.0F).setLight(i); + builder.addVertex(pose, 1, 0, 0.125F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(0.0F, 0.0F).setLight(i); + builder.addVertex(pose, 1, 1, 0.125F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(0.0F, 1.0F).setLight(i); + builder.addVertex(pose, 0, 1, 0.125F).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(1.0F, 1.0F).setLight(i); RenderSystem.setShaderColor(0.9F, 0.9F, 0.9F, 1.0F); RenderSystem.setShaderTexture(0, texture.getId()); - VeilExampleRenderTypes.mirror().end(builder, RenderSystem.getVertexSorting()); + VeilExampleRenderTypes.mirror().draw(builder.buildOrThrow()); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); @@ -143,7 +142,7 @@ private static float dot(BlockPos pos, Vec3i normal, double x, double y, double return (float) ((pos.getX() + 0.5 - normal.getX() * 0.5 - x) * normal.getX() + (pos.getY() + 0.5 - normal.getY() * 0.5 - y) * normal.getY() + (pos.getZ() + 0.5 - normal.getZ() * 0.5 - z) * normal.getZ()); } - public static void renderLevel(ClientLevel level, Matrix4fc projection, float partialTicks, CullFrustum frustum, Camera camera) { + public static void renderLevel(ClientLevel level, Matrix4fc projection, DeltaTracker deltaTracker, CullFrustum frustum, Camera camera) { if (VeilLevelPerspectiveRenderer.isRenderingPerspective() || !projection.isFinite()) { return; } @@ -189,7 +188,7 @@ public static void renderLevel(ClientLevel level, Matrix4fc projection, float pa calculateObliqueMatrix(RENDER_PROJECTION, plane, RENDER_PROJECTION); - VeilLevelPerspectiveRenderer.render(fbo, RENDER_MODELVIEW, RENDER_PROJECTION, renderPos, VIEW.identity().lookAlong(dir, up), RENDER_DISTANCE, partialTicks); + VeilLevelPerspectiveRenderer.render(fbo, RENDER_MODELVIEW, RENDER_PROJECTION, renderPos, VIEW.identity().lookAlong(dir, up), RENDER_DISTANCE, deltaTracker); mirror.copy(fbo); mirror.setRendered(true); } diff --git a/src/main/java/foundry/veil/example/mixin/client/EntityRendererMixin.java b/src/main/java/foundry/veil/example/mixin/client/EntityRendererMixin.java new file mode 100644 index 0000000..92f9e17 --- /dev/null +++ b/src/main/java/foundry/veil/example/mixin/client/EntityRendererMixin.java @@ -0,0 +1,62 @@ +package foundry.veil.example.mixin.client; + +import com.mojang.blaze3d.vertex.PoseStack; +import foundry.veil.Veil; +import foundry.veil.api.client.render.VeilRenderSystem; +import foundry.veil.api.quasar.particle.ParticleEmitter; +import foundry.veil.api.quasar.particle.ParticleSystemManager; +import foundry.veil.ext.EntityExtension; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.world.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(EntityRenderer.class) +public abstract class EntityRendererMixin { + + @Inject(method = "render", at = @At("HEAD")) + public void render(T entity, float pEntityYaw, float pPartialTick, PoseStack pPoseStack, MultiBufferSource pBuffer, int pPackedLight, CallbackInfo ci) { + EntityExtension extension = (EntityExtension) entity; + if (entity.isOnFire()) { + if (extension.veil$getEmitters().isEmpty()) { + ParticleSystemManager particleManager = VeilRenderSystem.renderer().getParticleManager(); + ParticleEmitter instance = particleManager.createEmitter(Veil.veilPath("basic_smoke")); + if (instance == null) { + return; + } + + instance.setAttachedEntity(entity); +// instance.getEmitterSettingsModule().emissionShapeSettings().setDimensions( +// new Vector3f( +// pEntity.getBbWidth(), +// pEntity.getBbHeight(), +// pEntity.getBbWidth() +// ) +// ); +// instance.setLoop(true); +// instance.setMaxLifetime(5); +// instance.getParticleData().getForces().forEach(force -> { +// if (force instanceof PointForce pf) { +// pf.setPoint(pEntity::position); +// } +// }); + // FIXME + extension.veil$addEmitter(instance); + particleManager.addParticleSystem(instance); + } else { +// ((EntityExtension) pEntity).getEmitters().stream().filter(emitter -> emitter.registryName.toString().equals("veil:basic_smoke")).forEach(emitter -> emitter.getEmitterModule().setMaxLifetime(5)); + } + } else { +// ((EntityExtension) pEntity).getEmitters().stream().filter(emitter -> emitter.registryName.toString().equals("veil:basic_smoke")).forEach(p -> p.getEmitterModule().setLoop(false)); + extension.veil$getEmitters().forEach(emitter -> { + if ("veil:basic_smoke".equals(String.valueOf(emitter.getRegistryName()))) { + emitter.remove(); + } + }); + extension.veil$getEmitters().removeIf(emitter -> "veil:basic_smoke".equals(String.valueOf(emitter.getRegistryName()))); + } + } +} diff --git a/src/main/java/foundry/veil/example/registry/VeilExampleBlocks.java b/src/main/java/foundry/veil/example/registry/VeilExampleBlocks.java index 0a88c28..44e7f53 100644 --- a/src/main/java/foundry/veil/example/registry/VeilExampleBlocks.java +++ b/src/main/java/foundry/veil/example/registry/VeilExampleBlocks.java @@ -16,12 +16,12 @@ public class VeilExampleBlocks { - public static final Block MAP = register("map", new MapBlock(BlockBehaviour.Properties.copy(Blocks.BEDROCK) + public static final Block MAP = register("map", new MapBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.BEDROCK) .noOcclusion() .isRedstoneConductor(Blocks::never) .isSuffocating(Blocks::never)), new Item.Properties()); - public static final Block MIRROR = register("mirror", new MirrorBlock(BlockBehaviour.Properties.copy(Blocks.BEDROCK) + public static final Block MIRROR = register("mirror", new MirrorBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.BEDROCK) .noOcclusion() .isRedstoneConductor(Blocks::never) .isSuffocating(Blocks::never)), diff --git a/src/main/java/foundry/veil/example/registry/VeilExampleRenderTypes.java b/src/main/java/foundry/veil/example/registry/VeilExampleRenderTypes.java index efac744..09fab1d 100644 --- a/src/main/java/foundry/veil/example/registry/VeilExampleRenderTypes.java +++ b/src/main/java/foundry/veil/example/registry/VeilExampleRenderTypes.java @@ -4,8 +4,8 @@ import com.mojang.blaze3d.vertex.VertexFormat; import foundry.veil.api.client.registry.RenderTypeStageRegistry; import foundry.veil.api.client.render.VeilRenderBridge; +import foundry.veil.api.client.render.rendertype.VeilRenderType; import foundry.veil.example.VeilExampleMod; -import foundry.veil.example.client.render.MirrorBlockEntityRenderer; import net.minecraft.Util; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; @@ -15,37 +15,12 @@ public final class VeilExampleRenderTypes extends RenderType { - private static final ShaderStateShard MAP_SHADER = VeilRenderBridge.shaderState(VeilExampleMod.path("map")); - private static final ShaderStateShard MAP_TEXTURE_SHADER = VeilRenderBridge.shaderState(VeilExampleMod.path("map_texture")); - private static final ShaderStateShard MIRROR_SHADER = VeilRenderBridge.shaderState(VeilExampleMod.path("mirror")); private static final ShaderStateShard RENDERTYPE_ENTITY_CUTOUT_NO_CULL_SHADER = VeilRenderBridge.shaderState(VeilExampleMod.path("entity/rendertype_entity_cutout_no_cull")); - private static final RenderType HEIGHTMAP_TEXTURE = create( - VeilExampleMod.MODID + ":heightmap_texture", - DefaultVertexFormat.POSITION_TEX, - VertexFormat.Mode.QUADS, - TRANSIENT_BUFFER_SIZE, - true, - false, - RenderType.CompositeState.builder() - .setLightmapState(LIGHTMAP) - .setShaderState(MAP_TEXTURE_SHADER) - .setTextureState(new TextureStateShard(VeilExampleMod.path("textures/misc/heightmap.png"), true, false)) - .createCompositeState(true) - ); - private static final RenderType HEIGHTMAP_TESSELLATION = create( - VeilExampleMod.MODID + ":heightmap_tessellation", - DefaultVertexFormat.POSITION_TEX, - VertexFormat.Mode.QUADS, - TRANSIENT_BUFFER_SIZE, - true, - false, - RenderType.CompositeState.builder() - .setLightmapState(LIGHTMAP) - .setShaderState(MAP_SHADER) - .setTextureState(new TextureStateShard(VeilExampleMod.path("textures/misc/heightmap.png"), true, false)) - .createCompositeState(true) - ); + private static final ResourceLocation HEIGHTMAP_TEXTURE = VeilExampleMod.path("heightmap_texture"); + private static final ResourceLocation HEIGHTMAP_TESSELLATION = VeilExampleMod.path("heightmap_tessellation"); + private static final ResourceLocation MIRROR = VeilExampleMod.path("mirror"); + private static final BiFunction ENTITY_CUTOUT_NO_CULL = Util.memoize(((texture, outline) -> { RenderType.CompositeState compositeState = RenderType.CompositeState.builder() .setShaderState(RENDERTYPE_ENTITY_CUTOUT_NO_CULL_SHADER) @@ -55,26 +30,16 @@ public final class VeilExampleRenderTypes extends RenderType { .setLightmapState(LIGHTMAP) .setOverlayState(OVERLAY) .createCompositeState(outline); - RenderType rendertype = create("entity_tessellation_cutout_no_cull", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, false, compositeState); + RenderType rendertype = create("entity_tessellation_cutout_no_cull", + DefaultVertexFormat.NEW_ENTITY, + VertexFormat.Mode.QUADS, + TRANSIENT_BUFFER_SIZE, + true, + false, + compositeState); RenderTypeStageRegistry.addStage(rendertype, VeilRenderBridge.patchState(4)); return rendertype; })); - private static final RenderType MIRROR = create( - "mirror", - DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP, - VertexFormat.Mode.QUADS, - TRANSIENT_BUFFER_SIZE, - true, - false, - RenderType.CompositeState.builder() - .setLightmapState(LIGHTMAP) - .setShaderState(MIRROR_SHADER) - .setLayeringState(POLYGON_OFFSET_LAYERING) - .createCompositeState(true)); - - static { - RenderTypeStageRegistry.addStage(HEIGHTMAP_TESSELLATION, VeilRenderBridge.patchState(4)); - } private VeilExampleRenderTypes(String string, VertexFormat vertexFormat, VertexFormat.Mode mode, int i, boolean bl, boolean bl2, Runnable runnable, Runnable runnable2) { super(string, vertexFormat, mode, i, bl, bl2, runnable, runnable2); @@ -85,10 +50,10 @@ public static RenderType cursedTessellationRenderTypeEntityCutoutNoCullWhyIsThis } public static RenderType mirror() { - return MIRROR; + return VeilRenderType.get(MIRROR); } public static RenderType heightmap(boolean tessellation) { - return tessellation ? HEIGHTMAP_TESSELLATION : HEIGHTMAP_TEXTURE; + return VeilRenderType.get(tessellation ? HEIGHTMAP_TESSELLATION : HEIGHTMAP_TEXTURE); } } diff --git a/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/heightmap_tessellation.json b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/heightmap_tessellation.json new file mode 100644 index 0000000..b869208 --- /dev/null +++ b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/heightmap_tessellation.json @@ -0,0 +1,27 @@ +{ + "format": "POSITION_TEX", + "mode": "QUADS", + "bufferSize": "TRANSIENT", + "sort": false, + "affectsCrumbling": true, + "outline": false, + "layers": [ + { + "type": "minecraft:texture", + "texture": "veil-example-mod:textures/misc/heightmap.png", + "blur": true, + "mipmap": false + }, + { + "type": "veil:shader", + "name": "veil-example-mod:map" + }, + { + "type": "minecraft:lightmap" + }, + { + "type": "veil:patches", + "patchVertices": 4 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/heightmap_texture.json b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/heightmap_texture.json new file mode 100644 index 0000000..3175dc2 --- /dev/null +++ b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/heightmap_texture.json @@ -0,0 +1,23 @@ +{ + "format": "POSITION_TEX", + "mode": "QUADS", + "bufferSize": "TRANSIENT", + "sort": false, + "affectsCrumbling": true, + "outline": false, + "layers": [ + { + "type": "minecraft:texture", + "texture": "veil-example-mod:textures/misc/heightmap.png", + "blur": true, + "mipmap": false + }, + { + "type": "veil:shader", + "name": "veil-example-mod:map_texture" + }, + { + "type": "minecraft:lightmap" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/mirror.json b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/mirror.json new file mode 100644 index 0000000..ae4c160 --- /dev/null +++ b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/mirror.json @@ -0,0 +1,21 @@ +{ + "format": "POSITION_COLOR_TEX_LIGHTMAP", + "mode": "QUADS", + "bufferSize": "TRANSIENT", + "sort": false, + "affectsCrumbling": true, + "outline": true, + "layers": [ + { + "type": "veil:shader", + "name": "veil-example-mod:mirror" + }, + { + "type": "minecraft:lightmap" + }, + { + "type": "minecraft:layering", + "mode": "polygon_offset" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/test.json b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/test.json new file mode 100644 index 0000000..6cb1b18 --- /dev/null +++ b/src/main/resources/assets/veil-example-mod/pinwheel/rendertypes/test.json @@ -0,0 +1,70 @@ +{ + "format": "POSITION", + "mode": "QUADS", + "bufferSize": "TRANSIENT", + "sort": false, + "affectsCrumbling": true, + "outline": false, + "layers": [ + { + "type": "minecraft:texture", + "texture": "%1$s", + "blur": false, + "mipmap": false + }, + { + "type": "minecraft:shader", + "name": "rendertype_lightning" + }, + { + "type": "veil:shader", + "name": "veil:blit_screen" + }, + { + "type": "minecraft:transparency", + "mode": "translucent" + }, + { + "type": "minecraft:depth_test", + "mode": "gequal" + }, + { + "type": "minecraft:cull" + }, + { + "type": "minecraft:lightmap" + }, + { + "type": "minecraft:overlay" + }, + { + "type": "minecraft:layering", + "mode": "polygon_offset" + }, + { + "type": "minecraft:output", + "framebuffer": "minecraft:clouds" + }, + { + "type": "minecraft:texturing", + "scale": 4.0 + }, + { + "type": "minecraft:write_mask", + "color": true, + "depth": false + }, + { + "type": "minecraft:line", + "width": 42 + }, + { + "type": "minecraft:color_logic", + "operation": "xor" + }, + { + "type": "veil:patches", + "patchVertices": 8 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/veil-example-mod/pinwheel/shaders/program/map.tesh b/src/main/resources/assets/veil-example-mod/pinwheel/shaders/program/map.tesh index 035466d..4b1bbb0 100644 --- a/src/main/resources/assets/veil-example-mod/pinwheel/shaders/program/map.tesh +++ b/src/main/resources/assets/veil-example-mod/pinwheel/shaders/program/map.tesh @@ -1,8 +1,7 @@ -#include veil:camera - layout (quads, fractional_odd_spacing, cw) in; uniform mat4 ModelViewMat; +uniform mat4 RenderProjMat; uniform sampler2D Sampler0; @@ -54,5 +53,5 @@ void main() // ---------------------------------------------------------------------- // output patch point position in clip space - gl_Position = VeilCamera.ProjMat * ModelViewMat * p; + gl_Position = RenderProjMat * ModelViewMat * p; } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index e5fcec8..2466a6a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -24,9 +24,9 @@ ], "depends": { "fabricloader": ">=0.15.9", - "minecraft": "~1.20.1", + "minecraft": "~1.21", "veil": ">=1.0.0", - "java": ">=17", + "java": ">=21", "fabric-api": "*" } } \ No newline at end of file diff --git a/src/main/resources/veil-example-mod.mixins.json b/src/main/resources/veil-example-mod.mixins.json index 78fb67c..f358a28 100644 --- a/src/main/resources/veil-example-mod.mixins.json +++ b/src/main/resources/veil-example-mod.mixins.json @@ -1,10 +1,11 @@ { "required": true, "package": "foundry.veil.example.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ ], "client": [ + "client.EntityRendererMixin", "client.RenderTypeMixin" ], "injectors": {