JuliaWGPU / WGPUgfx.jl

WGPU graphics library julia
MIT License
8 stars 4 forks source link

Better event capture for uiCircleCaptureExample.jl #27

Closed ut112002 closed 8 months ago

ut112002 commented 8 months ago

@VarLad and I found a better way to tackle the example

please take a look.

arhik commented 8 months ago

Yes. Snappier than earlier version.

ut112002 commented 8 months ago

@arhik now we are trying to make the circle move , unfortunately changing the vertex data does not move it.

what would be the best way to move the circle without creating new objects.

arhik commented 8 months ago

object.uniformData = translate([sin(time()), 0.4, 0.0]).linear in your example works. you might have to switch to PollEvents.

arhik commented 8 months ago

Also in case you want to track mouse. Our window size is hardcoded to (500, 500). You will have to do this. with y and x flipped and negated.

(y, x) = 2.0.*(mouseState.prevPosition./500.0 .- 0.5) object = mouseState.leftClick ? renderer.scene.objects[2] : renderer.scene.objects[1] object.uniformData = translate([x, -y, 0.0]).linear