edwinRNDR
10/16/2018, 3:51 PMedwinRNDR
10/16/2018, 3:54 PMelect
10/16/2018, 3:54 PMedwinRNDR
10/16/2018, 4:34 PMedwinRNDR
10/16/2018, 4:55 PMBurkhard
10/17/2018, 10:16 AMelect
10/17/2018, 10:26 AMBurkhard
10/17/2018, 10:27 AMelect
10/17/2018, 10:28 AMelect
10/17/2018, 10:29 AMelect
10/17/2018, 10:29 AMelect
10/17/2018, 10:30 AMelect
10/17/2018, 10:39 AMelect
10/17/2018, 10:40 AMBurkhard
10/17/2018, 10:45 AMval vec = Vec3(1f, 1f, 1f)
vec to someBuffer // works because the annotation processor generated the function
val toBuff = vec as toBuffer
toBuff to someBuffer // how do we resolve this function call. if we generate to, then we can't use it from the interface
elect
10/17/2018, 10:47 AMBurkhard
10/17/2018, 10:49 AMto
function? It’s just convenient I guess.elect
10/17/2018, 10:49 AMval toBuff = vec as toBuffer
Burkhard
10/17/2018, 10:50 AMBurkhard
10/17/2018, 10:51 AMfun serialize(target: ByteBuffer, varargs elements: ToBuffer) {
for(e in elements) {
e to target
target.pos += e.size
}
}
elect
10/17/2018, 10:52 AMelect
10/17/2018, 10:54 AMto
be resolved and called the consequent implementation on the i-th element?Burkhard
10/17/2018, 10:57 AMto
function for each subtype of ToBuffer
. Then we can not generate a to
that is part of the interface, because we need to generate an extension function. We could call the generated function toByteBuffer
. Now we need to somehow map our to
function in the interface to the generated toByteBuffer
.elect
10/18/2018, 7:35 AMtoBuffer
interface is to always provide a bunch of methods to pack stuff into native memory. We dont need to generate anything for that, it will be already provided.elect
10/18/2018, 7:41 AM@Native
object ubo {
val view = Mat4() // : toBuffer
val lightPos = Vec4() // : toBuffer
var shininess = 0.5f
}
The first two fields implements toBuffer
, the annotation will have simply to add an extension like:
val ubo.size get() = ...
fun ubo.toByteBufferStack(): ByteBuffer {
val buf = stackGet().malloc(size)
var ofs = 0
<http://view.to|view.to>(buf, ofs)
ofs += Mat4.size
<http://lightPos.to|lightPos.to>(buf, ofs)
ofs += Vec4.size
buf.putFloat(ofs, shininess)
return buf
}
elect
10/18/2018, 7:56 AM@std140
edwinRNDR
10/18/2018, 8:07 AMelect
10/18/2018, 8:15 AMedwinRNDR
10/18/2018, 8:22 AM