Here you can find light-weight code releases that contain C++ classes for computer graphics use. The code releases only include header files, so no pre-compilation is needed. They only use standard C++ libraries, so there are no external dependancies, unless otherwise noted.

Instead of providing a complete library that includes all of these classes, I keep code releases separate for each component, so that you can just download the parts that you need. I believe this approach makes it easier for you to use them. I try to keep code releases as simple and as small as possible, therefore some of the code releases may need some previous code releases to compile. Please check the requirements list of the code release that you are interested in. If you have any problems with the code, documentation or usability, please let me know.

Dependencies

Code releases are provided in C++ header form. They only use standard C++ libraries and they do NOT have any external dependencies, unless otherwise specified. Some code releases depend on other code releases, as indicated.

License

All source code in cyCodeBase is released under the simple and permissive MIT license, which allows code modifications and commercial use.

Naming Convention

All file names begin with "cy" prefix. All classes and structs are defined in namespace cy. Most classes and structs are also defined outside of the namespace cy with an additional "cy" prefix. All constants begin with "CY_", and all internal constants begin with "_CY_". All functions and class methods begin with an upper-case letter. All variable names begin with a lower-case letter. If the function or variable name is made up of more than one word, each secondary word begins with an upper case letter, and the rest of the function and variable names use lower-case letters.

GIT Repository

All source files are on a GIT repository for easy access and updates. They can be accessed on github.

List of Code Releases

cyCodeBase includes the following code releases that can be downloaded and used independently. Note that some code releases depend on other code releases, as described below.

Core: Math Libraries: Misc. Libraries:
Graphics Tools: Adv. Graphics Methods:

cyCore

Core Functions and Macros

cyCore.h

This release includes a core header file that defines templated functions for common math operations and common macros used by some of the code releases.

files

cyCore.h

dependencies

none

cyVector

2D, 3D, 4D, and N-Dimensional vector classes

cyVector.h

These classes are the basic classes of computer graphics for 2D, 3D, 4D, and ND vectors. They are implemented as template classes, so that you could use both single precision and double precision floating point numbers. They provide almost all operations that you would need.

files

cyVector.h

templates

Vec, Vec2, Vec3, Vec4

typedefs


Using <float>: Vec2f, Vec3f, Vec4f
Using <double>: Vec2d, Vec3d, Vec4d

dependencies

cyCore

cyIVector

2D, 3D, and N-Dimensional integer vector classes

cyIVector.h

These classes are the basic classes of computer graphics for 2D, 3D, and ND integer vectors. They are implemented as template classes, so that you could use any integer type with any length, as well as other classes and types you like (provided that they overload the necessary operators). Unlike the classes in the cyVector release, these classes overload bitwise operations. These classes can be converted to and from the classes in the cyVector release.

files

cyIVector.h

templates

IVec, IVec2, IVec3, IVec4,

typedefs


Using <int8_t>: IVec2b, IVec3b, IVec4b,
Using <uint8_t>: IVec2ub, IVec3ub, IVec4ub,
Using <int16_t>: IVec2s, IVec3s, IVec4s,
Using <uint16_t>: IVec2us, IVec3us, IVec4us,
Using <int32_t>: IVec2i, IVec3i, IVec4i,
Using <uint32_t>: IVec2ui, IVec3ui, IVec4ui,
Using <int64_t>: IVec2l, IVec3l, IVec4l,
Using <uint64_t>: IVec2ul, IVec3ul, IVec4ul,

dependencies

cyCore

cyMatrix

2x2, 3x3, 3x4, and 4x4 matrix classes

cyMatrix.h

This code release has four template matrix classes for 2x2, 3x3, 3x4, and 4x4 matrices, which work with 2D, 3D and 4D vectors.

files

cyMatrix.h,

templates

Matrix2, Matrix3, Matrix34, Matrix4

typedefs


Using <float>: Matrix2f, Matrix3f, Matrix34f, Matrix4f
Using <double>: Matrix2d, Matrix3d, Matrix34d, Matrix4d

dependencies

cyCore, cyVector

cyQuaternion

Quaternion class for 3D vectors

cyQuat.h

The quaternion class is designed for rotation operations of unit quaternions on 3D vectors. 3x3 and 4x4 matrix conversions are also supported.

files

cyQuat.h

classes

Quat

typedefs


Using <float>: Quatf,
Using <double>: Quatd,

dependencies

cyCore, cyVector, cyMatrix

cyPolynomial

High-performance polynomial solvers

cyPolynomial.h

An implementation of my high-performance polynomial solver. See Solving Polynomials to find out how to use this code release.

files

cyPolynomial.h

classes

Polynomial

dependencies

cyCore

cyColor

Color classes with 3/4 8-bit/32-bit components

cyColor.h

This release includes four color classes. Two of them keep single precision float values per channel and store either 3 or 4 color components. The remaining two keep 8-bit color values and again they store either 3 or 4 color components. They include methods for converting between them and almost all the operations that you would need.

files

cyColor.h

classes

Color, ColorA, Color24, Color32

dependencies

none

cyTriMesh

Triangular mesh class

cyTriMesh.h

This release includes a triangular mesh class. This class can keep texture coordinates and surface normals, such that each vertex can have multiple normals associated with each one of the faces using the vertex. Since this is a triangular mesh class, all faces are triangles. It includes a function that can parse OBJ files, which automatically triangulates non-triangular faces.

files

cyTriMesh.h

classes

TriMesh

dependencies

cyCore, cyVector

cyBVH

Bounding Volume Hierarchy

cyBVH.h

This release includes a general purpose Bounding Volume Hierarchy (BVH) class and a BVH class for triangular meshes. The BVH structure is extremely useful in quickly searching the space and it is one of the commonly used data structures for accelerating ray tracing.

files

cyBVH.h

classes

BVH, BVHTriMesh

dependencies

none, but can also be used with cyTriMesh

cyGL

OpenGL helper classes

cyGL.h

The classes in this release are designed to provide convenient interfaces for some OpenGL features. They are not intended to provide the full flexibility of the underlying OpenGL functions, but they greatly simplify the implementation of some general OpenGL operations.

files

cyGL.h

classes

GL, GLDebugCallback, GLTexture, GLTexture1, GLTexture2, GLTexture3, GLTextureCubeMap, GLRenderBuffer, GLRenderTexture, GLRenderDepth, GLSLShader, GLSLProgram

typedefs

GLTexture1D, GLTexture2D, GLTexture3D, GLTexture1DArray, GLTexture2DArray, GLTextureBuffer, GLTextureRect, GLRenderTexture2D, GLRenderTextureRect, GLRenderDepth2D, GLRenderDepthRect,

dependencies

none, but can also be used with cyVector, cyMatrix, and cyIVector.

cyPointCloud

Points in k-d trees

cyPointCloud.h

2D, 3D, 4D, and N-D point clouds stored as k-d trees for quick nearest-neighbor searchers.

files

cyPointCloud.h

classes

PointCloud

typedefs


Generic PointCloud2, PointCloud3, PointCloud4, PointCloudN,
Using <float>: PointCloud2f, PointCloud3f, PointCloud4f, PointCloudNf,
Using <double>: PointCloud2d, PointCloud3d, PointCloud4d, PointCloudNd,

dependencies

none, but can also be used with cyVector

cyHeap

Heap structure with random access

cyHeap.h

A general-purpose heap class that permits random access and updates. Heaps are efficient structures for retrieving the element with the maximum value from a collection of elements without sorting them. This implementation allows accessing any element using its ID or heap order.

files

cyHeap.h

classes

Heap

dependencies

none

cyHairFile

Load and save HAIR model files

cyHairFile.h

A HAIR files is a binary file that keeps hair model data (see HAIR file description for more information). This code release includes a class to handle HAIR files for loading and saving hair model data. See Using HAIR Files in the solutions section for an example use of this code release.

files

cyHairFile.h

classes

HairFile

dependencies

cyCore

cyAlphaDistribution

Alpha Distribution

cyAlphaDistribution.h

An implementation of Alpha Distribution methods for alpha testing.

files

cyAlphaDistribution.h

classes

AlphaDistribution

dependencies

none

cyLightingGrid

Lighting Grid Hierarchy

cyLightingGrid.h

An implementation of the Lighting Grid Hierarchy method for efficiently handling many lights.

files

cyLightingGrid.h

classes

LightingGridHierarchy

dependencies

cyVector, cyIVector, cyColor, cyPointCloud

cySampleElimination

Weighted Sample Elimination

cySampleElim.h

An implementation of the weighted sample elimination algorithm for generating Poisson Disk sample sets in any dimensions.

files

cySampleElim.h

classes

WeightedSampleElimination

dependencies

cyPointCloud, cyHeap

cyTimer

Timer classes for Windows

cyTimer.h

This code release has timer classes that you can use to measure the performance of your code. See Easy Performance Analysis in the solutions section for an example use of this code release.

files

cyTimer.h

classes

Timer, TimerStats

dependencies

none