Disabled culling
On branch 1.16-fabric Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/client/DimensionalPortalRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java modified: src/main/java/org/dimdev/dimdoors/util/RGBA.java
This commit is contained in:
parent
46d5459b37
commit
81109f67b3
4 changed files with 336 additions and 279 deletions
|
@ -1,234 +1,199 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.flowpowered.math.vector.VectorNi;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import org.dimdev.dimdoors.mixin.DirectionAccessor;
|
||||
import org.dimdev.dimdoors.util.RGBA;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.enums.DoorHinge;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.render.block.BlockModels;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.client.util.GlAllocationUtils;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public final class DimensionalPortalRenderer {
|
||||
private static final FloatBuffer BUFFER = GlAllocationUtils.allocateFloatBuffer(16);
|
||||
private static final Identifier WARP_PATH = new Identifier("dimdoors:textures/other/warp.png");
|
||||
private static final BooleanProperty OPEN_PROPERTY = BooleanProperty.of("open");
|
||||
private static final EnumProperty<DoorHinge> HINGE_PROPERTY = EnumProperty.of("hinge", DoorHinge.class);
|
||||
private static final DirectionProperty FACING_PROPERTY = DirectionProperty.of("facing", Arrays.asList(DirectionAccessor.getHorizontal()));
|
||||
|
||||
private static final TextureManager TEXTURE_MANAGER = MinecraftClient.getInstance().getTextureManager();
|
||||
private static final BlockModels BLOCK_MODELS = MinecraftClient.getInstance().getBlockRenderManager().getModels();
|
||||
private static final BakedModelManager MODEL_MANAGER = BLOCK_MODELS.getModelManager();
|
||||
|
||||
private static final VectorNi COLORLESS = new VectorNi(255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255);
|
||||
|
||||
public static Identifier getWarpPath() {
|
||||
return WARP_PATH;
|
||||
}
|
||||
|
||||
// TODO: any render angle
|
||||
|
||||
/**
|
||||
* Renders a dimensional portal, for use in various situations. Code is mostly based
|
||||
* on vanilla's EndGatewayBlockEntityRenderer.
|
||||
*
|
||||
* @param x The x coordinate of the wall's center.
|
||||
* @param y The y coordinate of the wall's center.
|
||||
* @param z The z coordinate of the wall's center.
|
||||
* //@param yaw The yaw of the normal vector of the wall in degrees, relative to __.
|
||||
* //@param pitch The pitch of the normal vector of the wall, relative to the xz plane.
|
||||
* @param orientation The orientation of the wall.
|
||||
* @param width The width of the wall.
|
||||
* @param height The height of the wall.
|
||||
* @param colors An array containing the color to use on each pass. Its length determines the number of passes to do.
|
||||
*/
|
||||
@Deprecated
|
||||
public static void renderDimensionalPortal(double x, double y, double z, Direction orientation, double width, double height, RGBA[] colors, MatrixStack matrices, VertexConsumer consumer) { // TODO: Make this work at any angle
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.disableCull();
|
||||
|
||||
for (int pass = 0; pass < 4; pass++) {
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
float translationScale = 16 - pass;
|
||||
float scale = 0.2625F;
|
||||
float colorMultiplier = 1.0F / (translationScale + .80F);
|
||||
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(WARP_PATH);
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
if (pass == 0) {
|
||||
colorMultiplier = 0.1F;
|
||||
translationScale = 25.0F;
|
||||
scale = 0.125F;
|
||||
|
||||
RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if (pass == 1) {
|
||||
scale = 0.5F;
|
||||
RenderSystem.blendFunc(GL_ONE, GL_ONE);
|
||||
}
|
||||
|
||||
double offset = Util.getMeasuringTimeNano() % 200000L / 200000.0F;
|
||||
RenderSystem.translated(offset, offset, offset);
|
||||
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.S, GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.T, GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.R, GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.Q, GL_OBJECT_LINEAR);
|
||||
|
||||
if (orientation == Direction.UP || orientation == Direction.DOWN) {
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.Q, GL11.GL_EYE_LINEAR);
|
||||
} else {
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.Q, GL11.GL_OBJECT_LINEAR);
|
||||
}
|
||||
|
||||
switch (orientation) { // TODO: Why 0.15F? Is that a door's thickness? If yes, don't hardcode that.
|
||||
case SOUTH:
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, -0.15F));
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.15F));
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.15F));
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, -0.15F));
|
||||
break;
|
||||
case UP:
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_EYE_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
break;
|
||||
case DOWN:
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL11.GL_EYE_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
break;
|
||||
}
|
||||
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.S);
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.T);
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.R);
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.Q);
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
RenderSystem.matrixMode(GL_TEXTURE);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.loadIdentity();
|
||||
RenderSystem.translated(0.0F, offset * translationScale, 0.0F);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
RenderSystem.rotatef((pass * pass * 4321 + pass) * 9 * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.translated(0.5F, 0.5F, 0.5F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
worldRenderer.begin(GL_QUADS, VertexFormats.POSITION);
|
||||
|
||||
RGBA color = colors[pass];
|
||||
consumer.color(color.getRed() * colorMultiplier, color.getGreen() * colorMultiplier, color.getBlue() * colorMultiplier, color.getAlpha());
|
||||
|
||||
switch (orientation) {
|
||||
case NORTH:
|
||||
worldRenderer.vertex(x, y, z);
|
||||
worldRenderer.vertex(x, y + height, z);
|
||||
worldRenderer.vertex(x + width, y + height, z);
|
||||
worldRenderer.vertex(x + width, y, z);
|
||||
break;
|
||||
case SOUTH:
|
||||
worldRenderer.vertex(x, y, z);
|
||||
worldRenderer.vertex(x + width, y, z);
|
||||
worldRenderer.vertex(x + width, y + height, z);
|
||||
worldRenderer.vertex(x, y + height, z);
|
||||
break;
|
||||
case WEST:
|
||||
worldRenderer.vertex(x, y, z);
|
||||
worldRenderer.vertex(x, y, z + width);
|
||||
worldRenderer.vertex(x, y + height, z + width);
|
||||
worldRenderer.vertex(x, y + height, z);
|
||||
break;
|
||||
case EAST:
|
||||
worldRenderer.vertex(x, y, z);
|
||||
worldRenderer.vertex(x, y + height, z);
|
||||
worldRenderer.vertex(x, y + height, z + width);
|
||||
worldRenderer.vertex(x, y, z + width);
|
||||
break;
|
||||
case UP:
|
||||
worldRenderer.vertex(x, y, z);
|
||||
worldRenderer.vertex(x, y, z + width);
|
||||
worldRenderer.vertex(x + width, y, z + width);
|
||||
worldRenderer.vertex(x + width, y, z);
|
||||
break;
|
||||
case DOWN:
|
||||
worldRenderer.vertex(x, y, z);
|
||||
worldRenderer.vertex(x + width, y, z);
|
||||
worldRenderer.vertex(x + width, y, z + width);
|
||||
worldRenderer.vertex(x, y, z + width);
|
||||
break;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.matrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
GlStateManager.disableTexGen(GlStateManager.TexCoord.S);
|
||||
GlStateManager.disableTexGen(GlStateManager.TexCoord.T);
|
||||
GlStateManager.disableTexGen(GlStateManager.TexCoord.R);
|
||||
GlStateManager.disableTexGen(GlStateManager.TexCoord.Q);
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.enableLighting();
|
||||
}
|
||||
|
||||
static FloatBuffer getBuffer(float f1, float f2, float f3, float f4) {
|
||||
BUFFER.clear();
|
||||
BUFFER.put(f1).put(f2).put(f3).put(f4);
|
||||
BUFFER.flip();
|
||||
return BUFFER;
|
||||
}
|
||||
}
|
||||
//package org.dimdev.dimdoors.client;
|
||||
//
|
||||
//import java.nio.FloatBuffer;
|
||||
//
|
||||
//import com.mojang.blaze3d.platform.GlStateManager;
|
||||
//import com.mojang.blaze3d.systems.RenderSystem;
|
||||
//import org.dimdev.dimdoors.util.RGBA;
|
||||
//import org.lwjgl.opengl.GL11;
|
||||
//
|
||||
//import net.minecraft.client.MinecraftClient;
|
||||
//import net.minecraft.client.render.BufferBuilder;
|
||||
//import net.minecraft.client.render.Tessellator;
|
||||
//import net.minecraft.client.render.VertexConsumer;
|
||||
//import net.minecraft.client.render.VertexFormats;
|
||||
//import net.minecraft.util.Util;
|
||||
//import net.minecraft.util.math.Direction;
|
||||
//
|
||||
//import net.fabricmc.api.EnvType;
|
||||
//import net.fabricmc.api.Environment;
|
||||
//import static org.lwjgl.opengl.GL11.*;
|
||||
//
|
||||
//@Environment(EnvType.CLIENT)
|
||||
//public final class DimensionalPortalRenderer {
|
||||
//
|
||||
// /**
|
||||
// * Renders a dimensional portal, for use in various situations. Code is mostly based
|
||||
// * on vanilla's EndGatewayBlockEntityRenderer.
|
||||
// *
|
||||
// * @param x The x coordinate of the wall's center.
|
||||
// * @param y The y coordinate of the wall's center.
|
||||
// * @param z The z coordinate of the wall's center.
|
||||
// * //@param yaw The yaw of the normal vector of the wall in degrees, relative to __.
|
||||
// * //@param pitch The pitch of the normal vector of the wall, relative to the xz plane.
|
||||
// * @param orientation The orientation of the wall.
|
||||
// * @param width The width of the wall.
|
||||
// * @param height The height of the wall.
|
||||
// * @param colors An array containing the color to use on each pass. Its length determines the number of passes to do.
|
||||
// */
|
||||
// @Deprecated
|
||||
// public static void renderDimensionalPortal(VertexConsumer vc, double x, double y, double z, Direction orientation, double width, double height, RGBA[] colors) { // TODO: Make this work at any angle
|
||||
// for (int pass = 0; pass < 16; pass++) {
|
||||
// RenderSystem.pushMatrix();
|
||||
//
|
||||
// float translationScale = 16 - pass;
|
||||
// float scale = 0.2625F;
|
||||
// float colorMultiplier = 1.0F / (translationScale + .80F);
|
||||
//
|
||||
// MinecraftClient.getInstance().getTextureManager().bindTexture(MyRenderLayer.WARP_PATH);
|
||||
// RenderSystem.enableBlend();
|
||||
//
|
||||
// if (pass == 0) {
|
||||
// colorMultiplier = 0.1F;
|
||||
// translationScale = 25.0F;
|
||||
// scale = 0.125F;
|
||||
//
|
||||
// RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// }
|
||||
//
|
||||
// if (pass == 1) {
|
||||
// scale = 0.5F;
|
||||
// RenderSystem.blendFunc(GL_ONE, GL_ONE);
|
||||
// }
|
||||
//
|
||||
// double offset = Util.getMeasuringTimeNano() % 200000L / 200000.0F;
|
||||
// RenderSystem.translated(offset, offset, offset);
|
||||
//
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.S, GL_OBJECT_LINEAR);
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.T, GL_OBJECT_LINEAR);
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.R, GL_OBJECT_LINEAR);
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.Q, GL_OBJECT_LINEAR);
|
||||
//
|
||||
// if (orientation == Direction.UP || orientation == Direction.DOWN) {
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.Q, GL11.GL_EYE_LINEAR);
|
||||
// } else {
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.Q, GL11.GL_OBJECT_LINEAR);
|
||||
// }
|
||||
//
|
||||
// switch (orientation) { // TODO: Why 0.15F? Is that a door's thickness? If yes, don't hardcode that.
|
||||
// case SOUTH:
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, -0.15F));
|
||||
// break;
|
||||
// case WEST:
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.15F));
|
||||
// break;
|
||||
// case NORTH:
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.15F));
|
||||
// break;
|
||||
// case EAST:
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, -0.15F));
|
||||
// break;
|
||||
// case UP:
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL_EYE_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// break;
|
||||
// case DOWN:
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.Q, GL11.GL_EYE_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.S);
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.T);
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.R);
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.Q);
|
||||
//
|
||||
// RenderSystem.popMatrix();
|
||||
//
|
||||
// RenderSystem.matrixMode(GL_TEXTURE);
|
||||
// RenderSystem.pushMatrix();
|
||||
// RenderSystem.loadIdentity();
|
||||
// RenderSystem.translated(0.0F, offset * translationScale, 0.0F);
|
||||
// RenderSystem.scalef(scale, scale, scale);
|
||||
// RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
// RenderSystem.rotatef((pass * pass * 4321 + pass) * 9 * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
// RenderSystem.translated(0.5F, 0.5F, 0.5F);
|
||||
// RenderSystem.mulTextureByProjModelView();
|
||||
//
|
||||
// Tessellator tessellator = Tessellator.getInstance();
|
||||
// BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
// worldRenderer.begin(GL_QUADS, VertexFormats.POSITION);
|
||||
//
|
||||
// RGBA color = colors[pass];
|
||||
// RenderSystem.color4f(color.getRed() * colorMultiplier, color.getGreen() * colorMultiplier, color.getBlue() * colorMultiplier, color.getAlpha());
|
||||
//
|
||||
// switch (orientation) {
|
||||
// case NORTH:
|
||||
// worldRenderer.vertex(x, y, z);
|
||||
// worldRenderer.vertex(x, y + height, z);
|
||||
// worldRenderer.vertex(x + width, y + height, z);
|
||||
// worldRenderer.vertex(x + width, y, z);
|
||||
// break;
|
||||
// case SOUTH:
|
||||
// worldRenderer.vertex(x, y, z);
|
||||
// worldRenderer.vertex(x + width, y, z);
|
||||
// worldRenderer.vertex(x + width, y + height, z);
|
||||
// worldRenderer.vertex(x, y + height, z);
|
||||
// break;
|
||||
// case WEST:
|
||||
// worldRenderer.vertex(x, y, z);
|
||||
// worldRenderer.vertex(x, y, z + width);
|
||||
// worldRenderer.vertex(x, y + height, z + width);
|
||||
// worldRenderer.vertex(x, y + height, z);
|
||||
// break;
|
||||
// case EAST:
|
||||
// worldRenderer.vertex(x, y, z);
|
||||
// worldRenderer.vertex(x, y + height, z);
|
||||
// worldRenderer.vertex(x, y + height, z + width);
|
||||
// worldRenderer.vertex(x, y, z + width);
|
||||
// break;
|
||||
// case UP:
|
||||
// worldRenderer.vertex(x, y, z);
|
||||
// worldRenderer.vertex(x, y, z + width);
|
||||
// worldRenderer.vertex(x + width, y, z + width);
|
||||
// worldRenderer.vertex(x + width, y, z);
|
||||
// break;
|
||||
// case DOWN:
|
||||
// worldRenderer.vertex(x, y, z);
|
||||
// worldRenderer.vertex(x + width, y, z);
|
||||
// worldRenderer.vertex(x + width, y, z + width);
|
||||
// worldRenderer.vertex(x, y, z + width);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// tessellator.draw();
|
||||
//
|
||||
// RenderSystem.popMatrix();
|
||||
// RenderSystem.matrixMode(GL_MODELVIEW);
|
||||
// }
|
||||
//
|
||||
// RenderSystem.disableBlend();
|
||||
// GlStateManager.disableTexGen(GlStateManager.TexCoord.S);
|
||||
// GlStateManager.disableTexGen(GlStateManager.TexCoord.T);
|
||||
// GlStateManager.disableTexGen(GlStateManager.TexCoord.R);
|
||||
// GlStateManager.disableTexGen(GlStateManager.TexCoord.Q);
|
||||
// }
|
||||
//
|
||||
// static FloatBuffer getBuffer(float f1, float f2, float f3, float f4) {
|
||||
// MyRenderLayer.BUFFER.clear();
|
||||
// MyRenderLayer.BUFFER.put(f1).put(f2).put(f3).put(f4);
|
||||
// MyRenderLayer.BUFFER.flip();
|
||||
// return MyRenderLayer.BUFFER;
|
||||
// }
|
||||
//}
|
|
@ -6,6 +6,7 @@ import java.util.stream.IntStream;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
||||
import org.dimdev.dimdoors.util.RGBA;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
@ -27,9 +28,6 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
|
|||
private static final Identifier KEY_PATH = new Identifier("dimdoors:textures/other/keyhole.png");
|
||||
private static final Identifier KEYHOLE_LIGHT = new Identifier("dimdoors:textures/other/keyhole_light.png");
|
||||
private static final Random RANDOM = new Random(31100L);
|
||||
// private static final List<RenderLayer> LAYERS = IntStream.range(0, 16).mapToObj((i) -> {
|
||||
// return MyRenderLayer.getDimensionalPortal(i + 1);
|
||||
// }).collect(ImmutableList.toImmutableList());
|
||||
|
||||
public EntranceRiftBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||
super(blockEntityRenderDispatcher);
|
||||
|
@ -71,7 +69,6 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
|
|||
float g = 0.75F;
|
||||
Matrix4f matrix4f = matrices.peek().getModel();
|
||||
this.drawAllVertices(entrance, g, 0.15F, matrix4f, vertexConsumers.getBuffer(layers.get(0)), orientation);
|
||||
matrices.scale(0.99F, 0.99F, 0.99F);
|
||||
|
||||
for(int l = 1; l < k; ++l) {
|
||||
this.drawAllVertices(entrance, g, 2.0F / (float)(18 - l), matrix4f, vertexConsumers.getBuffer(layers.get(l)), orientation);
|
||||
|
@ -99,9 +96,10 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
|
|||
}
|
||||
|
||||
private void drawAllVertices(EntranceRiftBlockEntity blockEntity, float u, float v, Matrix4f matrix4f, VertexConsumer vertexConsumer, Direction dir) {
|
||||
float red = (RANDOM.nextFloat() * 0.5F + 0.1F) * v;
|
||||
float green = (RANDOM.nextFloat() * 0.5F + 0.4F) * v;
|
||||
float blue = (RANDOM.nextFloat() * 0.5F + 0.5F) * v;
|
||||
RGBA[] colors = MyRenderLayer.getColors(1);
|
||||
float red = colors[0].getRed();
|
||||
float green = colors[0].getGreen();
|
||||
float blue = colors[0].getBlue();
|
||||
this.drawVertices(blockEntity, matrix4f, vertexConsumer, 0.0F, 1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F, red, green, blue, Direction.SOUTH);
|
||||
this.drawVertices(blockEntity, matrix4f, vertexConsumer, 0.0F, 1.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, red, green, blue, Direction.NORTH);
|
||||
this.drawVertices(blockEntity, matrix4f, vertexConsumer, 1.0F, 1.0F, 1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.0F, red, green, blue, Direction.EAST);
|
||||
|
@ -111,16 +109,16 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer<Entranc
|
|||
}
|
||||
|
||||
private void drawVertices(EntranceRiftBlockEntity endPortalBlockEntity, Matrix4f matrix4f, VertexConsumer vertexConsumer, float x1, float x2, float y1, float y2, float z1, float z2, float z3, float z4, float red, float green, float blue, Direction direction) {
|
||||
// vertexConsumer.vertex(matrix4f, x1, y1, z1).color(red, green, blue, 1.0F).next();
|
||||
// vertexConsumer.vertex(matrix4f, x2, y1, z2).color(red, green, blue, 1.0F).next();
|
||||
// vertexConsumer.vertex(matrix4f, x2, y2, z3).color(red, green, blue, 1.0F).next();
|
||||
// vertexConsumer.vertex(matrix4f, x1, y2, z4).color(red, green, blue, 1.0F).next();
|
||||
if (direction == endPortalBlockEntity.getOrientation() || direction.getOpposite() == endPortalBlockEntity.getOrientation()) {
|
||||
float offset = direction == endPortalBlockEntity.getOrientation() ? 0.5F : -0.5F;
|
||||
vertexConsumer.vertex(matrix4f, x1, y1, z1 + offset).color(red, green, blue, 1.0F).next();
|
||||
vertexConsumer.vertex(matrix4f, x2, y1, z2 + offset).color(red, green, blue, 1.0F).next();
|
||||
vertexConsumer.vertex(matrix4f, x2, y2, z3 + offset).color(red, green, blue, 1.0F).next();
|
||||
vertexConsumer.vertex(matrix4f, x1, y2, z4 + offset).color(red, green, blue, 1.0F).next();
|
||||
}
|
||||
vertexConsumer.vertex(matrix4f, x1, y1, z1).color(red, green, blue, 1.0F).next();
|
||||
vertexConsumer.vertex(matrix4f, x2, y1, z2).color(red, green, blue, 1.0F).next();
|
||||
vertexConsumer.vertex(matrix4f, x2, y2, z3).color(red, green, blue, 1.0F).next();
|
||||
vertexConsumer.vertex(matrix4f, x1, y2, z4).color(red, green, blue, 1.0F).next();
|
||||
// if (direction == endPortalBlockEntity.getOrientation() || direction.getOpposite() == endPortalBlockEntity.getOrientation()) {
|
||||
// float offset = direction == endPortalBlockEntity.getOrientation() ? 0.5F : -0.5F;
|
||||
// vertexConsumer.vertex(matrix4f, x1, y1, z1 + offset).color(red, green, blue, 1.0F).next();
|
||||
// vertexConsumer.vertex(matrix4f, x2, y1, z2 + offset).color(red, green, blue, 1.0F).next();
|
||||
// vertexConsumer.vertex(matrix4f, x2, y2, z3 + offset).color(red, green, blue, 1.0F).next();
|
||||
// vertexConsumer.vertex(matrix4f, x1, y2, z4 + offset).color(red, green, blue, 1.0F).next();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,49 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import com.flowpowered.math.vector.VectorNi;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
||||
import org.dimdev.dimdoors.mixin.DirectionAccessor;
|
||||
import org.dimdev.dimdoors.mixin.client.GlStateManagerAccessor;
|
||||
import org.dimdev.dimdoors.util.RGBA;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.enums.DoorHinge;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.RenderPhase;
|
||||
import net.minecraft.client.render.VertexFormat;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.render.block.BlockModels;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.client.util.GlAllocationUtils;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class MyRenderLayer extends RenderLayer {
|
||||
public static final FloatBuffer BUFFER = GlAllocationUtils.allocateFloatBuffer(16);
|
||||
public static final Identifier WARP_PATH = new Identifier("dimdoors:textures/other/warp.png");
|
||||
public static final BooleanProperty OPEN_PROPERTY = BooleanProperty.of("open");
|
||||
public static final EnumProperty<DoorHinge> HINGE_PROPERTY = EnumProperty.of("hinge", DoorHinge.class);
|
||||
public static final DirectionProperty FACING_PROPERTY = DirectionProperty.of("facing", Arrays.asList(DirectionAccessor.getHorizontal()));
|
||||
public static final TextureManager TEXTURE_MANAGER = MinecraftClient.getInstance().getTextureManager();
|
||||
public static final BlockModels BLOCK_MODELS = MinecraftClient.getInstance().getBlockRenderManager().getModels();
|
||||
public static final BakedModelManager MODEL_MANAGER = BLOCK_MODELS.getModelManager();
|
||||
public static final VectorNi COLORLESS = new VectorNi(255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255);
|
||||
|
||||
public MyRenderLayer(String string, VertexFormat vertexFormat, int i, int j, boolean bl, boolean bl2, Runnable runnable, Runnable runnable2) {
|
||||
super(string, vertexFormat, i, j, bl, bl2, runnable, runnable2);
|
||||
}
|
||||
|
@ -43,44 +68,104 @@ public class MyRenderLayer extends RenderLayer {
|
|||
.build(false));
|
||||
|
||||
public static RenderLayer getDimensionalPortal(int phase, EntranceRiftBlockEntity blockEntity) {
|
||||
Texture tex = new Texture(DimensionalPortalRenderer.getWarpPath(), false, false);
|
||||
return of("dimensional_portal", VertexFormats.POSITION_COLOR, 7, 256, false, true, RenderLayer.MultiPhaseParameters.builder().transparency(TRANSLUCENT_TRANSPARENCY).texture(tex).texturing(new DimensionalPortalTexturing(phase, blockEntity)).fog(FOG).build(false));
|
||||
Direction orientation = blockEntity.getOrientation();
|
||||
Texture tex = new Texture(WARP_PATH, false, false);
|
||||
Vec3d offset = new Vec3d(orientation.getOpposite().getUnitVector());
|
||||
return of("dimensional_portal",
|
||||
VertexFormats.POSITION_COLOR,
|
||||
7, 256,
|
||||
false,
|
||||
true,
|
||||
RenderLayer.MultiPhaseParameters.builder()
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.texture(tex)
|
||||
.texturing(new DimensionalPortalTexturing(phase,
|
||||
blockEntity,
|
||||
blockEntity.getPos().getX() + offset.x,
|
||||
blockEntity.getPos().getY() + offset.y,
|
||||
blockEntity.getPos().getZ() + offset.z))
|
||||
.fog(FOG).build(false));
|
||||
}
|
||||
|
||||
public static RGBA[] getColors(int count) {
|
||||
Random rand = new Random(31100L);
|
||||
float[][] colors = new float[count][];
|
||||
for (int i = 0; i < count; i++) {
|
||||
colors[i] = new float[]{rand.nextFloat() * 0.5F + 0.1F, rand.nextFloat() * 0.4F + 0.4F, rand.nextFloat() * 0.6F + 0.5F, 1};
|
||||
}
|
||||
return RGBA.fromFloatArray(colors);
|
||||
}
|
||||
|
||||
public static class DimensionalPortalTexturing extends RenderPhase.Texturing {
|
||||
public final int layer;
|
||||
|
||||
public DimensionalPortalTexturing(int layer, EntranceRiftBlockEntity blockEntity) {
|
||||
public DimensionalPortalTexturing(int layer, EntranceRiftBlockEntity blockEntity, double x, double y, double z) {
|
||||
super("dimensional_portal_texturing", () -> {
|
||||
Direction orientation = blockEntity.getOrientation();
|
||||
// for (int pass = 0; pass < 16; pass++) {
|
||||
// RenderSystem.pushMatrix();
|
||||
//
|
||||
// float translationScale = 16 - pass;
|
||||
// float scale = 0.3625F;
|
||||
//
|
||||
// RenderSystem.enableBlend();
|
||||
//
|
||||
// if (pass == 0) {
|
||||
// translationScale = 25.0F;
|
||||
// scale = 0.125F;
|
||||
//
|
||||
// RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// }
|
||||
//
|
||||
// if (pass == 1) {
|
||||
// scale = 0.5F;
|
||||
// RenderSystem.blendFunc(GL_ONE, GL_ONE);
|
||||
// }
|
||||
//
|
||||
// float offset = Util.getMeasuringTimeNano() % 200000L / 200000.0F;
|
||||
// RenderSystem.translated(offset, offset, offset);
|
||||
//
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.S, GL_OBJECT_LINEAR);
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.T, GL_OBJECT_LINEAR);
|
||||
// GlStateManager.texGenMode(GlStateManager.TexCoord.R, GL_OBJECT_LINEAR);
|
||||
//
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, GlStateManagerAccessor.invokeGetBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, GlStateManagerAccessor.invokeGetBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
// GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, GlStateManagerAccessor.invokeGetBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
//
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.S);
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.T);
|
||||
// GlStateManager.enableTexGen(GlStateManager.TexCoord.R);
|
||||
//
|
||||
// RenderSystem.popMatrix();
|
||||
// RenderSystem.matrixMode(GL_TEXTURE);
|
||||
// RenderSystem.pushMatrix();
|
||||
// RenderSystem.loadIdentity();
|
||||
// RenderSystem.translatef(0.1F, offset * translationScale, 0.1F);
|
||||
// RenderSystem.scalef(scale, scale, scale);
|
||||
// RenderSystem.translatef(0.5F, 0.5F, 0.5F);
|
||||
// RenderSystem.rotatef((pass * pass * 4321 + pass) * 9 * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
// RenderSystem.translatef(17.0F / (float)layer, (2.0F + (float)layer / 1.5F) * ((float)(Util.getMeasuringTimeMs() % 800000L) / 800000.0F), 0.0F);
|
||||
// RenderSystem.mulTextureByProjModelView();
|
||||
// RenderSystem.popMatrix();
|
||||
// RenderSystem.matrixMode(GL_MODELVIEW);
|
||||
// RenderSystem.disableBlend();
|
||||
// }
|
||||
RenderSystem.matrixMode(5890);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.loadIdentity();
|
||||
BlockPos off = blockEntity.getPos();
|
||||
Vec3i pos = MinecraftClient.getInstance().player != null ? off.subtract(MinecraftClient.getInstance().player.getBlockPos()) : new Vec3i(0, 0, 0);
|
||||
RenderSystem.translatef(0.5F, 0.5F, 0.0F);
|
||||
RenderSystem.scalef(0.5F + (pos.getX()/100.0F) * 1.2F, 0.5F + (pos.getZ()/100.0F) * 1.2F, 1.0F - (pos.getY()/100.0F) * 1.2F);
|
||||
RenderSystem.translatef(17.0F / (float) layer, (2.0F + (float) layer / 1.5F) * ((float) (Util.getMeasuringTimeMs() % 800000L) / 800000.0F), 0.0F);
|
||||
RenderSystem.rotatef(((float) (layer * layer) * 4321.0F + (float) layer * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.scalef(4.5F - (float) layer / 4.0F, 4.5F - (float) layer / 4.0F, 1.0F);
|
||||
RenderSystem.scalef(0.5F, 0.5F, 1.0F);
|
||||
RenderSystem.translatef(17.0F / (float)layer, (2.0F + (float)layer / 1.5F) * ((float)(Util.getMeasuringTimeMs() % 800000L) / 800000.0F), 0.0F);
|
||||
RenderSystem.rotatef(((float)(layer * layer) * 4321.0F + (float)layer * 9.0F) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderSystem.scalef(4.5F - (float)layer / 4.0F, 4.5F - (float)layer / 4.0F, 1.0F);
|
||||
RenderSystem.mulTextureByProjModelView();
|
||||
RenderSystem.matrixMode(5888);
|
||||
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.S, GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.T, GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGenMode(GlStateManager.TexCoord.R, GL_OBJECT_LINEAR);
|
||||
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.S, GL_OBJECT_PLANE, GlStateManagerAccessor.invokeGetBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.T, GL_OBJECT_PLANE, GlStateManagerAccessor.invokeGetBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGenParam(GlStateManager.TexCoord.R, GL_OBJECT_PLANE, GlStateManagerAccessor.invokeGetBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.S);
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.T);
|
||||
GlStateManager.enableTexGen(GlStateManager.TexCoord.R);
|
||||
RenderSystem.setupEndPortalTexGen();
|
||||
}, () -> {
|
||||
RenderSystem.matrixMode(5890);
|
||||
RenderSystem.popMatrix();
|
||||
RenderSystem.matrixMode(5888);
|
||||
|
||||
RenderSystem.clearTexGen();
|
||||
});
|
||||
this.layer = layer;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.dimdev.dimdoors.util;
|
||||
|
||||
public class RGBA {
|
||||
public class RGBA implements Cloneable {
|
||||
float red;
|
||||
float green;
|
||||
float blue;
|
||||
|
@ -34,10 +34,19 @@ public class RGBA {
|
|||
}
|
||||
|
||||
public static RGBA[] fromFloatArray(float[][] f) {
|
||||
RGBA[] arr = new RGBA[4];
|
||||
for (int a = 0; a < 4; a++) {
|
||||
RGBA[] arr = new RGBA[f.length];
|
||||
for (int a = 0; a < f.length; a++) {
|
||||
arr[a] = fromFloatArray(f[a]);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue