specify floatbuffer

This commit is contained in:
DBotThePony 2022-09-11 14:23:36 +07:00
parent 2cb2ac16ce
commit 598530c4ec
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -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()