Removed Warnings

This commit is contained in:
2026-07-31 10:17:39 +02:00
parent cdcbd92f73
commit 0c5e4ef976
6 changed files with 658 additions and 656 deletions
@@ -146,6 +146,7 @@ public class NewInputTest {
// Font font = fonts.createFont(1F); // Font font = fonts.createFont(1F);
TestModel model = new TestModel(builder.getBytes()); TestModel model = new TestModel(builder.getBytes());
builder.close();
// TestModel[] guiModel = new TestModel[1]; // TestModel[] guiModel = new TestModel[1];
// List<GLDraw> draws = new ObjectArrayList<>(); // List<GLDraw> draws = new ObjectArrayList<>();
// TexturedBuffer buffer = new TexturedBuffer((K, V) -> { // TexturedBuffer buffer = new TexturedBuffer((K, V) -> {
@@ -233,6 +234,7 @@ public class NewInputTest {
builder.pos(-0.5F, -0.5F, 0).tex(0F, 1F).rgba(-1).endVertex(); builder.pos(-0.5F, -0.5F, 0).tex(0F, 1F).rgba(-1).endVertex();
TestModel model = new TestModel(builder.getBytes()); TestModel model = new TestModel(builder.getBytes());
builder.close();
while(!window.shouldClose()) { while(!window.shouldClose()) {
GLFW.glfwPollEvents(); GLFW.glfwPollEvents();
if(window.changed()) { if(window.changed()) {
@@ -68,7 +68,6 @@ public class NewRenderEngineTest {
GraphicsDevice device = window.device(); GraphicsDevice device = window.device();
int size = 512; int size = 512;
int half = size >> 1; int half = size >> 1;
int base = size >> 3;
Drawable drawer = new Drawable(GLTextureFormat.RGBA, size, size); Drawable drawer = new Drawable(GLTextureFormat.RGBA, size, size);
drawer.fill(0, 0, size, size, -1); drawer.fill(0, 0, size, size, -1);
drawer.fill(0, 0, half, half, 255, 0, 0, 255); drawer.fill(0, 0, half, half, 255, 0, 0, 255);
@@ -97,6 +96,7 @@ public class NewRenderEngineTest {
Mesh mesh = device.createMesh(Mesh.builder().layout(layout)); Mesh mesh = device.createMesh(Mesh.builder().layout(layout));
mesh.buffer(0, device.createBuffer(BufferType.ARRAY_BUFFER, BufferState.STATIC_DRAW).bind().set(builder.getBytes()).unbind()); mesh.buffer(0, device.createBuffer(BufferType.ARRAY_BUFFER, BufferState.STATIC_DRAW).bind().set(builder.getBytes()).unbind());
builder.close();
Sampler sampler = device.createSampler(SamplerSettings.builder().sampler(SampleMode.NEAREST).wrap(BorderMode.CLAMP_TO_EDGE).build()); Sampler sampler = device.createSampler(SamplerSettings.builder().sampler(SampleMode.NEAREST).wrap(BorderMode.CLAMP_TO_EDGE).build());
VertexBuffer buffer = device.createBuffer(BufferType.UNIFORM_BUFFER, BufferState.STATIC_DRAW); VertexBuffer buffer = device.createBuffer(BufferType.UNIFORM_BUFFER, BufferState.STATIC_DRAW);
@@ -55,7 +55,7 @@ public class ModelLoader
{ {
if(line.startsWith("{")) if(line.startsWith("{"))
{ {
if(currentName != null) if(currentName != null && buffer != null)
{ {
resultModels.add(new SimpleModelData(currentName, null, buffer.array(), indexes)); resultModels.add(new SimpleModelData(currentName, null, buffer.array(), indexes));
currentName = null; currentName = null;
@@ -70,7 +70,7 @@ public class ModelLoader
buffer = ByteBuffer.allocate(Integer.parseInt(bounds[0]) * 28).order(ByteOrder.nativeOrder()); buffer = ByteBuffer.allocate(Integer.parseInt(bounds[0]) * 28).order(ByteOrder.nativeOrder());
indexes = new int[Integer.parseInt(bounds[1])]; indexes = new int[Integer.parseInt(bounds[1])];
} }
else if(line.startsWith("<")) else if(line.startsWith("<") && buffer != null)
{ {
String[] data = line.substring(1, line.length() - 1).split(" "); String[] data = line.substring(1, line.length() - 1).split(" ");
String[] position = data[0].split(";"); String[] position = data[0].split(";");
@@ -79,7 +79,7 @@ public class ModelLoader
ColorUtils.write(Integer.parseInt(data[1]), true, buffer); ColorUtils.write(Integer.parseInt(data[1]), true, buffer);
buffer.putFloat(Float.parseFloat(normal[0])).putFloat(Float.parseFloat(normal[1])).putFloat(Float.parseFloat(normal[2])); buffer.putFloat(Float.parseFloat(normal[0])).putFloat(Float.parseFloat(normal[1])).putFloat(Float.parseFloat(normal[2]));
} }
else if(line.startsWith("[")) else if(line.startsWith("[") && indexes != null)
{ {
String[] data = line.substring(1, line.length() - 1).split(";"); String[] data = line.substring(1, line.length() - 1).split(";");
for(int j = 0;j<data.length;j++) for(int j = 0;j<data.length;j++)
@@ -88,7 +88,7 @@ public class ModelLoader
} }
} }
} }
if(currentName != null) if(currentName != null && buffer != null)
{ {
resultModels.add(new SimpleModelData(currentName, null, buffer.array(), indexes)); resultModels.add(new SimpleModelData(currentName, null, buffer.array(), indexes));
currentName = null; currentName = null;
@@ -20,7 +20,7 @@ public class BitArray {
int arraySize = arraySize(size * bits); int arraySize = arraySize(size * bits);
if(data == null || data.length != arraySize) { if(data == null || data.length != arraySize) {
this.data = new long[arraySize]; this.data = new long[arraySize];
if(data.length < arraySize) System.arraycopy(data, 0, this.data, 0, Math.min(data.length, arraySize)); if(this.data.length < arraySize) System.arraycopy(data, 0, this.data, 0, Math.min(this.data.length, arraySize));
} }
else this.data = data; else this.data = data;
} }
@@ -185,7 +185,7 @@ public class DynamicDataManager<T>
} }
break; break;
} }
if(bytesAllocated <= 0) continue; if(bytesAllocated <= 0 || start == null || current == null) continue;
byte[] data = new byte[bytesAllocated]; byte[] data = new byte[bytesAllocated];
int byteOffset = start.byteOffset; int byteOffset = start.byteOffset;
bytesAllocated = 0; bytesAllocated = 0;
@@ -294,7 +294,7 @@ public class FixedDataManager
fixed.add(first); fixed.add(first);
continue; continue;
} }
if(last.isNext(slots[i])) if(last != null && last.isNext(slots[i]))
{ {
last = slots[i]; last = slots[i];
fixed.add(last); fixed.add(last);