mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-27 13:28:00 +01:00
Shader sanity branch cleanup
- Disable FlwContraption rendering while using batching engine - Bump flywheel build/version
This commit is contained in:
parent
d3bbeb5a7a
commit
6fd1e2cc63
3 changed files with 25 additions and 29 deletions
|
@ -19,7 +19,7 @@ parchment_version = 2021.12.19
|
||||||
|
|
||||||
# dependency versions
|
# dependency versions
|
||||||
registrate_version = MC1.18-1.0.21
|
registrate_version = MC1.18-1.0.21
|
||||||
flywheel_version = 1.18-0.5.1.46
|
flywheel_version = 1.18-0.6.0.48
|
||||||
jei_minecraft_version = 1.18
|
jei_minecraft_version = 1.18
|
||||||
jei_version = 9.0.0.40
|
jei_version = 9.0.0.40
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.RenderLayer;
|
import com.jozufozu.flywheel.backend.RenderLayer;
|
||||||
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
|
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
|
||||||
import com.jozufozu.flywheel.backend.gl.GlTextureUnit;
|
import com.jozufozu.flywheel.backend.gl.GlTextureUnit;
|
||||||
import com.jozufozu.flywheel.backend.gl.GlVertexArray;
|
import com.jozufozu.flywheel.config.FlwEngine;
|
||||||
import com.jozufozu.flywheel.core.Formats;
|
import com.jozufozu.flywheel.core.Formats;
|
||||||
import com.jozufozu.flywheel.core.Materials;
|
import com.jozufozu.flywheel.core.Materials;
|
||||||
import com.jozufozu.flywheel.core.compile.ProgramContext;
|
import com.jozufozu.flywheel.core.compile.ProgramContext;
|
||||||
|
@ -17,7 +17,6 @@ import com.jozufozu.flywheel.util.Textures;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||||
import com.simibubi.create.foundation.render.CreateContexts;
|
import com.simibubi.create.foundation.render.CreateContexts;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
|
|
||||||
public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContraption> {
|
public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContraption> {
|
||||||
|
@ -44,32 +43,13 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
|
||||||
GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
|
GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
|
||||||
GlTextureUnit active = GlTextureUnit.getActive();
|
GlTextureUnit active = GlTextureUnit.getActive();
|
||||||
|
|
||||||
RenderType type = event.getType();
|
if (Backend.getEngine() != FlwEngine.BATCHING) {
|
||||||
|
renderStructures(event);
|
||||||
type.setupRenderState();
|
|
||||||
|
|
||||||
Textures.bindActiveTextures();
|
|
||||||
|
|
||||||
ContraptionProgram structureShader = CreateContexts.STRUCTURE.getProgram(ProgramContext.create(Materials.Names.PASSTHRU, Formats.BLOCK, RenderLayer.getLayer(type)));
|
|
||||||
|
|
||||||
structureShader.bind();
|
|
||||||
structureShader.uploadViewProjection(event.viewProjection);
|
|
||||||
structureShader.uploadCameraPos(event.camX, event.camY, event.camZ);
|
|
||||||
|
|
||||||
for (FlwContraption flwContraption : visible) {
|
|
||||||
flwContraption.renderStructureLayer(type, structureShader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreState.restore();
|
if (event.getLayer() != null) {
|
||||||
layer.setupRenderState();
|
for (FlwContraption renderer : visible) {
|
||||||
|
renderer.renderInstanceLayer(event);
|
||||||
if (Backend.isOn()) {
|
|
||||||
RenderLayer renderLayer = event.getLayer();
|
|
||||||
if (renderLayer != null) {
|
|
||||||
|
|
||||||
for (FlwContraption renderer : visible) {
|
|
||||||
renderer.renderInstanceLayer(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +57,27 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
|
||||||
GlTextureUnit.T4.makeActive();
|
GlTextureUnit.T4.makeActive();
|
||||||
glBindTexture(GL_TEXTURE_3D, 0);
|
glBindTexture(GL_TEXTURE_3D, 0);
|
||||||
|
|
||||||
type.clearRenderState();
|
event.type.clearRenderState();
|
||||||
active.makeActive();
|
active.makeActive();
|
||||||
restoreState.restore();
|
restoreState.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderStructures(RenderLayerEvent event) {
|
||||||
|
|
||||||
|
event.type.setupRenderState();
|
||||||
|
Textures.bindActiveTextures();
|
||||||
|
|
||||||
|
ContraptionProgram structureShader = CreateContexts.STRUCTURE.getProgram(ProgramContext.create(Materials.Names.PASSTHRU, Formats.BLOCK, RenderLayer.getLayer(event.type)));
|
||||||
|
|
||||||
|
structureShader.bind();
|
||||||
|
structureShader.uploadViewProjection(event.viewProjection);
|
||||||
|
structureShader.uploadCameraPos(event.camX, event.camY, event.camZ);
|
||||||
|
|
||||||
|
for (FlwContraption flwContraption : visible) {
|
||||||
|
flwContraption.renderStructureLayer(event.type, structureShader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FlwContraption create(Contraption c) {
|
protected FlwContraption create(Contraption c) {
|
||||||
VirtualRenderWorld renderWorld = ContraptionRenderDispatcher.setupRenderWorld(world, c);
|
VirtualRenderWorld renderWorld = ContraptionRenderDispatcher.setupRenderWorld(world, c);
|
||||||
|
|
|
@ -32,6 +32,6 @@ Technology that empowers the player.'''
|
||||||
[[dependencies.create]]
|
[[dependencies.create]]
|
||||||
modId="flywheel"
|
modId="flywheel"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[1.18-0.5.1,1.18-0.5.2)"
|
versionRange="[1.18-0.6.0,1.18-0.6.1)"
|
||||||
ordering="AFTER"
|
ordering="AFTER"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
Loading…
Reference in a new issue