mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-16 23:11:40 +01:00
Non-fast TER updates
This commit is contained in:
parent
c44908b210
commit
501caa52b0
18 changed files with 224 additions and 130 deletions
|
@ -12,6 +12,8 @@ import net.minecraft.client.renderer.Vector4f;
|
|||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public class SuperByteBuffer {
|
||||
|
@ -99,6 +101,7 @@ public class SuperByteBuffer {
|
|||
if (original.limit() == 0)
|
||||
return;
|
||||
if (!(buffer instanceof BufferBuilder)) {
|
||||
// TODO add "slow" path that writes all the data instead of using bulk put
|
||||
throw new IllegalArgumentException("Unsupported buffer type!");
|
||||
}
|
||||
((BufferBuilder)buffer).putBulkData(build(input));
|
||||
|
@ -113,15 +116,25 @@ public class SuperByteBuffer {
|
|||
return this;
|
||||
}
|
||||
|
||||
public SuperByteBuffer rotate(Direction axis, float angle) {
|
||||
if (angle == 0)
|
||||
@Deprecated
|
||||
public SuperByteBuffer rotate(Axis axis, float radians) {
|
||||
return rotate(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis), radians);
|
||||
}
|
||||
|
||||
public SuperByteBuffer rotate(Direction axis, float radians) {
|
||||
if (radians == 0)
|
||||
return this;
|
||||
transforms.multiply(axis.getUnitVector().getDegreesQuaternion(angle));
|
||||
transforms.multiply(axis.getUnitVector().getRadialQuaternion(radians));
|
||||
return this;
|
||||
}
|
||||
|
||||
public SuperByteBuffer rotateCentered(Direction axis, float angle) {
|
||||
return translate(-.5f, -.5f, -.5f).rotate(axis, angle).translate(.5f, .5f, .5f);
|
||||
@Deprecated
|
||||
public SuperByteBuffer rotateCentered(Axis axis, float radians) {
|
||||
return rotateCentered(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis), radians);
|
||||
}
|
||||
|
||||
public SuperByteBuffer rotateCentered(Direction axis, float radians) {
|
||||
return translate(-.5f, -.5f, -.5f).rotate(axis, radians).translate(.5f, .5f, .5f);
|
||||
}
|
||||
|
||||
public SuperByteBuffer shiftUV(TextureAtlasSprite from, TextureAtlasSprite to) {
|
||||
|
|
|
@ -65,7 +65,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
|||
float angle) {
|
||||
int light = te.getBlockState().getLightValue(te.getWorld(), te.getPos());
|
||||
buffer.light((0xF0 << 24) | (light << 4));
|
||||
buffer.rotateCentered(Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis), angle);
|
||||
buffer.rotateCentered(axis, angle);
|
||||
|
||||
int white = 0xFFFFFF;
|
||||
if (KineticDebugger.isActive()) {
|
||||
|
|
|
@ -12,10 +12,15 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|||
import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
||||
public class DrillTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public DrillTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return getRotatingModel(te.getBlockState());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.modules.contraptions.components.clock;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -9,16 +10,22 @@ import com.simibubi.create.modules.contraptions.components.clock.CuckooClockTile
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class CuckooClockRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public CuckooClockRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
if (!(te instanceof CuckooClockTileEntity))
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.modules.contraptions.components.contraptions.bearing;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -7,16 +8,23 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
|||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
||||
public class BearingTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public BearingTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
IBearingTileEntity bearingTe = (IBearingTileEntity) te;
|
||||
final Direction facing = te.getBlockState().get(BlockStateProperties.FACING);
|
||||
|
@ -25,9 +33,8 @@ public class BearingTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
if (facing.getAxis().isHorizontal())
|
||||
superBuffer.rotateCentered(Axis.Y, AngleHelper.rad(AngleHelper.horizontalAngle(facing.getOpposite())));
|
||||
float interpolatedAngle = bearingTe.getInterpolatedAngle(partialTicks - 1);
|
||||
kineticRotationTransform(superBuffer, te, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI),
|
||||
getWorld());
|
||||
superBuffer.translate(x, y, z).renderInto(buffer);
|
||||
kineticRotationTransform(superBuffer, te, facing.getAxis(), (float) (interpolatedAngle / 180 * Math.PI));
|
||||
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,14 +7,13 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
||||
public class MechanicalPistonTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
public MechanicalPistonTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.modules.contraptions.components.contraptions.pulley;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
|
@ -9,18 +11,25 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|||
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionEntity;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
||||
public class PulleyRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public PulleyRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
PulleyTileEntity pulley = (PulleyTileEntity) te;
|
||||
BlockState blockState = te.getBlockState();
|
||||
|
@ -37,29 +46,31 @@ public class PulleyRenderer extends KineticTileEntityRenderer {
|
|||
if (pulley.movedContraption != null) {
|
||||
ContraptionEntity e = pulley.movedContraption;
|
||||
PulleyContraption c = (PulleyContraption) pulley.movedContraption.getContraption();
|
||||
double entityPos = MathHelper.lerp(partialTicks, e.lastTickPosY, e.posY);
|
||||
double entityPos = MathHelper.lerp(partialTicks, e.lastTickPosY, e.getY());
|
||||
offset = (float) -(entityPos - c.getAnchor().getY() - c.initialOffset);
|
||||
}
|
||||
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
if (pulley.running || pulley.offset == 0)
|
||||
renderAt(offset > .25f ? magnet : halfMagnet, x, y, z, offset, pos, buffer);
|
||||
renderAt(te.getWorld(), offset > .25f ? magnet : halfMagnet, offset, pos, ms, vb);
|
||||
|
||||
float f = offset % 1;
|
||||
if (offset > .75f && (f < .25f || f > .75f))
|
||||
renderAt(halfRope, x, y, z, f > .75f ? f - 1 : f, pos, buffer);
|
||||
renderAt(te.getWorld(), halfRope, f > .75f ? f - 1 : f, pos, ms, vb);
|
||||
|
||||
if (!pulley.running)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < offset - 1.25f; i++)
|
||||
renderAt(rope, x, y, z, offset - i - 1, pos, buffer);
|
||||
renderAt(te.getWorld(), rope, offset - i - 1, pos, ms, vb);
|
||||
}
|
||||
|
||||
public void renderAt(SuperByteBuffer partial, double x, double y, double z, float offset, BlockPos pulleyPos,
|
||||
BufferBuilder buffer) {
|
||||
public void renderAt(IWorld world, SuperByteBuffer partial, float offset, BlockPos pulleyPos,
|
||||
MatrixStack ms, IVertexBuilder buffer) {
|
||||
BlockPos actualPos = pulleyPos.down((int) offset);
|
||||
int light = getWorld().getBlockState(actualPos).getPackedLightmapCoords(getWorld(), actualPos);
|
||||
partial.translate(x, y - offset, z).light(light).renderInto(buffer);
|
||||
int light = world.getBlockState(actualPos).getPackedLightmapCoords(world, actualPos);
|
||||
partial.translate(0, -offset, 0).light(light).renderInto(ms, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,29 +2,36 @@ package com.simibubi.create.modules.contraptions.components.crank;
|
|||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
public class HandCrankTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public HandCrankTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
BlockState state = te.getBlockState();
|
||||
Direction facing = state.get(FACING);
|
||||
SuperByteBuffer handle = AllBlockPartials.HAND_CRANK_HANDLE.renderOnDirectional(state, facing.getOpposite());
|
||||
HandCrankTileEntity crank = (HandCrankTileEntity) te;
|
||||
kineticRotationTransform(handle, te, facing.getAxis(),
|
||||
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360, getWorld());
|
||||
handle.translate(x, y, z).renderInto(buffer);
|
||||
(crank.independentAngle + partialTicks * crank.chasingVelocity) / 360);
|
||||
handle.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.components.fan;
|
|||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -9,14 +10,20 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
|||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class EncasedFanTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public EncasedFanTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
Direction direction = te.getBlockState().get(FACING);
|
||||
SuperByteBuffer superBuffer = AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(),
|
||||
direction.getOpposite());
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.components.flywheel;
|
|||
|
||||
import static com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -11,6 +12,9 @@ import com.simibubi.create.modules.contraptions.components.flywheel.FlywheelBloc
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
|
@ -19,10 +23,14 @@ import net.minecraft.util.Rotation;
|
|||
|
||||
public class FlywheelRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public FlywheelRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
FlywheelTileEntity wte = (FlywheelTileEntity) te;
|
||||
|
@ -33,7 +41,7 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
if (FlywheelBlock.isConnected(blockState)) {
|
||||
Direction connection = FlywheelBlock.getConnection(blockState);
|
||||
int light = blockState.getPackedLightmapCoords(getWorld(), te.getPos().offset(connection));
|
||||
int light = blockState.getPackedLightmapCoords(te.getWorld(), te.getPos().offset(connection));
|
||||
float rotation = connection.getAxis() == Axis.X ^ connection.getAxisDirection() == AxisDirection.NEGATIVE
|
||||
? -angle
|
||||
: angle;
|
||||
|
@ -49,9 +57,8 @@ public class FlywheelRenderer extends KineticTileEntityRenderer {
|
|||
false, rotation, flip), connection).translate(x, y, z).light(light).renderInto(buffer);
|
||||
}
|
||||
|
||||
kineticRotationTransform(wheel, te, blockState.get(HORIZONTAL_FACING).getAxis(), AngleHelper.rad(angle),
|
||||
getWorld());
|
||||
wheel.translate(x, y, z).renderInto(buffer);
|
||||
kineticRotationTransform(wheel, te, blockState.get(HORIZONTAL_FACING).getAxis(), AngleHelper.rad(angle));
|
||||
wheel.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.modules.contraptions.components.mixer;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -8,33 +10,37 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class MechanicalMixerTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te;
|
||||
BlockPos pos = te.getPos();
|
||||
|
||||
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
|
||||
standardKineticRotationTransform(superBuffer, te, getWorld()).translate(x, y, z).renderInto(buffer);
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
|
||||
int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), pos);
|
||||
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
|
||||
standardKineticRotationTransform(superBuffer, te).renderInto(ms, vb);
|
||||
|
||||
int packedLightmapCoords = blockState.getPackedLightmapCoords(te.getWorld(), pos);
|
||||
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
||||
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
float angle = (float) (((time * speed * 6 / 10f) % 360) / 180 * (float) Math.PI);
|
||||
|
||||
SuperByteBuffer poleRender = AllBlockPartials.MECHANICAL_MIXER_POLE.renderOn(blockState);
|
||||
poleRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
|
||||
poleRender.translate(0, -renderedHeadOffset, 0).light(packedLightmapCoords).renderInto(ms, vb);
|
||||
|
||||
SuperByteBuffer headRender = AllBlockPartials.MECHANICAL_MIXER_HEAD.renderOn(blockState);
|
||||
headRender.rotateCentered(Axis.Y, angle).translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords)
|
||||
.renderInto(buffer);
|
||||
headRender.rotateCentered(Axis.Y, angle).translate(0, -renderedHeadOffset, 0).light(packedLightmapCoords)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,8 +5,14 @@ import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
|||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
||||
public class MotorTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public MotorTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(KineticTileEntity te) {
|
||||
return AllBlockPartials.SHAFT_HALF.renderOnHorizontal(te.getBlockState());
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.components.press;
|
|||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -10,23 +11,30 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class MechanicalPressTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public MechanicalPressTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
BlockPos pos = te.getPos();
|
||||
BlockState blockState = te.getBlockState();
|
||||
int packedLightmapCoords = blockState.getPackedLightmapCoords(getWorld(), pos);
|
||||
int packedLightmapCoords = blockState.getPackedLightmapCoords(te.getWorld(), pos);
|
||||
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
|
||||
|
||||
SuperByteBuffer headRender = AllBlockPartials.MECHANICAL_PRESS_HEAD.renderOnHorizontal(blockState);
|
||||
headRender.translate(x, y - renderedHeadOffset, z).light(packedLightmapCoords).renderInto(buffer);
|
||||
headRender.translate(0, -renderedHeadOffset, 0).light(packedLightmapCoords).renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,10 +5,15 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
|||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
||||
public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public EncasedShaftTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState getRenderedBlockState(KineticTileEntity te) {
|
||||
return AllBlocks.SHAFT.get().getDefaultState().with(BlockStateProperties.AXIS,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.modules.contraptions.relays.encased;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -8,16 +9,23 @@ import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
|||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public SplitShaftTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks, int destroyStage,
|
||||
BufferBuilder buffer) {
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
Block block = te.getBlockState().getBlock();
|
||||
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
||||
final BlockPos pos = te.getPos();
|
||||
|
@ -41,9 +49,8 @@ public class SplitShaftTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
SuperByteBuffer superByteBuffer =
|
||||
AllBlockPartials.SHAFT_HALF.renderOnDirectional(te.getBlockState(), direction);
|
||||
kineticRotationTransform(superByteBuffer, te, axis, angle, getWorld());
|
||||
superByteBuffer.translate(x, y, z).renderInto(buffer);
|
||||
|
||||
kineticRotationTransform(superByteBuffer, te, axis, angle);
|
||||
superByteBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.modules.contraptions.relays.gauge;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
@ -10,6 +12,8 @@ import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock.Type;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
@ -24,19 +28,19 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
BlockState gaugeState = te.getBlockState();
|
||||
super.renderFast(te, x, y, z, partialTicks, destroyStage, buffer);
|
||||
GaugeTileEntity gaugeTE = (GaugeTileEntity) te;
|
||||
int lightCoords = gaugeState.getPackedLightmapCoords(getWorld(), te.getPos());
|
||||
int lightCoords = gaugeState.getPackedLightmapCoords(te.getWorld(), te.getPos());
|
||||
|
||||
SuperByteBuffer headBuffer = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED
|
||||
: AllBlockPartials.GAUGE_HEAD_STRESS).renderOn(gaugeState);
|
||||
SuperByteBuffer dialBuffer = AllBlockPartials.GAUGE_DIAL.renderOn(gaugeState);
|
||||
|
||||
for (Direction facing : Direction.values()) {
|
||||
if (!((GaugeBlock) gaugeState.getBlock()).shouldRenderHeadOnFace(getWorld(), te.getPos(), gaugeState,
|
||||
if (!((GaugeBlock) gaugeState.getBlock()).shouldRenderHeadOnFace(te.getWorld(), te.getPos(), gaugeState,
|
||||
facing))
|
||||
continue;
|
||||
|
||||
|
@ -45,8 +49,9 @@ public class GaugeTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
dialBuffer.translate(0, dialPivot, dialPivot).rotate(Axis.X, (float) (Math.PI / 2 * -progress)).translate(0,
|
||||
-dialPivot, -dialPivot);
|
||||
|
||||
rotateBufferTowards(dialBuffer, facing).light(lightCoords).translate(x, y, z).renderInto(buffer);
|
||||
rotateBufferTowards(headBuffer, facing).light(lightCoords).translate(x, y, z).renderInto(buffer);
|
||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||
rotateBufferTowards(dialBuffer, facing).light(lightCoords).renderInto(ms, vb);
|
||||
rotateBufferTowards(headBuffer, facing).light(lightCoords).renderInto(ms, vb);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package com.simibubi.create.modules.contraptions.relays.gearbox;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
@ -14,9 +17,13 @@ import net.minecraft.util.math.BlockPos;
|
|||
|
||||
public class GearboxTileEntityRenderer extends KineticTileEntityRenderer {
|
||||
|
||||
public GearboxTileEntityRenderer(TileEntityRendererDispatcher dispatcher) {
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFast(KineticTileEntity te, double x, double y, double z, float partialTicks,
|
||||
int destroyStage, BufferBuilder buffer) {
|
||||
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||
int light, int overlay) {
|
||||
final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
|
||||
final BlockPos pos = te.getPos();
|
||||
float time = AnimationTickHolder.getRenderTick();
|
||||
|
@ -42,8 +49,8 @@ public class GearboxTileEntityRenderer extends KineticTileEntityRenderer {
|
|||
angle += offset;
|
||||
angle = angle / 180f * (float) Math.PI;
|
||||
|
||||
kineticRotationTransform(shaft, te, axis, angle, getWorld());
|
||||
shaft.translate(x, y, z).renderInto(buffer);
|
||||
kineticRotationTransform(shaft, te, axis, angle);
|
||||
shaft.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
package com.simibubi.create.modules.schematics.client;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.simibubi.create.foundation.type.Cuboid;
|
||||
import com.simibubi.create.modules.schematics.SchematicWorld;
|
||||
|
||||
|
@ -20,13 +25,11 @@ import net.minecraft.client.renderer.ActiveRenderInfo;
|
|||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
||||
|
@ -37,8 +40,8 @@ import net.minecraftforge.client.model.data.EmptyModelData;
|
|||
public class SchematicHologram {
|
||||
|
||||
private final RegionRenderCacheBuilder bufferCache = new RegionRenderCacheBuilder();
|
||||
private final boolean[] usedBlockRenderLayers = new boolean[BlockRenderLayer.values().length];
|
||||
private final boolean[] startedBufferBuilders = new boolean[BlockRenderLayer.values().length];
|
||||
private final Set<RenderType> usedBlockRenderLayers = new HashSet<>(RenderType.getBlockLayers().size());
|
||||
private final Set<RenderType> startedBufferBuilders = new HashSet<>(RenderType.getBlockLayers().size());
|
||||
private boolean active;
|
||||
private boolean changed;
|
||||
private SchematicWorld schematic;
|
||||
|
@ -85,8 +88,8 @@ public class SchematicHologram {
|
|||
}
|
||||
|
||||
private void redraw(Minecraft minecraft) {
|
||||
Arrays.fill(usedBlockRenderLayers, false);
|
||||
Arrays.fill(startedBufferBuilders, false);
|
||||
usedBlockRenderLayers.clear();
|
||||
startedBufferBuilders.clear();
|
||||
|
||||
final SchematicWorld blockAccess = schematic;
|
||||
final BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher();
|
||||
|
@ -97,15 +100,13 @@ public class SchematicHologram {
|
|||
blockAccess.getBounds().getOrigin().add(blockAccess.getBounds().getSize()))) {
|
||||
BlockPos pos = localPos.add(anchor);
|
||||
BlockState state = blockAccess.getBlockState(pos);
|
||||
for (BlockRenderLayer blockRenderLayer : BlockRenderLayer.values()) {
|
||||
if (!state.getBlock().canRenderInLayer(state, blockRenderLayer)) {
|
||||
for (RenderType blockRenderLayer : RenderType.getBlockLayers()) {
|
||||
if (!RenderTypeLookup.canRenderInLayer(state, blockRenderLayer)) {
|
||||
continue;
|
||||
}
|
||||
ForgeHooksClient.setRenderLayer(blockRenderLayer);
|
||||
final int blockRenderLayerId = blockRenderLayer.ordinal();
|
||||
final BufferBuilder bufferBuilder = bufferCache.getBuilder(blockRenderLayerId);
|
||||
if (!startedBufferBuilders[blockRenderLayerId]) {
|
||||
startedBufferBuilders[blockRenderLayerId] = true;
|
||||
final BufferBuilder bufferBuilder = bufferCache.get(blockRenderLayer);
|
||||
if (startedBufferBuilders.add(blockRenderLayer)) {
|
||||
// Copied from RenderChunk
|
||||
{
|
||||
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
|
@ -120,8 +121,9 @@ public class SchematicHologram {
|
|||
state = Blocks.QUARTZ_SLAB.getDefaultState();
|
||||
}
|
||||
|
||||
usedBlockRenderLayers[blockRenderLayerId] |= blockRendererDispatcher.renderBlock(state, pos,
|
||||
blockAccess, bufferBuilder, minecraft.world.rand, EmptyModelData.INSTANCE);
|
||||
if (blockRendererDispatcher.renderModel(state, pos, blockAccess, new MatrixStack(), bufferBuilder, true, minecraft.world.rand, EmptyModelData.INSTANCE)) {
|
||||
usedBlockRenderLayers.add(blockRenderLayer);
|
||||
}
|
||||
blockstates.add(state);
|
||||
// if (Config.isShaders())
|
||||
// SVertexBuilder.popEntity(bufferBuilder);
|
||||
|
@ -130,11 +132,11 @@ public class SchematicHologram {
|
|||
}
|
||||
|
||||
// finishDrawing
|
||||
for (int blockRenderLayerId = 0; blockRenderLayerId < usedBlockRenderLayers.length; blockRenderLayerId++) {
|
||||
if (!startedBufferBuilders[blockRenderLayerId]) {
|
||||
for (RenderType layer : RenderType.getBlockLayers()) {
|
||||
if (!startedBufferBuilders.contains(layer)) {
|
||||
continue;
|
||||
}
|
||||
bufferCache.getBuilder(blockRenderLayerId).finishDrawing();
|
||||
bufferCache.get(layer).finishDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,50 +154,35 @@ public class SchematicHologram {
|
|||
double renderPosY = view.y;
|
||||
double renderPosZ = view.z;
|
||||
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
RenderSystem.enableAlphaTest();
|
||||
RenderSystem.enableBlend();
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
for (int blockRenderLayerId = 0; blockRenderLayerId < usedBlockRenderLayers.length; blockRenderLayerId++) {
|
||||
if (!usedBlockRenderLayers[blockRenderLayerId]) {
|
||||
for (RenderType layer : RenderType.getBlockLayers()) {
|
||||
if (!usedBlockRenderLayers.contains(layer)) {
|
||||
continue;
|
||||
}
|
||||
final BufferBuilder bufferBuilder = bufferCache.getBuilder(blockRenderLayerId);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(-renderPosX, -renderPosY, -renderPosZ);
|
||||
final BufferBuilder bufferBuilder = bufferCache.get(layer);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated(-renderPosX, -renderPosY, -renderPosZ);
|
||||
drawBuffer(bufferBuilder);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
RenderSystem.disableAlphaTest();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
}
|
||||
|
||||
// Coppied from the Tesselator's vboUploader - Draw everything but don't
|
||||
// Coppied from WorldVertexBufferUploader - Draw everything but don't
|
||||
// reset the buffer
|
||||
private static void drawBuffer(final BufferBuilder bufferBuilder) {
|
||||
if (bufferBuilder.getVertexCount() > 0) {
|
||||
Pair<BufferBuilder.DrawState, ByteBuffer> pair = bufferBuilder.popData();
|
||||
BufferBuilder.DrawState state = pair.getFirst();
|
||||
|
||||
VertexFormat vertexformat = bufferBuilder.getVertexFormat();
|
||||
int size = vertexformat.getSize();
|
||||
ByteBuffer bytebuffer = bufferBuilder.getByteBuffer();
|
||||
List<VertexFormatElement> list = vertexformat.getElements();
|
||||
|
||||
for (int index = 0; index < list.size(); ++index) {
|
||||
VertexFormatElement vertexformatelement = list.get(index);
|
||||
Usage usage = vertexformatelement.getUsage();
|
||||
bytebuffer.position(vertexformat.getOffset(index));
|
||||
usage.preDraw(vertexformat, index, size, bytebuffer);
|
||||
}
|
||||
|
||||
GlStateManager.drawArrays(bufferBuilder.getDrawMode(), 0, bufferBuilder.getVertexCount());
|
||||
|
||||
for (int index = 0; index < list.size(); ++index) {
|
||||
VertexFormatElement vertexformatelement = list.get(index);
|
||||
Usage usage = vertexformatelement.getUsage();
|
||||
usage.postDraw(vertexformat, index, size, bytebuffer);
|
||||
}
|
||||
if (state.getCount() > 0) {
|
||||
state.getVertexFormat().startDrawing(MemoryUtil.memAddress(pair.getSecond()));
|
||||
GlStateManager.drawArrays(state.getMode(), 0, state.getCount());
|
||||
state.getVertexFormat().endDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue