mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-29 14:24:58 +01:00
Protect against java versioning
- Cast ByteBuffers to Buffer before calling #rewind or #flip
This commit is contained in:
parent
a2100dc758
commit
126cecd856
4 changed files with 8 additions and 4 deletions
|
@ -5,6 +5,7 @@ import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
|
@ -182,7 +183,7 @@ public class ShaderSources implements ISelectiveResourceReloadListener {
|
||||||
try {
|
try {
|
||||||
bytebuffer = readToBuffer(is);
|
bytebuffer = readToBuffer(is);
|
||||||
int i = bytebuffer.position();
|
int i = bytebuffer.position();
|
||||||
bytebuffer.rewind();
|
((Buffer) bytebuffer).rewind();
|
||||||
return MemoryUtil.memASCII(bytebuffer, i);
|
return MemoryUtil.memASCII(bytebuffer, i);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.jozufozu.flywheel.backend.gl.buffer;
|
package com.jozufozu.flywheel.backend.gl.buffer;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ public class VecBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public VecBuffer rewind() {
|
public VecBuffer rewind() {
|
||||||
internal.rewind();
|
((Buffer) internal).rewind();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.jozufozu.flywheel.backend.instancing;
|
package com.jozufozu.flywheel.backend.instancing;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -137,7 +138,7 @@ public class InstanceMaterial<D extends InstanceData> {
|
||||||
vertices.putFloat(reader.getV(i));
|
vertices.putFloat(reader.getV(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
vertices.rewind();
|
((Buffer) vertices).rewind();
|
||||||
|
|
||||||
// return new BufferedModel(GlPrimitive.QUADS, format, vertices, vertexCount);
|
// return new BufferedModel(GlPrimitive.QUADS, format, vertices, vertexCount);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.jozufozu.flywheel.core;
|
package com.jozufozu.flywheel.core;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
@ -136,7 +137,7 @@ public class QuadConverter {
|
||||||
type.castAndBuffer(indices, i + 2);
|
type.castAndBuffer(indices, i + 2);
|
||||||
type.castAndBuffer(indices, i + 3);
|
type.castAndBuffer(indices, i + 3);
|
||||||
}
|
}
|
||||||
indices.flip();
|
((Buffer) indices).flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GlBuffer getBuffer(GlNumericType type) {
|
private GlBuffer getBuffer(GlNumericType type) {
|
||||||
|
|
Loading…
Reference in a new issue