Skip to content

Commit

Permalink
Merge pull request #7 from wojciech-graj/v1.1
Browse files Browse the repository at this point in the history
Release v1.1
  • Loading branch information
wojciech-graj committed Jan 30, 2022
2 parents af01b6b + 7c7d4bb commit 1de60a5
Show file tree
Hide file tree
Showing 17 changed files with 500 additions and 205 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
SRC = src/termgl.c
DEMO = test/termgl_test.c
DEMO = demodir/termgl_demo.c
LIB_BIN = lib/libtermgl.so
DEMO_BIN = demo
WARNINGS := -Wall -Wextra -Wpedantic -Wdouble-promotion -Wstrict-prototypes -Wshadow -Wduplicated-cond -Wduplicated-branches -Wjump-misses-init -Wnull-dereference -Wrestrict -Wlogical-op -Wno-maybe-uninitialized -Walloc-zero -Wformat-security -Wformat-signedness -Winit-self -Wlogical-op -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wswitch-enum -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-discarded-qualifiers
CFLAGS += -std=c11 -march=native
CFLAGS += -std=c99 -march=native
LINK_CFLAGS := -Ilib -lm
RELEASE_CFLAGS := -O3

Expand All @@ -10,6 +12,9 @@ COMPILER = gcc
endif

shared:
$(COMPILER) -c $(SRC) -shared -o lib/libtermgl.so $(WARNINGS) $(CFLAGS) $(LINK_CFLAGS) $(RELEASE_CFLAGS) -fPIC
$(COMPILER) -c $(SRC) -shared -o $(LIB_BIN) $(WARNINGS) $(CFLAGS) $(LINK_CFLAGS) $(RELEASE_CFLAGS) -fPIC
demo:
$(COMPILER) $(SRC) $(DEMO) -o demo $(WARNINGS) $(CFLAGS) $(LINK_CFLAGS) $(RELEASE_CFLAGS) -DTERMGL3D -DTERMGLUTIL
$(COMPILER) $(SRC) $(DEMO) -o $(DEMO_BIN) $(WARNINGS) $(CFLAGS) $(LINK_CFLAGS) $(RELEASE_CFLAGS) -DTERMGL3D -DTERMGLUTIL
clean:
rm -f $(DEMO_BIN)
rm -f $(LIB_BIN)
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
A terminal-based graphics library for both 2D and 3D graphics.\
Works in all terminals supporting ANSI escape codes.\
Support for Windows and UNIX.\
C11 compliant, with no external dependencies.\
Can read from terminal for user-interaction.
C99 compliant, with no external dependencies.\
Realtime input reading from terminal for user-interaction.

## Table of Contents

Expand All @@ -16,11 +16,11 @@ Can read from terminal for user-interaction.

## Gallery

![LOGO](test/logo.gif)
![LOGO](demodir/logo.gif)

![CANYON](test/canyon.gif)
![CANYON](demodir/canyon.gif)

![TEAPOT](test/teapot.gif)
![TEAPOT](demodir/teapot.gif)

## Build

Expand Down Expand Up @@ -57,12 +57,36 @@ If compiling using mingw on linux, use ```COMPILER=i686-w64-mingw32-gcc-win32```

### Demo

To compile a demo program, run the makefile ```make demo```. Use the ```a``` and ```d``` keys to rotate view in the demo.
To compile a demo program, run the makefile ```make demo```.

## Documentation

Certain settings can be changed at the top of [lib/termgl.h](lib/termgl.h) prior to compilation, e.g. memory allocation functions, clear screen command, compiler-specific commands.\
A sample program exists here: [test/termgl_test.c](test/termgl_test.c), and utilizes all major features of the TermGL library.\
The header file [lib/termgl.h](lib/termgl.h) contains brief documentation for all functions and structs.\
Compiler-specific (GCC) macros are used for loop unrolling in the ```itgl_mulmat``` and ```itgl_clip_triangle_plane``` functions.\
The TermGLUtil extension contains functions for reading keyboard input, but requires either Windows of UNIX headers.

### Demo

A demo can be found here: [demodir/termgl_demo.c](demodir/termgl_demo.c).\
Available demos and TermGL features used:
1. Utah Teapot\
Renders a rotating 3D Utah Teapot.
- Backface culling
- Z buffering
- Double-width characters
- 3D camera
- 3D transformations
- 3D rendering
- 3D Shaders
2. Star Polygon\
Renders a star polygon in steps using random colors.
- Colors
- Line rendering
3. Mandelbrot\
Renders an infinitely zooming-in Mandelbrot set.
- Point rendering
4. Realtime Keyboard\
Displays keyboard input in realtime.
- Text rendering
- Realtime keyboard input
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit 1de60a5

Please sign in to comment.