Extension of pixel for rendering 3D obj files. (Pure C++, no libraries, and appropriate use of the STL)
- Triangulate the mesh. This program can only handle triangles.
- Run the program
- Enter the address of your obj file or drag it onto the text area.
- Press S with an axis key (X,Y,Z) for scaling. Hold LShift to reverse the scale transform.
- Press R with an axis key for rotation.
- Use O and P together to toggle orthographic / perspective mode (Disclaimer: Rendering a rotated mesh is broken in perspective mode)
- Scroll to transform mesh along Z (depth) axis. (Effect is obviously apparent only in perspective view)
- Use K, L to change the field of view in perspective view
chmod a+x give_me_exec.sh
mkdir build
cd build
cmake ..
cmake --build .
./give_me_exec.sh
(Each face is rendered as two triangles. Adjacent faces have shared double edges.)
High poly objects don't render properly because of the glitchy drawLine function in include/A1/application3D.h
. Time complexity is nlogn, for n as the number of polygons. Triangles, actually, cause this program only works with triangles, and not with quads or anything else. This can be improved to linear time by adding a depth byte to each pixel instead of sorting the entire mesh before each frame.
Update: Random lines in render has now been fixed with a new algorithm for drawing lines.