Closed meshula closed 1 year ago
FWIW, the next thing I want to play with is welding metalRay to Randy Gaul's spritebatch (https://github.com/RandyGaul/cute_headers/blob/master/cute_spritebatch.h), which basically means getting DrawTexture working.
Hi, sorry, just saw your post.
The user input events will come from the MTKView so when you strip it out the future events in metalRay will not work.
btw; I just added SDF text rendering and text size functions.
Awesome! I will give the new text rendering a play. For context, I have a bunch of raylib drawing code for specialized visualization, and the ability to run it under Metal is what attracted me to your work. I have my own event handling already ~ my apps are mostly native Cocoa, so I'm not after a pure raylib port particularly. That's of course not the same as your aim.
Anyway, I wanted to let you know I'm appreciating your effort here, and how I switched it around a bit it for my own needs :)
Ok, got it! :) Honestly I am now moving away from the raylib API as I cannot make it work in metal (rlgl). So better to use my own lol.
Since I was getting some use out of your shape drawing routines, I added them back in to my copy ~ adding one more function (and moving the type argument from endShape to startShape) allows all of them to work just fine :)
func addVertex(_ vertex: float2,_ color: float4) {
vertexData.append(-Float(viewport.viewportSize.x) / 2.0 + vertex.x * viewport.scale)
vertexData.append(Float(viewport.viewportSize.y) / 2.0 - vertex.y * viewport.scale)
vertexData.append(0) // texture coordinate
vertexData.append(0) // texture coordinate
vertexData.append(color.x)
vertexData.append(color.y)
vertexData.append(color.z)
vertexData.append(color.w)
vertexCount += 1
}
(The DearImGui bit is running through my backend, not metalRay, in case you were wondering.)
Also, the way you set up the render-to-texture target in your API is cool.
Nice! Happy you can use some stuff !
Next up is programmable shaders. Just love that you can share C structs between Swift / C and Metal !
Hi, I had a play with your library, adapting to work with my own NSView and engine. In order to make that work, I had to make the Game object agnostic about the View, and instead of pulling data out of an MTKView, I passed in the actual info metalRay needed.
In case you're interested, this is the gist of what I did to adapt metalRay to my own application. Note that I stripped MetalKit entirely, aside from the use of MTKTextureLoader, which is pretty handy. The end result is I can run metalRay as a pass between my 3d rendering and DearImGui, all in the same CommandBuffer.