Jeremy Billote - CSC471 Final Project
Implement a world builder that allows users to place objects/meshes in the world as they see fit and allow
to save/load scenes.
Unless a world file is provided, the user is initially presented with an empty world. Regardless of the
initial world, the user can freely move around the scene and place objects. Objects can be translated and
rotated along/about any axis via keyboard. This allows for fine changes in position/rotation. The world can
also be saved to load later.
final_project <Path to resources directory> <OPTIONAL: World file to load>
World File Format
World files are plaintext and contain the following information in this order:
- Object type (int from 0-4)
- Position X
- Position Y
- Position Z
- Rotation X
- Rotation Y
- Rotation Z
- Material (int from 0-6)
The program does not validate world file structure; it just expects the data in this order.
- Mouse scroll (ie two-finger on laptop) - Rotate camera
- W - Move camera forward
- S - Move camera backward
- A - Move camera to the left
- D - Move camera to the right
- Q, E - Rotate selected object along Y-axis
- R, T - Rotate selected object along X-axis
- Y, U - Rotate selected object along Z-axis
- Z, X - Cycle between available materials
- C, V - Cycle between available objects/meshes
- M - Toggle editor/build mode
In editor/build mode, the current selected object is visible and can be modified.
Outside of editor/build mode, keybinds controlling rotation or selected material or object/mesh do
not do anything.
- Ctrl + S - Save current world
World is saved as
world.dat in the same directory as the executable.
- C++ Features
- File I/O
Similar to C, file I/O uses similar functions to standard I/O. The
contains functions that are similar to
- String Parsing
sstream library allows string parsing similar to Java's
class by using functions similar to
- Hierarchical Modeling
While adding the snowman to the list of possible objects for placement, hierarchical modeling
concepts were reinforced. Since I built the snowman from the bottom up, adding transforms to the
bottom ball of the snowman's body also applied to the rest of the snowman, keeping the snowman's
appearance in tact after any transformations.
- 3D Camera
I found the hardest part of this project to be figuring out how to get the currently selected object
to be centered on the screen, regardless of camera position/orientation. To solve this, I had to
glm::lookAt worked and had to fiddle with it until I got the desired effect.
.obj files contain texture coordinates, denoted as
that these were automatically loaded by
shape.cpp. I had to cut this out of
shape.cpp since the GLSL compiler would complain and crash when trying to render
World built for in-class demo
Bunny mesh used (editor mode)
Sword mesh imported from Final Fantasy XIV (editor mode)
Sphere mesh used (editor mode)
Cube mesh used (editor mode)
Hierarchically-built snowman used (editor mode)