Fix contraption lighting

- Actually just one line.
This commit is contained in:
Jozufozu 2021-12-27 13:37:09 -08:00
parent 47e3aaa290
commit 78030b2f40
5 changed files with 27 additions and 20 deletions

View file

@ -1,4 +1,12 @@
0.4.1a:
0.5.0:
New
- Added parallel batching backend, effectively a CPU instancer.
- Now partially compatible with starlight.
Technical/API
- Much more flexible vertex formats.
- Do instance updates/ticking entirely async.
0.4.2-rc:
Fixes
- Partially fix crash on intel and mesa drivers (needs Create to update)
- Fix garbage rendering on AMD GPUs

View file

@ -4,7 +4,6 @@ import java.util.function.Supplier;
import com.jozufozu.flywheel.backend.gl.GlVertexArray;
import com.jozufozu.flywheel.core.model.Model;
import com.jozufozu.flywheel.util.AttribUtil;
public class ArrayModelRenderer extends ModelRenderer {
@ -36,7 +35,6 @@ public class ArrayModelRenderer extends ModelRenderer {
vao = new GlVertexArray();
vao.bind();
vao.enableArrays(this.model.getAttributeCount());
// bind the model's vbo to our vao
this.model.setupState();

View file

@ -46,7 +46,7 @@ public class BlockWriterUnsafe extends VertexWriterUnsafe<BlockVertex> {
MemoryUtil.memPutByte(ptr + 15, a);
MemoryUtil.memPutFloat(ptr + 16, u);
MemoryUtil.memPutFloat(ptr + 20, v);
MemoryUtil.memPutInt(ptr + 24, light);
MemoryUtil.memPutInt(ptr + 24, light << 8); // light is packed in the low byte of each short
MemoryUtil.memPutByte(ptr + 28, RenderMath.nb(nX));
MemoryUtil.memPutByte(ptr + 29, RenderMath.nb(nY));
MemoryUtil.memPutByte(ptr + 30, RenderMath.nb(nZ));

View file

@ -24,6 +24,7 @@ public abstract class VertexWriterUnsafe<V extends VertexType> implements Vertex
protected void advance() {
writeVertex++;
// account for seeking
if (writeVertex > totalVertices) totalVertices = writeVertex;
}

View file

@ -96,6 +96,22 @@ public class VirtualRenderWorld extends Level implements FlywheelWorld {
// MEANINGFUL OVERRIDES
@Override
public boolean setBlock(BlockPos pos, BlockState newState, int flags) {
blocksAdded.put(pos, newState);
SectionPos sectionPos = SectionPos.of(pos);
if (spannedSections.add(sectionPos)) {
lighter.updateSectionStatus(sectionPos, false);
}
if ((flags & Block.UPDATE_SUPPRESS_LIGHT) == 0) {
lighter.checkBlock(pos);
}
return true;
}
@Override
public int getHeight() {
return height;
@ -134,22 +150,6 @@ public class VirtualRenderWorld extends Level implements FlywheelWorld {
return setBlock(pos, state, 0);
}
@Override
public boolean setBlock(BlockPos pos, BlockState newState, int flags) {
blocksAdded.put(pos, newState);
SectionPos sectionPos = SectionPos.of(pos);
if (spannedSections.add(sectionPos)) {
lighter.updateSectionStatus(sectionPos, false);
}
if ((flags & Block.UPDATE_SUPPRESS_LIGHT) == 0) {
lighter.checkBlock(pos);
}
return true;
}
@Override
@Nullable
public BlockEntity getBlockEntity(BlockPos pos) {