#3d #mesh-generation #gamedev #library #c #utilities #libraries

Philip Rideout 72221136b5 Rework par_shaders into par_string_blocks. 6 lat temu
test 72221136b5 Rework par_shaders into par_string_blocks. 6 lat temu
tools 59a9dadc9c Repair travis. 6 lat temu
.gitignore 57c8093f36 Streamlines fixes. 6 lat temu
.travis.yml 5d33517bd8 Disable uncrustify. 6 lat temu
README.md 72221136b5 Rework par_shaders into par_string_blocks. 6 lat temu
par_bluenoise.h ca16a754a1 Include full license text in headers. 6 lat temu
par_bubbles.h 4e9236f360 Better error reporting. 6 lat temu
par_camera_control.h 6a62d182df Remove unused codelines. 6 lat temu
par_easings.h ca16a754a1 Include full license text in headers. 6 lat temu
par_easycurl.h 30f2c72cbf Upgrade uncrustify. 6 lat temu
par_filecache.h 30f2c72cbf Upgrade uncrustify. 6 lat temu
par_msquares.h ce8f8884ac Merge pull request #40 from sonoro1234/PAR_MSQUARES_T 6 lat temu
par_octasphere.h 7e0654f1ba octasphere: flip the triangle winding. 6 lat temu
par_shapes.h 4e888b10fc Add asserts to help with #30. 6 lat temu
par_sprune.h 30f2c72cbf Upgrade uncrustify. 6 lat temu
par_streamlines.h 30f2c72cbf Upgrade uncrustify. 6 lat temu
par_string_blocks.h 72221136b5 Rework par_shaders into par_string_blocks. 6 lat temu

README.md

Build Status

par

Single-file C libraries under the MIT license, mostly graphics related. Documentation can be found at the top of each header file, but some libraries have an accompanying blog post. The most useful ones are listed in the following table.

library description link
par_camera_control.h orbit controller, or pan-and-zoom like Google Maps demo project
par_octasphere.h malloc-free mesh gen for spheres and rounded cuboids blog post
par_streamlines.h triangulate wide lines and curves blog post
par_string_blocks.h string manager for snippets of Lua or GLSL
par_shapes.h generate parametric surfaces and other simple shapes blog post

There are more libraries too but they're probably less useful; scroll to the bottom of this README.

tests

To run tests, you need CMake and libcurl. On OS X, these can be installed with homebrew:

$ brew install cmake pkg-config curl

Here's how you can tell CMake to use the CMakeLists in the test folder, placing all the messy stuff in a new folder called build.

$ cmake test -Bbuild   # Create makefiles
$ cmake --build build  # Invoke the build

The tests are executed by simply running the programs:

$ build/test_msquares
$ build/test_bluenoise
$ build/test_bubbles
$ build/test_shapes

code formatting

This library's code style is strictly enforced to be vertically dense (no consecutive newlines) and 100 columns or less.

The tools/format.py script invokes a two-step code formatting process:

  1. Runs uncrustify with our custom configuration. This auto-formats all code in the root folder, up to a point.
  2. Checks for violations that are not otherwise enforced with uncrustify.

The aforementioned Python script is also invoked from Travis, but using the --check option, which checks for conformance without editing the code.

Beyond what our uncrustify configuration enforces, the Python script does the following:

  • Checks that no lines are more than 100 chars.
  • Checks for extra newlines before an end brace.

other libraries

library description link
par_bluenoise.h generate progressive 2D point sequences blog post
par_bubbles.h pack circles into hierarchical diagrams blog post
par_easings.h Robert Penner's easing functions
par_easycurl.h simple HTTP requests using libcurl
par_filecache.h LRU caching on your device's filesystem
par_sprune.h efficient broad-phase collision detection in 2D web demo
par_msquares.h unmaintained marching squares library (do not use) blog post