World Editor

By Andrew Adriance


A snowman built with the tool... Frozen is still relevant right?

Project Description

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.


Project Controls

External Libraries

jsoncpp

About the Project

The project ended up breaking down into three clean parts for implementation. The first stage was data representation, the second was data manipulation, and finally came the polish stage.

Data Representation

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.

Thing files

Extension: .thing
Use: to define an obj with a name, and the file it points to
Example: { "name": "cube", "obj": "cube.obj" }
Notes: Giving the things a name allows for the .obj to be changed to a different one without having to keep the names the same

Stuff files

Extension: .stuff
Use: to define the things you want to use
Example: { "things" : [ "sphere.thing", "bunny.thing", "cube.thing", "cone.thing" ] }

Place files

Extension: .place
Notes: This generated when saving or loading by the program itself.

Data Manipulation

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.

Polish

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.

Project Screenshots

A blank world with only the cursor


A little scene of a cabin, cursor hidden