Reformat backend
This commit is contained in:
parent
d9b04138df
commit
322496f3b4
66 changed files with 2537 additions and 2539 deletions
|
@ -9,7 +9,6 @@ import org.lwjgl.opengl.GL;
|
|||
import org.lwjgl.opengl.GLCapabilities;
|
||||
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.render.backend.gl.GlFog;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.GlProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.IMultiProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec;
|
||||
|
|
|
@ -2,24 +2,17 @@ package com.simibubi.create.foundation.render.backend;
|
|||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||
import com.simibubi.create.foundation.render.KineticRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FastRenderDispatcher {
|
||||
|
|
|
@ -23,6 +23,7 @@ public class OptifineHandler {
|
|||
|
||||
/**
|
||||
* Get information about the current Optifine configuration.
|
||||
*
|
||||
* @return {@link Optional#empty()} if Optifine is not installed.
|
||||
*/
|
||||
public static Optional<OptifineHandler> get() {
|
||||
|
|
|
@ -28,14 +28,14 @@ import org.lwjgl.system.MemoryUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.foundation.render.backend.gl.GlFogMode;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.SingleProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.FogSensitiveProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.GlProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.GlShader;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.FogSensitiveProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.IMultiProgram;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.ShaderConstants;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.ShaderType;
|
||||
import com.simibubi.create.foundation.render.backend.gl.shader.SingleProgram;
|
||||
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
|
@ -206,7 +206,8 @@ public class ShaderLoader {
|
|||
FileChannel filechannel = fileinputstream.getChannel();
|
||||
bytebuffer = MemoryUtil.memAlloc((int) filechannel.size() + 1);
|
||||
|
||||
while (filechannel.read(bytebuffer) != -1) { }
|
||||
while (filechannel.read(bytebuffer) != -1) {
|
||||
}
|
||||
} else {
|
||||
bytebuffer = MemoryUtil.memAlloc(8192);
|
||||
ReadableByteChannel readablebytechannel = Channels.newChannel(is);
|
||||
|
|
|
@ -5,8 +5,9 @@ import com.simibubi.create.foundation.render.backend.instancing.InstanceData;
|
|||
/**
|
||||
* An interface that implementors of {@link InstanceData} should also implement
|
||||
* if they wish to make use of Flywheel's provided light update methods.
|
||||
*
|
||||
* <p>
|
||||
* This only covers flat lighting, smooth lighting is still TODO.
|
||||
*
|
||||
* @param <D> The name of the class that implements this interface.
|
||||
*/
|
||||
public interface IFlatLight<D extends InstanceData & IFlatLight<D>> {
|
||||
|
|
|
@ -32,6 +32,7 @@ public abstract class GlProgram extends GlObject {
|
|||
|
||||
/**
|
||||
* Retrieves the index of the uniform with the given name.
|
||||
*
|
||||
* @param uniform The name of the uniform to find the index of
|
||||
* @return The uniform's index
|
||||
*/
|
||||
|
@ -47,6 +48,7 @@ public abstract class GlProgram extends GlObject {
|
|||
|
||||
/**
|
||||
* Binds a sampler uniform to the given texture unit.
|
||||
*
|
||||
* @param name The name of the sampler uniform.
|
||||
* @param binding The index of the texture unit.
|
||||
* @return The sampler uniform's index.
|
||||
|
|
|
@ -10,6 +10,7 @@ public interface IMultiProgram<P extends GlProgram> {
|
|||
|
||||
/**
|
||||
* Get the shader program most suited for the current game state.
|
||||
*
|
||||
* @return The one true program.
|
||||
*/
|
||||
P get();
|
||||
|
|
|
@ -49,9 +49,7 @@ public enum DrawInstanced implements GlVersioned {
|
|||
public void drawArraysInstanced(int mode, int first, int count, int primcount) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
public abstract void drawArraysInstanced(int mode, int first, int count, int primcount);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.lwjgl.system.MemoryUtil;
|
|||
/**
|
||||
* An instance of this class stores information
|
||||
* about what OpenGL features are available.
|
||||
*
|
||||
* <p>
|
||||
* Each field stores an enum variant that provides access to the
|
||||
* most appropriate version of a feature for the current system.
|
||||
*/
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.lwjgl.opengl.GLCapabilities;
|
|||
public interface GlVersioned {
|
||||
/**
|
||||
* Queries whether this variant is supported by the current system.
|
||||
*
|
||||
* @param caps The {@link GLCapabilities} reported by the current system.
|
||||
* @return <code>true</code> if this variant is supported, or if this is the last defined variant.
|
||||
*/
|
||||
|
|
|
@ -37,9 +37,7 @@ public enum InstancedArrays implements GlVersioned {
|
|||
public void vertexAttribDivisor(int index, int divisor) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
public abstract void vertexAttribDivisor(int index, int divisor);
|
||||
}
|
||||
|
|
|
@ -67,11 +67,11 @@ public enum RGPixelFormat implements GlVersioned {
|
|||
public int byteCount() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
public abstract int internalFormat();
|
||||
|
||||
public abstract int format();
|
||||
|
||||
public abstract int byteCount();
|
||||
}
|
||||
|
|
|
@ -67,9 +67,7 @@ public enum VertexArrayObject implements GlVersioned {
|
|||
public void deleteVertexArrays(int array) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
|
||||
public abstract int genVertexArrays();
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ public class RenderMaterial<P extends BasicProgram, MODEL extends InstancedModel
|
|||
teardown();
|
||||
}
|
||||
|
||||
public void teardown() {}
|
||||
public void teardown() {
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
runOnAll(InstancedModel::delete);
|
||||
|
|
|
@ -54,14 +54,16 @@ public abstract class TileEntityInstance<T extends TileEntity> implements IInsta
|
|||
*
|
||||
* <br><br> If your animations are complex or more CPU driven, see {@link IDynamicInstance} or {@link ITickableInstance}.
|
||||
*/
|
||||
protected void update() { }
|
||||
protected void update() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after construction and when a light update occurs in the world.
|
||||
*
|
||||
* <br> If your model needs it, update light here.
|
||||
*/
|
||||
public void updateLight() { }
|
||||
public void updateLight() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Free any acquired resources.
|
||||
|
|
|
@ -30,7 +30,6 @@ public class InstanceGroup<D extends InstanceData> extends AbstractCollection<D>
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param count
|
||||
* @return True if the number of elements changed.
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public class LightUpdater {
|
|||
|
||||
/**
|
||||
* Add a listener associated with the given {@link BlockPos}.
|
||||
*
|
||||
* <p>
|
||||
* When a light update occurs in the chunk the position is contained in,
|
||||
* {@link LightUpdateListener#onLightUpdate} will be called.
|
||||
*
|
||||
|
@ -71,7 +71,7 @@ public class LightUpdater {
|
|||
|
||||
/**
|
||||
* Add a listener associated with the given {@link GridAlignedBB}.
|
||||
*
|
||||
* <p>
|
||||
* When a light update occurs in any chunk spanning the given volume,
|
||||
* {@link LightUpdateListener#onLightUpdate} will be called.
|
||||
*
|
||||
|
|
|
@ -170,6 +170,7 @@ public class LightVolume {
|
|||
|
||||
/**
|
||||
* Copy block light from the world into this volume.
|
||||
*
|
||||
* @param worldVolume the region in the world to copy data from.
|
||||
*/
|
||||
public void copyBlock(IBlockDisplayReader world, GridAlignedBB worldVolume) {
|
||||
|
@ -192,6 +193,7 @@ public class LightVolume {
|
|||
|
||||
/**
|
||||
* Copy sky light from the world into this volume.
|
||||
*
|
||||
* @param worldVolume the region in the world to copy data from.
|
||||
*/
|
||||
public void copySky(IBlockDisplayReader world, GridAlignedBB worldVolume) {
|
||||
|
@ -214,6 +216,7 @@ public class LightVolume {
|
|||
|
||||
/**
|
||||
* Copy all light from the world into this volume.
|
||||
*
|
||||
* @param worldVolume the region in the world to copy data from.
|
||||
*/
|
||||
public void copyLight(IBlockDisplayReader world, GridAlignedBB worldVolume) {
|
||||
|
|
Loading…
Reference in a new issue