mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-01 01:46:39 +01:00
Merge branch 'dev' into shader-pipeline
This commit is contained in:
commit
1e2c6f49eb
21 changed files with 30 additions and 55 deletions
|
@ -16,6 +16,7 @@ indent_size = 2
|
||||||
|
|
||||||
[*.java]
|
[*.java]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
ij_java_else_on_new_line = false
|
||||||
ij_continuation_indent_size = 8
|
ij_continuation_indent_size = 8
|
||||||
ij_java_class_count_to_use_import_on_demand = 99
|
ij_java_class_count_to_use_import_on_demand = 99
|
||||||
ij_java_names_count_to_use_import_on_demand = 99
|
ij_java_names_count_to_use_import_on_demand = 99
|
||||||
|
|
|
@ -45,8 +45,7 @@ public class OptifineHandler {
|
||||||
|
|
||||||
if (optifine == null) {
|
if (optifine == null) {
|
||||||
Backend.log.info("Optifine not detected.");
|
Backend.log.info("Optifine not detected.");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Backend.log.info("Optifine detected.");
|
Backend.log.info("Optifine detected.");
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
|
@ -210,8 +210,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
|
||||||
|
|
||||||
while (filechannel.read(bytebuffer) != -1) {
|
while (filechannel.read(bytebuffer) != -1) {
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
bytebuffer = MemoryUtil.memAlloc(8192);
|
bytebuffer = MemoryUtil.memAlloc(8192);
|
||||||
ReadableByteChannel readablebytechannel = Channels.newChannel(is);
|
ReadableByteChannel readablebytechannel = Channels.newChannel(is);
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,9 @@ public enum GlNumericType {
|
||||||
public void castAndBuffer(ByteBuffer buf, int val) {
|
public void castAndBuffer(ByteBuffer buf, int val) {
|
||||||
if (this == UBYTE || this == BYTE) {
|
if (this == UBYTE || this == BYTE) {
|
||||||
buf.put((byte) val);
|
buf.put((byte) val);
|
||||||
}
|
} else if (this == USHORT || this == SHORT) {
|
||||||
else if (this == USHORT || this == SHORT) {
|
|
||||||
buf.putShort((short) val);
|
buf.putShort((short) val);
|
||||||
}
|
} else if (this == UINT || this == INT) {
|
||||||
else if (this == UINT || this == INT) {
|
|
||||||
buf.putInt(val);
|
buf.putInt(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,7 @@ public class GlBuffer extends GlObject {
|
||||||
public MappedBuffer getBuffer(int offset, int length) {
|
public MappedBuffer getBuffer(int offset, int length) {
|
||||||
if (Backend.getInstance().compat.mapBufferRange != MapBufferRange.UNSUPPORTED) {
|
if (Backend.getInstance().compat.mapBufferRange != MapBufferRange.UNSUPPORTED) {
|
||||||
return new MappedBufferRange(this, offset, length, GL30.GL_MAP_WRITE_BIT);
|
return new MappedBufferRange(this, offset, length, GL30.GL_MAP_WRITE_BIT);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
MappedFullBuffer fullBuffer = new MappedFullBuffer(this, MappedBufferUsage.WRITE_ONLY);
|
MappedFullBuffer fullBuffer = new MappedFullBuffer(this, MappedBufferUsage.WRITE_ONLY);
|
||||||
fullBuffer.position(offset);
|
fullBuffer.position(offset);
|
||||||
return fullBuffer;
|
return fullBuffer;
|
||||||
|
|
|
@ -125,8 +125,7 @@ public abstract class InstanceManager<T> implements MaterialManager.OriginShiftL
|
||||||
removeInternal(obj, instance);
|
removeInternal(obj, instance);
|
||||||
|
|
||||||
createInternal(obj);
|
createInternal(obj);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
instance.update();
|
instance.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,11 +176,9 @@ public abstract class InstanceManager<T> implements MaterialManager.OriginShiftL
|
||||||
|
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
} else if (create && canCreateInstance(obj)) {
|
||||||
else if (create && canCreateInstance(obj)) {
|
|
||||||
return createInternal(obj);
|
return createInternal(obj);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,7 @@ public class ShaderTemplate {
|
||||||
|
|
||||||
if (struct != null) {
|
if (struct != null) {
|
||||||
s = s.replace(name, struct.name);
|
s = s.replace(name, struct.name);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
missing.add(name);
|
missing.add(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,7 @@ public class SourceFile {
|
||||||
if (blockEnd > blockStart) {
|
if (blockEnd > blockStart) {
|
||||||
self = new StringSpan(this, matcher.start(), blockEnd + 1);
|
self = new StringSpan(this, matcher.start(), blockEnd + 1);
|
||||||
body = new StringSpan(this, blockStart, blockEnd);
|
body = new StringSpan(this, blockStart, blockEnd);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self = new ErrorSpan(this, matcher.start(), matcher.end());
|
self = new ErrorSpan(this, matcher.start(), matcher.end());
|
||||||
body = new ErrorSpan(this, blockStart);
|
body = new ErrorSpan(this, blockStart);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,7 @@ public class QuadConverter {
|
||||||
ByteBuffer indices;
|
ByteBuffer indices;
|
||||||
if (bytes > stack.getSize()) {
|
if (bytes > stack.getSize()) {
|
||||||
indices = MemoryUtil.memAlloc(bytes); // not enough space on the preallocated stack
|
indices = MemoryUtil.memAlloc(bytes); // not enough space on the preallocated stack
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
stack.push();
|
stack.push();
|
||||||
indices = stack.malloc(bytes);
|
indices = stack.malloc(bytes);
|
||||||
}
|
}
|
||||||
|
@ -119,8 +118,7 @@ public class QuadConverter {
|
||||||
|
|
||||||
if (bytes > stack.getSize()) {
|
if (bytes > stack.getSize()) {
|
||||||
MemoryUtil.memFree(indices);
|
MemoryUtil.memFree(indices);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,7 @@ public class ConditionalInstance<D extends InstanceData> {
|
||||||
if (shouldShow && instance == null) {
|
if (shouldShow && instance == null) {
|
||||||
instance = model.createInstance();
|
instance = model.createInstance();
|
||||||
if (setupFunc != null) setupFunc.accept(instance);
|
if (setupFunc != null) setupFunc.accept(instance);
|
||||||
}
|
} else if (!shouldShow && instance != null) {
|
||||||
else if (!shouldShow && instance != null) {
|
|
||||||
instance.delete();
|
instance.delete();
|
||||||
instance = null;
|
instance = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,7 @@ public class GroupInstance<D extends InstanceData> extends AbstractCollection<D>
|
||||||
for (int i = size; i < count; i++) {
|
for (int i = size; i < count; i++) {
|
||||||
addInstance();
|
addInstance();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
List<D> unnecessary = backing.subList(count, size);
|
List<D> unnecessary = backing.subList(count, size);
|
||||||
unnecessary.forEach(InstanceData::delete);
|
unnecessary.forEach(InstanceData::delete);
|
||||||
unnecessary.clear();
|
unnecessary.clear();
|
||||||
|
|
|
@ -37,8 +37,7 @@ public class SelectInstance<D extends InstanceData> {
|
||||||
current.delete();
|
current.delete();
|
||||||
current = null;
|
current = null;
|
||||||
}
|
}
|
||||||
}
|
} else if (i != last) {
|
||||||
else if (i != last) {
|
|
||||||
if (current != null) current.delete();
|
if (current != null) current.delete();
|
||||||
|
|
||||||
current = models.get(i)
|
current = models.get(i)
|
||||||
|
|
|
@ -44,8 +44,7 @@ public abstract class BasicData extends InstanceData implements IFlatLight<Basic
|
||||||
if (alpha) {
|
if (alpha) {
|
||||||
byte a = (byte) ((color >> 24) & 0xFF);
|
byte a = (byte) ((color >> 24) & 0xFF);
|
||||||
return setColor(r, g, b, a);
|
return setColor(r, g, b, a);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return setColor(r, g, b);
|
return setColor(r, g, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,7 @@ public class ExtensibleGlProgram extends GlProgram {
|
||||||
list.add(extension);
|
list.add(extension);
|
||||||
}
|
}
|
||||||
this.extensions = list;
|
this.extensions = list;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.extensions = Collections.emptyList();
|
this.extensions = Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,7 @@ public class ForgeEvents {
|
||||||
if (right.size() < 10) {
|
if (right.size() < 10) {
|
||||||
right.add("");
|
right.add("");
|
||||||
right.add(text);
|
right.add(text);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
right.add(9, "");
|
right.add(9, "");
|
||||||
right.add(10, text);
|
right.add(10, text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,8 +150,7 @@ public class LightUpdater {
|
||||||
if (set == null) {
|
if (set == null) {
|
||||||
set = new LongRBTreeSet();
|
set = new LongRBTreeSet();
|
||||||
listeners.put(listener, set);
|
listeners.put(listener, set);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
set.forEach((LongConsumer) l -> {
|
set.forEach((LongConsumer) l -> {
|
||||||
WeakHashSet<ILightUpdateListener> listeningSections = lookup.get(l);
|
WeakHashSet<ILightUpdateListener> listeningSections = lookup.get(l);
|
||||||
|
|
||||||
|
|
|
@ -126,13 +126,11 @@ public class LightVolume {
|
||||||
sampleVolume = newSampleVolume;
|
sampleVolume = newSampleVolume;
|
||||||
|
|
||||||
copyLight(world, newArea);
|
copyLight(world, newArea);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sampleVolume = newSampleVolume;
|
sampleVolume = newSampleVolume;
|
||||||
initialize(world);
|
initialize(world);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setSampleVolume(newSampleVolume);
|
setSampleVolume(newSampleVolume);
|
||||||
int volume = textureVolume.volume();
|
int volume = textureVolume.volume();
|
||||||
if (volume * 2 > lightData.capacity()) {
|
if (volume * 2 > lightData.capacity()) {
|
||||||
|
|
|
@ -55,7 +55,8 @@ public class RenderHooksMixin {
|
||||||
.getProjectionMatrix());
|
.getProjectionMatrix());
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.post(new RenderLayerEvent(world, type, viewProjection, camX, camY, camZ));
|
MinecraftForge.EVENT_BUS.post(new RenderLayerEvent(world, type, viewProjection, camX, camY, camZ));
|
||||||
GL20.glUseProgram(0);
|
|
||||||
|
if (!OptifineHandler.usingShaders()) GL20.glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At("TAIL"), method = "loadRenderers")
|
@Inject(at = @At("TAIL"), method = "loadRenderers")
|
||||||
|
|
|
@ -16,8 +16,7 @@ public class AnimationTickHolder {
|
||||||
if (!Minecraft.getInstance()
|
if (!Minecraft.getInstance()
|
||||||
.isGamePaused()) {
|
.isGamePaused()) {
|
||||||
ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision
|
ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
paused_ticks = (paused_ticks + 1) % 1_728_000;
|
paused_ticks = (paused_ticks + 1) % 1_728_000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,19 +201,15 @@ public class BakedQuadWrapper {
|
||||||
int intOffset = FORMAT.getOffset(elementId) / Integer.BYTES;
|
int intOffset = FORMAT.getOffset(elementId) / Integer.BYTES;
|
||||||
if (element.getUsage() == VertexFormatElement.Usage.POSITION) {
|
if (element.getUsage() == VertexFormatElement.Usage.POSITION) {
|
||||||
position = intOffset;
|
position = intOffset;
|
||||||
}
|
} else if (element.getUsage() == VertexFormatElement.Usage.COLOR) {
|
||||||
else if (element.getUsage() == VertexFormatElement.Usage.COLOR) {
|
|
||||||
color = intOffset;
|
color = intOffset;
|
||||||
}
|
} else if (element.getUsage() == VertexFormatElement.Usage.UV) {
|
||||||
else if (element.getUsage() == VertexFormatElement.Usage.UV) {
|
|
||||||
if (element.getIndex() == 0) {
|
if (element.getIndex() == 0) {
|
||||||
texture = intOffset;
|
texture = intOffset;
|
||||||
}
|
} else if (element.getIndex() == 2) {
|
||||||
else if (element.getIndex() == 2) {
|
|
||||||
light = intOffset;
|
light = intOffset;
|
||||||
}
|
}
|
||||||
}
|
} else if (element.getUsage() == VertexFormatElement.Usage.NORMAL) {
|
||||||
else if (element.getUsage() == VertexFormatElement.Usage.NORMAL) {
|
|
||||||
normal = intOffset;
|
normal = intOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,7 @@ public class CodecUtil {
|
||||||
.xmap(either -> either.map(l -> l, Collections::singletonList), list -> {
|
.xmap(either -> either.map(l -> l, Collections::singletonList), list -> {
|
||||||
if (list.size() == 1) {
|
if (list.size() == 1) {
|
||||||
return Either.right(list.get(0));
|
return Either.right(list.get(0));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return Either.left(list);
|
return Either.left(list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue