mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Make the BatchingEngine not jittery
- Stop having threads compete for a single BufferBuilder - ...by skirting around minecraft's BufferSource - Begin work on making vertex writing sane
This commit is contained in:
parent
5f46560fb2
commit
aa96a28f0b
3 changed files with 7 additions and 15 deletions
|
@ -4,9 +4,7 @@ import com.jozufozu.flywheel.api.Instancer;
|
||||||
import com.jozufozu.flywheel.api.MaterialGroup;
|
import com.jozufozu.flywheel.api.MaterialGroup;
|
||||||
import com.jozufozu.flywheel.api.MaterialManager;
|
import com.jozufozu.flywheel.api.MaterialManager;
|
||||||
import com.jozufozu.flywheel.api.instance.ITickableInstance;
|
import com.jozufozu.flywheel.api.instance.ITickableInstance;
|
||||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
|
||||||
import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance;
|
import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance;
|
||||||
import com.jozufozu.flywheel.core.Formats;
|
|
||||||
import com.jozufozu.flywheel.core.Materials;
|
import com.jozufozu.flywheel.core.Materials;
|
||||||
import com.jozufozu.flywheel.core.instancing.ConditionalInstance;
|
import com.jozufozu.flywheel.core.instancing.ConditionalInstance;
|
||||||
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
|
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
|
||||||
|
@ -103,7 +101,6 @@ public class GlueInstance extends EntityInstance<SuperGlueEntity> implements ITi
|
||||||
return "glue";
|
return "glue";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void buffer(VertexConsumer buffer) {
|
public void buffer(VertexConsumer buffer) {
|
||||||
Vec3 diff = Vec3.atLowerCornerOf(Direction.SOUTH.getNormal());
|
Vec3 diff = Vec3.atLowerCornerOf(Direction.SOUTH.getNormal());
|
||||||
Vec3 extension = diff.normalize()
|
Vec3 extension = diff.normalize()
|
||||||
|
@ -162,11 +159,6 @@ public class GlueInstance extends EntityInstance<SuperGlueEntity> implements ITi
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public VertexFormat format() {
|
|
||||||
return Formats.UNLIT_MODEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelReader getReader() {
|
public ModelReader getReader() {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class FlwContraptionManager extends ContraptionRenderManager<RenderedCont
|
||||||
RenderLayer renderLayer = event.getLayer();
|
RenderLayer renderLayer = event.getLayer();
|
||||||
if (renderLayer != null) {
|
if (renderLayer != null) {
|
||||||
for (RenderedContraption renderer : visible) {
|
for (RenderedContraption renderer : visible) {
|
||||||
renderer.engine.render(event, event.buffers.bufferSource());
|
renderer.engine.render(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package com.simibubi.create.foundation.render;
|
package com.simibubi.create.foundation.render;
|
||||||
|
|
||||||
import com.jozufozu.flywheel.util.BufferBuilderReader;
|
import com.jozufozu.flywheel.util.BlockFormatReader;
|
||||||
import com.jozufozu.flywheel.util.ModelReader;
|
import com.jozufozu.flywheel.util.ModelReader;
|
||||||
import com.jozufozu.flywheel.util.RenderMath;
|
|
||||||
import com.jozufozu.flywheel.util.transform.Rotate;
|
import com.jozufozu.flywheel.util.transform.Rotate;
|
||||||
import com.jozufozu.flywheel.util.transform.Scale;
|
import com.jozufozu.flywheel.util.transform.Scale;
|
||||||
import com.jozufozu.flywheel.util.transform.TStack;
|
import com.jozufozu.flywheel.util.transform.TStack;
|
||||||
|
@ -63,12 +62,9 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
|
|
||||||
// Temporary
|
// Temporary
|
||||||
private static final Long2IntMap WORLD_LIGHT_CACHE = new Long2IntOpenHashMap();
|
private static final Long2IntMap WORLD_LIGHT_CACHE = new Long2IntOpenHashMap();
|
||||||
private final Vector4f pos = new Vector4f();
|
|
||||||
private final Vector3f normal = new Vector3f();
|
|
||||||
private final Vector4f lightPos = new Vector4f();
|
|
||||||
|
|
||||||
public SuperByteBuffer(BufferBuilder buf) {
|
public SuperByteBuffer(BufferBuilder buf) {
|
||||||
template = new BufferBuilderReader(buf);
|
template = new BlockFormatReader(buf);
|
||||||
transforms = new PoseStack();
|
transforms = new PoseStack();
|
||||||
transforms.pushPose();
|
transforms.pushPose();
|
||||||
}
|
}
|
||||||
|
@ -107,6 +103,10 @@ public class SuperByteBuffer implements Scale<SuperByteBuffer>, Translate<SuperB
|
||||||
WORLD_LIGHT_CACHE.clear();
|
WORLD_LIGHT_CACHE.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Vector4f pos = new Vector4f();
|
||||||
|
final Vector3f normal = new Vector3f();
|
||||||
|
final Vector4f lightPos = new Vector4f();
|
||||||
|
|
||||||
float f = .5f;
|
float f = .5f;
|
||||||
int vertexCount = template.getVertexCount();
|
int vertexCount = template.getVertexCount();
|
||||||
for (int i = 0; i < vertexCount; i++) {
|
for (int i = 0; i < vertexCount; i++) {
|
||||||
|
|
Loading…
Reference in a new issue