mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-28 22:04:57 +01:00
Fix contraption lighting
- Actually just one line.
This commit is contained in:
parent
47e3aaa290
commit
78030b2f40
5 changed files with 27 additions and 20 deletions
|
@ -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
|
Fixes
|
||||||
- Partially fix crash on intel and mesa drivers (needs Create to update)
|
- Partially fix crash on intel and mesa drivers (needs Create to update)
|
||||||
- Fix garbage rendering on AMD GPUs
|
- Fix garbage rendering on AMD GPUs
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.gl.GlVertexArray;
|
import com.jozufozu.flywheel.backend.gl.GlVertexArray;
|
||||||
import com.jozufozu.flywheel.core.model.Model;
|
import com.jozufozu.flywheel.core.model.Model;
|
||||||
import com.jozufozu.flywheel.util.AttribUtil;
|
|
||||||
|
|
||||||
public class ArrayModelRenderer extends ModelRenderer {
|
public class ArrayModelRenderer extends ModelRenderer {
|
||||||
|
|
||||||
|
@ -36,7 +35,6 @@ public class ArrayModelRenderer extends ModelRenderer {
|
||||||
vao = new GlVertexArray();
|
vao = new GlVertexArray();
|
||||||
|
|
||||||
vao.bind();
|
vao.bind();
|
||||||
vao.enableArrays(this.model.getAttributeCount());
|
|
||||||
|
|
||||||
// bind the model's vbo to our vao
|
// bind the model's vbo to our vao
|
||||||
this.model.setupState();
|
this.model.setupState();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class BlockWriterUnsafe extends VertexWriterUnsafe<BlockVertex> {
|
||||||
MemoryUtil.memPutByte(ptr + 15, a);
|
MemoryUtil.memPutByte(ptr + 15, a);
|
||||||
MemoryUtil.memPutFloat(ptr + 16, u);
|
MemoryUtil.memPutFloat(ptr + 16, u);
|
||||||
MemoryUtil.memPutFloat(ptr + 20, v);
|
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 + 28, RenderMath.nb(nX));
|
||||||
MemoryUtil.memPutByte(ptr + 29, RenderMath.nb(nY));
|
MemoryUtil.memPutByte(ptr + 29, RenderMath.nb(nY));
|
||||||
MemoryUtil.memPutByte(ptr + 30, RenderMath.nb(nZ));
|
MemoryUtil.memPutByte(ptr + 30, RenderMath.nb(nZ));
|
||||||
|
|
|
@ -24,6 +24,7 @@ public abstract class VertexWriterUnsafe<V extends VertexType> implements Vertex
|
||||||
|
|
||||||
protected void advance() {
|
protected void advance() {
|
||||||
writeVertex++;
|
writeVertex++;
|
||||||
|
// account for seeking
|
||||||
if (writeVertex > totalVertices) totalVertices = writeVertex;
|
if (writeVertex > totalVertices) totalVertices = writeVertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,22 @@ public class VirtualRenderWorld extends Level implements FlywheelWorld {
|
||||||
|
|
||||||
// MEANINGFUL OVERRIDES
|
// 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
|
@Override
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return height;
|
return height;
|
||||||
|
@ -134,22 +150,6 @@ public class VirtualRenderWorld extends Level implements FlywheelWorld {
|
||||||
return setBlock(pos, state, 0);
|
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
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public BlockEntity getBlockEntity(BlockPos pos) {
|
public BlockEntity getBlockEntity(BlockPos pos) {
|
||||||
|
|
Loading…
Reference in a new issue