This is my implementation of a graphics engine for Stuyvesant High School's MKS66 Computer Graphics course. Everything is written from scratch in C++.
- Custom vector and matrix math
- Stack-based structure for relative coordinate systems
- Polygon drawing and rendering for boxes, spheres, toruses
- Phong reflection model for lighting
- Bezier and hermite curves
- Mesh support for .obj files
- Animation
- Custom/multiple lighting
Insert commands into script per line
Valid commands:
sphere [x] [y] [z] [r]| render sphere centered at (x,y,z) with radius rtorus [x] [y] [z] [r] [R]| render torus centered at (x,y,z) with thickness r and distance R from centerbox [x0] [y0] [z0] [h] [w] [d]| render box with one corner (x0,y0,z0) and height h, width w, depth dpush| add new coordinate systempop| leave current coord system and go to previous coordinate systemclear| clears screendisplay| displays using ImageMagicksave [filename]| saves image as pngrotate [x/y/z] [deg]| rotates coordinate system by deg degrees in either x, y, or z axisscale [a] [b] [c]| scales each axis by a, b, cmove [dx] [dy] [dz]| translates coordinate system by dx, dy, dz in x,y,z directions
To run the script, run make in terminal
Note for WSL, imagemagick might be janky, I used XMing (make sure to run export DISPLAY=localhost:0 before each session)