Back to object management! Today's goal: Have Game Objects Active Learning: Add more objects (specifics TBD) We put together a "better demo" a while back Let's finish it, but start from our cross-platform framework A note on cross-platform: I *think* I can keep Source.cpp compatible with Windows Just replace it and the old project should work I'll test this Alright, let's get started! Basic object definition from before: Paste in A question: How thoroughly should we be integrated with OpenGL? If we have lots of time: Not very What if we want to switch to Vulkan or DirectX or Metal? What if we want to convert to ray tracing? What we'll actually do: Thoroughly woven together Sorry, but our engine will be a lot simpler this way I do have aspirations for an RTX build Next question: What's an object? A thing in the game (kinda generic) A thing that correlates with a drawing operation (very convenient, maybe less correct) I think we'll go ahead and pick #2 As always, high performance and simple are at odds Our system will be badly adapted to numerous infrequently-used objects We might be able to fix that with a special object type later Storage: Again, we'll be simple! We'll use STL One great thing about STL: We could change the default allocation scheme later Object interface: Some of these we'll do later initialize draw deallocate move? Or should we just move it? physics / cycle (per-timeslice operations) collisions Should encapsulate bounding-box dimensions Should it present a 3D space? Check a point? Thread safety: All drawing will happen in one thread Just to keep our heads screwed on straight It's ok, this thread mostly babysits the GPU Anything that requires a long time is strictly banned! Banned: malloc/new, file i/o, linear searches, copying vertex buffers, etc Allowed: OpenGL operations, copying uniforms, etc Physics and collisions will be in different threads Physics and collisions for an object will be single-threaded Physics and collisions for different objects might be in different threads Alright, can we get this working, real simple? At first: init and draw Never mind delete - it can just crash on close Later... Last thing: Test it on Windows We'll start active learning, but I'll go test it on a Windows machine