Editor

Design and initial set up

Me and Jonathan prototyped the design of the editor. We took a lot of inspiration from Unity and tried to copy their default interface with a Hierarchy, Inspector, Scene Window and Asset Viewer.

We wrote the implementation using Dear ImGui and this led to really fast development and iteration of the editor. Our work was later refactored and made to a more stable system by Markus Nilsson.

editor.png

Folder browser and 'Drag and Drop' 

One particularly nice feature was the Asset Viewer and the combination of it with 'Drag and Drop'. 

The implementation was quite easy, it just iterated over a root directory recursively and stored it in a tree structure. However, the result made work a lot easier.

Everything with a texture (mesh textures, particles, UI elements, etc), or a FBX could be drag and dropped in the editor, saving the group a lot of time.

folderDragDrop.gif

Here you can see it used in the changing of a light projection texture (which I implemented and you can read about here). 

Picking

An important feature was accurate picking, since even a small offset or error would essentially make the editor unusable. 

First, we just checked the ray against all the bounding boxes of the meshes and this worked fine in Budhetti, where we didn't have the problem of backfacing triangles.

For the second project however, where there were a lot of roofs and indoor environment, I extended the system to do intersection tests against individual triangles that were not being backface culled, which could be toggled in the editor.

picking.gif
cullNone.gif

Debug Draw

I also wrote the Debug Draw system for our engine. It was implemented as a singleton with simple functions for drawing spheres, rays, bounding boxes (with arbitrary orientations) and camera frustums.

Instanced rendering

The debug drawer used instanced rendering for efficient drawing. Everytime a user called for debug drawing, the data needed for the draw call was added to an array, which was later converted to an instance buffer and rendered.

This allowed for efficient debugging and rendering of thousands of primitives without a significant drop in frame rate. This had been a real problem before the instanced rendering was implemented, for example when debugging the navmesh, which was being draw as several hundreds of spheres connected with rays.

Jonathan later added a filtering system, which allowed for toggling between different debug layers. This made the system a lot easier to use.

Component<T>::UpdateEditor

One of the strongest feature was the integration of our Component system to our editor. If you created a new component and you wanted to be able to edit it in the inspector, all you needed to do was create an UpdateEditor function (non-virtual!) for you class inheriting from Component<T>.

Additional

  • Transform guizmo (together with Jonathan)

  • Directional light guizmo

  • Multiple select

  • Duplicate entity (together with Markus)

  • Copy/paste transform 

  • Editor camera (together with Jonathan)