mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 09:33:40 +01:00
Merge branch 'mc1.17/dev' into mc1.18/dev
This commit is contained in:
commit
5ad0d1d704
8 changed files with 48 additions and 15 deletions
|
@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
|
||||
public class BeltType implements Writeable<BeltData> {
|
||||
public class BeltType implements Writeable<BeltData>, Batched<BeltData> {
|
||||
@Override
|
||||
public BeltData create() {
|
||||
return new BeltData();
|
||||
|
@ -21,4 +24,9 @@ public class BeltType implements Writeable<BeltData> {
|
|||
public StructWriter<BeltData> getWriter(VecBuffer backing) {
|
||||
return new UnsafeBeltWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<BeltData> getTransformer(IModel model) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
|
||||
public class RotatingType implements Writeable<RotatingData> {
|
||||
public class RotatingType implements Writeable<RotatingData>, Batched<RotatingData> {
|
||||
@Override
|
||||
public RotatingData create() {
|
||||
return new RotatingData();
|
||||
|
@ -21,4 +24,9 @@ public class RotatingType implements Writeable<RotatingData> {
|
|||
public StructWriter<RotatingData> getWriter(VecBuffer backing) {
|
||||
return new UnsafeRotatingWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<RotatingData> getTransformer(IModel model) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
|
||||
public class ActorType implements Writeable<ActorData> {
|
||||
public class ActorType implements Writeable<ActorData>, Batched<ActorData> {
|
||||
@Override
|
||||
public ActorData create() {
|
||||
return new ActorData();
|
||||
|
@ -21,4 +24,9 @@ public class ActorType implements Writeable<ActorData> {
|
|||
public StructWriter<ActorData> getWriter(VecBuffer backing) {
|
||||
return new UnsafeActorWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<ActorData> getTransformer(IModel model) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.render;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.MaterialGroupImpl;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManagerImpl;
|
||||
import com.jozufozu.flywheel.backend.material.instancing.InstancedMaterialGroup;
|
||||
import com.jozufozu.flywheel.backend.material.instancing.InstancingEngine;
|
||||
|
||||
public class ContraptionGroup<P extends ContraptionProgram> extends MaterialGroupImpl<P> {
|
||||
public class ContraptionGroup<P extends ContraptionProgram> extends InstancedMaterialGroup<P> {
|
||||
|
||||
private final RenderedContraption contraption;
|
||||
|
||||
public ContraptionGroup(RenderedContraption contraption, MaterialManagerImpl<P> owner) {
|
||||
public ContraptionGroup(RenderedContraption contraption, InstancingEngine<P> owner) {
|
||||
super(owner);
|
||||
|
||||
this.contraption = contraption;
|
||||
|
@ -18,7 +18,7 @@ public class ContraptionGroup<P extends ContraptionProgram> extends MaterialGrou
|
|||
contraption.setup(program);
|
||||
}
|
||||
|
||||
public static <P extends ContraptionProgram> MaterialManagerImpl.GroupFactory<P> forContraption(RenderedContraption c) {
|
||||
public static <P extends ContraptionProgram> InstancingEngine.GroupFactory<P> forContraption(RenderedContraption c) {
|
||||
return (materialManager) -> new ContraptionGroup<>(c, materialManager);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import javax.annotation.Nullable;
|
|||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManagerImpl;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.AllMovementBehaviours;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
@ -23,7 +23,7 @@ public class ContraptionInstanceManager extends TileInstanceManager {
|
|||
|
||||
private final WeakReference<RenderedContraption> contraption;
|
||||
|
||||
ContraptionInstanceManager(RenderedContraption contraption, MaterialManagerImpl<?> materialManager) {
|
||||
ContraptionInstanceManager(RenderedContraption contraption, MaterialManager materialManager) {
|
||||
super(materialManager);
|
||||
this.contraption = new WeakReference<>(contraption);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class FlwContraptionManager extends ContraptionRenderManager<RenderedCont
|
|||
RenderLayer renderLayer = event.getLayer();
|
||||
if (renderLayer != null) {
|
||||
for (RenderedContraption renderer : visible) {
|
||||
renderer.materialManager.render(renderLayer, event.viewProjection, event.camX, event.camY, event.camZ);
|
||||
renderer.materialManager.render(event, event.buffers.bufferSource());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.function.Supplier;
|
|||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManagerImpl;
|
||||
import com.jozufozu.flywheel.backend.material.instancing.InstancingEngine;
|
||||
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
|
||||
import com.jozufozu.flywheel.backend.model.ModelRenderer;
|
||||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
|
@ -34,7 +34,7 @@ public class RenderedContraption extends ContraptionRenderInfo {
|
|||
|
||||
private final ContraptionLighter<?> lighter;
|
||||
|
||||
public final MaterialManagerImpl<ContraptionProgram> materialManager;
|
||||
public final InstancingEngine<ContraptionProgram> materialManager;
|
||||
public final ContraptionInstanceManager kinetics;
|
||||
|
||||
private final Map<RenderType, ModelRenderer> renderLayers = new HashMap<>();
|
||||
|
@ -47,11 +47,12 @@ public class RenderedContraption extends ContraptionRenderInfo {
|
|||
public RenderedContraption(Contraption contraption, PlacementSimulationWorld renderWorld) {
|
||||
super(contraption, renderWorld);
|
||||
this.lighter = contraption.makeLighter();
|
||||
this.materialManager = MaterialManagerImpl.builder(CreateContexts.CWORLD)
|
||||
this.materialManager = InstancingEngine.builder(CreateContexts.CWORLD)
|
||||
.setGroupFactory(ContraptionGroup.forContraption(this))
|
||||
.setIgnoreOriginCoordinate(true)
|
||||
.build();
|
||||
this.kinetics = new ContraptionInstanceManager(this, materialManager);
|
||||
this.materialManager.addListener(this.kinetics);
|
||||
|
||||
buildLayers();
|
||||
if (Backend.getInstance().canUseInstancing()) {
|
||||
|
|
|
@ -2,11 +2,14 @@ package com.simibubi.create.content.logistics.block.flap;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
|
||||
public class FlapType implements Writeable<FlapData> {
|
||||
public class FlapType implements Writeable<FlapData>, Batched<FlapData> {
|
||||
@Override
|
||||
public FlapData create() {
|
||||
return new FlapData();
|
||||
|
@ -21,4 +24,9 @@ public class FlapType implements Writeable<FlapData> {
|
|||
public StructWriter<FlapData> getWriter(VecBuffer backing) {
|
||||
return new UnsafeFlapWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<FlapData> getTransformer(IModel model) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue