From 598530c4ecded66a8252a369b3e2300a2b55d597 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 11 Sep 2022 14:23:36 +0700 Subject: [PATCH] specify floatbuffer --- .../kstarbound/client/gl/shader/GLUniformLocation.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLUniformLocation.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLUniformLocation.kt index 1c623705..1e3b41ac 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLUniformLocation.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/client/gl/shader/GLUniformLocation.kt @@ -7,6 +7,7 @@ import ru.dbotthepony.kvector.api.IStruct3f import ru.dbotthepony.kvector.api.IStruct4f import java.nio.ByteBuffer import java.nio.ByteOrder +import java.nio.FloatBuffer class GLUniformLocation(val program: GLShaderProgram, val name: String, val pointer: Int) { fun set(value: IStruct4f): GLUniformLocation { @@ -29,8 +30,8 @@ class GLUniformLocation(val program: GLShaderProgram, val name: String, val poin return this } - private val buff3x3 by lazy { ByteBuffer.allocateDirect(4 * 3 * 3).also { it.order(ByteOrder.nativeOrder()) }.asFloatBuffer() } - private val buff4x4 by lazy { ByteBuffer.allocateDirect(4 * 4 * 4).also { it.order(ByteOrder.nativeOrder()) }.asFloatBuffer() } + private val buff3x3: FloatBuffer by lazy { ByteBuffer.allocateDirect(4 * 3 * 3).also { it.order(ByteOrder.nativeOrder()) }.asFloatBuffer() } + private val buff4x4: FloatBuffer by lazy { ByteBuffer.allocateDirect(4 * 4 * 4).also { it.order(ByteOrder.nativeOrder()) }.asFloatBuffer() } fun set(value: IFloatMatrix<*>): GLUniformLocation { program.state.ensureSameThread()