Modified by: Maythas Wangcharoenwong 20241125
This program takes in scene data and renders out an Image Gallery scene using the corresponding textures provided in the directory.
Since we were initially told to not use any external libraries, I have provided 2 homemade libraries which are not fully tested (which can be implied that there might be some edge cases I know not of.)
The two libraries are provided under ./project_1_image_gallery_builder/lib
lin_alg
: This library provides very basic functionalities that helps with linear algebra and graphics work, it can be used usinglin_alg
namespacesimple_scene
: This library provides basic components for creating a simple scene. Despite its name, it does not provide a scene class. You can use this library usingss
namespace.
The shaders are provided under ./project_1_image_gallery_builder/resources/shader_source
※ Disclaimer: I DO NOT OWN ANY TEXTURES PROVIDED IN THIS PROJECT.
There are two options for running the program.
- Providing your own scene, you can do this by providing 2 arguments as follows:
./<Program> <scene_data_path> <texture_dir>
- Using default scene, simply run:
./<Program>
To create your own, simply do two things.
- Provide a directory with textures you wish to use and add in textures.
For instance:./scene/test_scene_tex
- Provide a file for scene building using the following commands.
- The index of each room will be read in row-major form.
- The file input will behave similar to those of state machines. The value of each temporary variable will stay the same as the previous for every function call until a new value is defined.
- However, there is one exception when defining images, images will always be reset after
build_room
function call. - The image will only get rendered if a wall in that direction exist.
- The image setting function calls are optional.
- However, there is one exception when defining images, images will always be reset after
Commands | Description |
---|---|
# <something> |
These are comments |
dimension <row> <col> |
Setup dimensions of the scene (this must be done as the first thing. |
index <row> <col> |
Room position <row> <col> |
light_on <0 or 1> |
Set light on or off {off: 0, on: 1} |
wall <top> <bottom> <left> <right> |
Set whether a wall exist in the corresponding direction {wall_off: 0, wall_on: 1} |
image_top <filename.type> |
Set the image on top with the corresponding <filename.type> |
image_bottom <filename.type> |
Set the image on bottom with the corresponding <filename.type> |
image_left <filename.type> |
Set the image on left with the corresponding <filename.type> |
image_right <filename.type> |
Set the image on right with the corresponding <filename.type> |
For example scenes, you may use the scenes provided in:
./scene/<scene_name>
and ./test_scene_tex
※ Considering if you are running from visual studio.
Commands | Description |
---|---|
W |
Move forward |
A |
Move left |
S |
Move backwards |
D |
Move right |
esc |
Exit focus mode if focus mode is on, otherwise exit program. |
click on screen |
Enter focus mode. |
mouse movement |
Rotate camera. |
- Focus mode will make your cursor disappear, you can only move or interact when focus mode is on.