mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
comment
This commit is contained in:
@@ -17,7 +17,7 @@ uniform sampler2D u_texture;
|
|||||||
|
|
||||||
|
|
||||||
uniform vec2 screenDimension;
|
uniform vec2 screenDimension;
|
||||||
uniform vec2 tilesInAxes; // basically a screen dimension; vec2(tiles_in_horizontal, tiles_in_vertical)
|
uniform vec2 tilesInAxes; // size of the tilemap texture; vec2(tiles_in_horizontal, tiles_in_vertical)
|
||||||
|
|
||||||
uniform sampler2D tilemap; // RGBA8888
|
uniform sampler2D tilemap; // RGBA8888
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,16 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
|||||||
|
|
||||||
// NOTE: get/set multibyte values are NOT BYTE-ALIGNED!
|
// NOTE: get/set multibyte values are NOT BYTE-ALIGNED!
|
||||||
|
|
||||||
|
fun getDouble(index: Long): Double {
|
||||||
|
checkNullPtr(index)
|
||||||
|
return UnsafeHelper.unsafe.getDouble(ptr + index)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getLong(index: Long): Long {
|
||||||
|
checkNullPtr(index)
|
||||||
|
return UnsafeHelper.unsafe.getLong(ptr + index)
|
||||||
|
}
|
||||||
|
|
||||||
fun getFloat(index: Long): Float {
|
fun getFloat(index: Long): Float {
|
||||||
checkNullPtr(index)
|
checkNullPtr(index)
|
||||||
return UnsafeHelper.unsafe.getFloat(ptr + index)
|
return UnsafeHelper.unsafe.getFloat(ptr + index)
|
||||||
@@ -114,6 +124,28 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
|||||||
return UnsafeHelper.unsafe.getInt(ptr + index)
|
return UnsafeHelper.unsafe.getInt(ptr + index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getShort(index: Long): Short {
|
||||||
|
checkNullPtr(index)
|
||||||
|
return UnsafeHelper.unsafe.getShort(ptr + index)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getChar(index: Long): Char {
|
||||||
|
checkNullPtr(index)
|
||||||
|
return UnsafeHelper.unsafe.getChar(ptr + index)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun setDouble(index: Long, value: Double) {
|
||||||
|
checkNullPtr(index)
|
||||||
|
UnsafeHelper.unsafe.putDouble(ptr + index, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setLong(index: Long, value: Long) {
|
||||||
|
checkNullPtr(index)
|
||||||
|
UnsafeHelper.unsafe.putLong(ptr + index, value)
|
||||||
|
}
|
||||||
|
|
||||||
fun setFloat(index: Long, value: Float) {
|
fun setFloat(index: Long, value: Float) {
|
||||||
checkNullPtr(index)
|
checkNullPtr(index)
|
||||||
UnsafeHelper.unsafe.putFloat(ptr + index, value)
|
UnsafeHelper.unsafe.putFloat(ptr + index, value)
|
||||||
@@ -124,6 +156,18 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
|||||||
UnsafeHelper.unsafe.putInt(ptr + index, value)
|
UnsafeHelper.unsafe.putInt(ptr + index, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setShort(index: Long, value: Short) {
|
||||||
|
checkNullPtr(index)
|
||||||
|
UnsafeHelper.unsafe.putShort(ptr + index, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setChar(index: Long, value: Char) {
|
||||||
|
checkNullPtr(index)
|
||||||
|
UnsafeHelper.unsafe.putChar(ptr + index, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun fillWith(byte: Byte) {
|
fun fillWith(byte: Byte) {
|
||||||
UnsafeHelper.unsafe.setMemory(ptr, size, byte)
|
UnsafeHelper.unsafe.setMemory(ptr, size, byte)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user