Skip to content
forked from xelatihy/yocto-gl

A collection of C/C++ single-file libraries for building physically-based graphics applications

Notifications You must be signed in to change notification settings

digiant/yocto-gl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yocto/GL: C/C++ Single File Libraries for Physically-Based Graphics

Yocto/GL is a collection of single-file libraries for building physically-based graphics applications. Yocto/GL is written in C++ and can be used from with C or C++ and works on OSX (clang), Linux (clang/gcc) and Windows (cl).

Main Libraries

  • yocto_obj.h - Wavefront OBJ/MTL loader and writer that supports arbitrary polygons (with/without triangulation), lines, and points. Includes optionals extensions for per-vertex color and radius, camera and environment map. Optionally depends on stb_image.h for texture loading.
  • yocto_gltf.h - Khronos glTF loader and writer automatically generated by the spec. Supports all glTF format including Khronos extensions. Depends on json.hpp for json parsing. Optionally depends on stb_image.h and stb_image_write.h for texture loading and writing.
  • yocto_bvh.h - Ray casting and closet point queries of points, lines and triangles accelerated by a two-level bounding volume hierarchy.
  • yocto_shape.h - Utilities for manipulating shapes composed of points, lines, triangles or quads. Includes parametric shape generation, uniform tesselation, normal computation, uniform shape sampling.
  • yocto_trace.h - Path tracer with support for point, line or triangle geometry, mesh area lights and environment maps, materials with either GGX or Phong (only opaque for now). Support both incremental and offline computation on single- or multi-core machines.
  • yocto_sym.h - Rigid body solver supporting convex and concave triangle meshes based on Sequential Impulses (aka Projected Gauss-Sidel).

Support Libraries

  • yocto_cmd.h - Utilities for writing command line applications. Includes in particular a command line parsing library that support options and arguments of ints, floats, strings, enums.
  • yocto_glu.h - Quick and dirty rendering of images and shapes in OpenGL, useful to create interactive viewers.
  • yocto_math.h - A few vector math routines used to implement Yocto/GL libraries.

Documentation

All documentation is included in each library file in plain ASCII. If desired, runs doxygen in the root directory to get html formatted documentation.

Examples

This repository contains Yocto/GL applications written to test the libraries.

  • yobj2gltf.cpp: Converts Wavefront OBJ to glTF 1.1.
  • ytestgen.cpp: Creates various test cases for the path tracer and GL viewer.
  • yimview.cpp: HDR/PNG/JPG image viewer with exposure/gamma tone mapping.
  • yshade.cpp: Simple OpenGL viewer.
  • yitrace.cpp: Interactive path-tracer.
  • ytrace.cpp: Offline path-tracer.
  • yisym.cpp: Interactive rigid body demo code.
  • ysym.cpp: Offline rigid body demo.

A few screenshots from ytrace are included here for demonstration.

A screenshotted movie from ysym is included here for demonstration.

Old Version

Yocto/GL was originally written in C99. That version is at commit 55e2328476647fccae8eee1649f961984751ad96 in this repository for reference. We moved to C++ since the lack of operator overloading made some math code really unreadable, defeating one of the main tenants of Yocto/GL.

Brief Development History

  • Doxygen documentation
  • Internal speedup using raw pointers
  • Khronos glTF support
  • Modern C++ API
    • Using references to avoid pointer chasing and memory management
    • OBJ loading conforms better to raw file format
    • significantly reduce code length, but maintaining same features
  • Moving to C++
    • Removed old C API
    • Use STL containers by default
  • Switched
  • Moved to C++ internals and common math library.
  • Rigid body solver.
  • Initial release.

License

Yocto/GL libraries are released under the permissive MIT license, while the example apps are released under the 2-clause BSD (to include warranty for binary distribution).

About

A collection of C/C++ single-file libraries for building physically-based graphics applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 66.5%
  • C 33.4%
  • Other 0.1%