By Andrew Adriance
A snowman built with the tool... Frozen is still relevant right?
I've always loved building things, so I decided to make a tool to let me easily do that with openGL. This project let's users define any number of objects as json files, load them up into the editor and build a world out of them. In addition to just placing objects in the world you can also control their rotation, scale, and material.
The first step of data representation was to decide what information would need to persist on disk. I broke this up into three items; things that would represent objects themselves, stuff that would represent a collection of things, and a place that would note the placement of things and their transforms. More on these files can be seen at the end of this section.
Following from that I learned about classes in C++ and created call representations of these files. Each class was also equiped with a read and write function that could translate from class -> json and json -> class. Each class was also outfitted with additional functionality that the GPU would need. For instance things got a draw function that would pass the needed info over to the GPU for rendering.
This phase of the project took the most amount of time. I had to add controls of the user to switch between objects and materials. In addition I had to come up with a control scheme for transforms. All this information had to be managed on the CPU and handed over to the GPU at render time. Each thing would keep a running calculation of it's M matrix as you moved it around the world so that it was easy to pass it along to the GPU at render time.
Figuring out how to position the "cursor" object in the world was interesting, and in the end the look at vectors were utilized so that the cursor object could always float infront of the user.
The final stage was for fine tuning the controls. The initial build of the project was too jumpy to easily place things in the world. The camera would often move to fast, not allowing you to place things at precise locations. Also it took some playing with the tool to come up with a control scheme that made logical sense without a UI.
A blank world with only the cursor
A little scene of a cabin, cursor hidden