Where did 9.1 go? My schedule got confused with the re-timetabling last week and it completely slipped my mind. But on to what I’ve been up to.
The demo has been progressing well, working with Neil I got a model loader and asset management system up and running so now all assets are loaded one time only, so that’s a good start. But more importantly we now have the ability to actually display output to a window.
To do this I implemented a (very) basic camera class that allows the player to move the camera forward, backward left and right. I also added some quick and simple code for moving a unit about using the WASD keys, although once we have terrain implemented we will click a position as the units destination and the unit will make its own way there. We are also now able to choose a specific unit using the mouse and and clicking the desired unit. This has been achieved using color picking. To do this I created a simple function that assigned each unit a unique ID as it is created and then this ID is passed into the shader along with the standard display info. The shader then has two outputs one is the standard screen info that is sent to the display and the other is a buffer that holds a version of the view which shows each model as a flat color based on its unique ID. A quick call to glReadPixels using the mouse co-ordinates as a parameter allows us to read the color value at the cursers location which can then be compared to each units ID to select the correct unit.