Skip to content

Commit

Permalink
Improve ColorSpace documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkewley committed Aug 27, 2024
1 parent 284ca9d commit 9977120
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/oscar/Graphics/ColorSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

namespace osc
{
// used to tell the renderer the color space of provided pixel data
// Used in various parts of the codebase (e.g. image loaders) to indicate the
// color space of the provided pixel data.
//
// this is necessary because OSC assumes that all color data within shaders
// is within a linear color space, but the color space of external data (e.g.
// loaded from images) will typically be in sRGB color space and require on-GPU
// conversion
// This is necessary because some functions are only capable of knowing that they
// are loading pixel data (e.g. as RGB bytes), but they aren't capable of knowing
// the color space encoding of that data (e.g. when loading a normal map from a
// PNG). It's important metadata, because shaders always work in a linear color space,
// and other calling code may only want to deal with sRGB colors (e.g. even if
// the colors were originally loaded as linear-space floats)
enum class ColorSpace {
// hint: typical image files (e.g. from photo editors, online, etc.) are defined in sRGB

// Indicates an sRGB colorspace. This is typical for (e.g.) image files, albedo textures
sRGB,

// hint: data image files (e.g. bump maps, normal maps) are usually defined in a linear color space
// Indicates a linear colorspace. This is typical for (e.g.) bump maps, normal maps
Linear,

NUM_OPTIONS,
Expand Down

0 comments on commit 9977120

Please sign in to comment.