Metal Demo: Hit Test , Mouse Pick , Shadows

I am a hobbyist programmer and I have been fooling around with Metal. In getting my feet wet in metal I have found that there is a pretty big gap between the HelloTriangle and DeferredLighting sample code from Apple and a more intermediate sample would be helpful. I have stumbled along through the brush and put together a little app that I thought that other novice metal programmers might find interesting.

Features:
  1. Vertex buffer creation in Object Space.

  2. Composing objects into a scene in Model Space.

  3. Transforming a scene in Model Space to Clip Space

  4. Hit Testing / Mouse Picking

  5. Two pass rendering to produce shadows.

I have put the project on GitHub for others to peruse:

github.com/MackenzieBD/Sample-Code/blob/main/MetalDemo.zip

Thank you very much, I am a fresh in metal, Now I have rendered multiple video to a mtkview, videos image may have intersection, How can I do hit test for them to select it. I think it is a 2D operations. Any help will be much appreciated!

6/18/22 Fixed a bug that caused the hit test to fail on Retina Displays.

Metal Demo: Hit Test , Mouse Pick , Shadows
 
 
Q