shadow cog

This commit is contained in:
zelophed 2021-04-07 15:18:37 +02:00
parent 7ad0575618
commit b1773e9e6b
2 changed files with 24 additions and 5 deletions

View file

@ -44,7 +44,7 @@ public class ConfigScreen extends NavigatableSimiScreen {
@Override
public void renderBackground(@Nonnull MatrixStack ms) {
fill(ms, 0, 0, this.width, this.height, 0xe8_101010);
//fill(ms, 0, 0, this.width, this.height, 0xe8_101010);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, ms));
}
@ -57,7 +57,22 @@ public class ConfigScreen extends NavigatableSimiScreen {
fill(ms, 0, 0, this.width, this.height, 0xff_282c34);
}
/*ms.push();
ms.translate(width*0.5f, height*0.5f, 0);
renderCog(ms, partialTicks);
ms.pop();*/
new StencilElement() {
@Override
protected void renderStencil(MatrixStack ms) {
renderCog(ms, partialTicks);
}
@Override
protected void renderElement(MatrixStack ms) {
fill(ms, -200, -200, 200, 200, 0x40_000000);
}
}.at(width * 0.5f, height * 0.5f, 0).render(ms);
super.renderWindowBackground(ms, mouseX, mouseY, partialTicks);
@ -66,7 +81,7 @@ public class ConfigScreen extends NavigatableSimiScreen {
protected void renderCog(MatrixStack ms, float partialTicks) {
ms.push();
ms.translate(.5 * width - 100, .5 * height + 110, -200);
ms.translate(-100, 100, -200);
ms.scale(200, 200, .1f);
GuiGameElement.of(cogwheelState)
.rotateBlock(22.5, cogSpin.getValue(partialTicks), 22.5)

View file

@ -1,5 +1,7 @@
package com.simibubi.create.foundation.gui;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
@ -36,11 +38,13 @@ public abstract class StencilElement {
}
protected void prepareStencil(MatrixStack ms) {
GL11.glDisable(GL11.GL_STENCIL_TEST);
RenderSystem.stencilMask(~0);
RenderSystem.clear(GL11.GL_STENCIL_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
GL11.glEnable(GL11.GL_STENCIL_TEST);
RenderSystem.clearStencil(0);
RenderSystem.stencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE);
RenderSystem.stencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP);
RenderSystem.stencilMask(0xFF);
RenderSystem.stencilFunc(GL11.GL_ALWAYS, 1, 0xFF);
RenderSystem.stencilFunc(GL11.GL_NEVER, 1, 0xFF);
}
protected void prepareElement(MatrixStack ms) {