Adam S
04/21/2023, 1:38 PMModel model = LoadModel("resources/model.obj")
Texture2D texture = LoadTexture("resources/texture.png");
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
I can get close, but for some reason the generated cinterop Kotlin code has texture as a val
, not a var
val model: CValue<Model> = LoadModel("resources/model.obj")
val texture: CValue<Texture> = LoadTexture("resources/texture.png")
model.useContents {
// model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture
materials!![0].maps!![MATERIAL_MAP_DIFFUSE].texture = texture // ERROR val cannot be reassigned
}
any hints are appreciated!Adam S
04/21/2023, 1:38 PMvbsteven
04/21/2023, 2:16 PM.texture
is? when you have over it?Adam S
04/21/2023, 2:20 PMAdam S
04/21/2023, 2:20 PMclass Texture(rawPtr: kotlinx.cinterop.NativePtr) : CStructVar
Oleg Yukhnevich
04/21/2023, 2:44 PMLandry Norris
04/21/2023, 7:18 PMAdam S
04/22/2023, 8:15 AMso you can just copy the relevant fields (or memset if you feel like being efficient, but dangerous)how? :) The problem is that
texture
is a val
Adam S
04/22/2023, 9:51 AMval model: CValue<Model> = LoadModel("resources/model.obj")
val texture: CValue<Texture> = LoadTexture("resources/texture.png")
model.useContents {
texture.place(materials!![0].maps!![MATERIAL_MAP_DIFFUSE].texture.ptr)
}