Skip to content

michaelneuper/cube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cube

A rotating 3D wireframe cube rendered in the terminal using ncurses.

Vertices are projected onto the screen with perspective projection and connected by edges drawn with Bresenham's line algorithm. The cube spins continuously and can be quit with q.

Building

Requires clang and ncurses.

make          # release build
make debug    # debug build with AddressSanitizer and UBSan
make run      # build (debug) and run
make clean    # remove build artefacts

Usage

./bin/cube # or make run

Press q to quit.

Project structure

src/
  main.c      entry point and render loop
  cube.c/h    cube state, projection, rotation, and drawing
  ncdraw.c/h  ncurses drawing primitives (pixel, line)
  debug.h     assertion macros (active only with -DDEBUG)

About

A rotating 3D wireframe cube rendered in the terminal

Topics

Resources

License

Stars

Watchers

Forks

Contributors