Crate luminance [] [src]

What is this?

crates.io License

luminance is an effort to make graphics rendering simple and elegant. The aims of luminance are:

  • making unsafe and stateful APIs (e.g. OpenGL) safe and stateless ;
  • providing a simple API; that is, exposing core concepts without anything extra – just the bare stuff ;
  • easy to read with a good documentation and set of tutorials, so that new comers don’t have to learn a lot of new concepts to get their feet wet.

What’s included?

luminance is a rendering framework, not a 3D engine. As so, it doesn’t include stuff like lights, materials, asset management nor scene description. It only provides a rendering framework you can plug in whatever libraries you want to.

Features set

  • buffers: buffers are way to communicate with the GPU; they represent regions of memory you can write to and read from. There’re several kinds of buffers you can create, among vertex and index buffers, shader buffer, compute buffer, and so on and so forth… ;
  • framebuffers: framebuffers are used to hold renders. Each time you want to perform a render, you need to perform it into a framebuffer. Framebuffers can then be combined with each other to produce nice effects ;
  • shaders: luminance support five kinds of shader stages:
    • tessellation control shaders ;
    • tessellation evaluation shaders ;
    • vertex shaders ;
    • geometry shaders ;
    • fragment shaders ;
  • vertices, indices, primitives and tessellations: those are used to define a shape you can render into a framebuffer
  • textures: textures represent information packed into arrays on the GPU, and can be used to customize a visual aspect or pass information around ;
  • blending: blending is the process of taking two colors from two framebuffers and mix them between each other ;
  • and a lot of other cool things like GPU commands.

Current implementation

Currently, luminance is powered by OpenGL. It might change, but it’ll always be in favor on supporting more devices and technologies – a shift to Vulkan is planned.

Windowing

luminance does not provide point a way to create windows because it’s important that it not depend on windowing libraries so that end-users can use whatever they like. Furthermore, such libraries typically implement windowing and events features, which have nothing to do with our initial purpose.

How to dig in?

luminance is written to be fairly simple. The documentation is very transparent about what the library does and several articles will appear as the development goes on. Keep tuned! The online documentation is also a good link to have around.

Reexports

pub use blending::*;
pub use buffer::Binding;
pub use buffer::Buffer;
pub use buffer::BufferSlice;
pub use buffer::BufferSliceMut;
pub use buffer::BufferError;
pub use buffer::RawBuffer;
pub use chain::*;
pub use framebuffer::ColorSlot;
pub use framebuffer::DepthSlot;
pub use framebuffer::Framebuffer;
pub use framebuffer::FramebufferError;
pub use linear::*;
pub use pipeline::Pipe;
pub use pipeline::Pipeline;
pub use pipeline::RenderCommand;
pub use pipeline::ShadingCommand;
pub use pixel::ColorPixel;
pub use pixel::DepthPixel;
pub use pixel::Format;
pub use pixel::Pixel;
pub use pixel::PixelFormat;
pub use pixel::RenderablePixel;
pub use pixel::RGB8UI;
pub use pixel::RGBA8UI;
pub use pixel::R32F;
pub use pixel::RGB32F;
pub use pixel::RGBA32F;
pub use pixel::Depth32F;
pub use pixel::is_color_pixel;
pub use pixel::is_depth_pixel;
pub use shader::program::Program;
pub use shader::program::ProgramError;
pub use shader::program::Sem;
pub use shader::program::SemIndex;
pub use shader::program::Uniform;
pub use shader::program::UniformWarning;
pub use shader::program::Uniformable;
pub use shader::stage::Stage;
pub use shader::stage::StageError;
pub use tess::Tess;
pub use tess::TessRender;
pub use tess::TessVertices;
pub use tess::Mode;
pub use texture::CubeFace;
pub use texture::Cubemap;
pub use texture::DepthComparison;
pub use texture::Dimensionable;
pub use texture::Dim1;
pub use texture::Dim2;
pub use texture::Dim3;
pub use texture::Flat;
pub use texture::Layerable;
pub use texture::Layered;
pub use texture::Layering;
pub use texture::MagFilter;
pub use texture::MinFilter;
pub use texture::RawTexture;
pub use texture::Sampler;
pub use texture::Texture;
pub use texture::Unit;
pub use texture::Wrap;
pub use vertex::Vertex;
pub use vertex::VertexComponentFormat;
pub use vertex::VertexFormat;

Modules

blending

That module exports blending-related types and functions.

buffer

Static GPU typed arrays.

chain

Generalized free tuples.

framebuffer

Framebuffers and utility types and functions.

linear

Aliases types used to make it easier using long linear algebra types.

pipeline

Dynamic rendering pipelines.

pixel

Pixel formats types and function manipulation.

shader

Shader-related modules.

tess

Tessellation features.

texture

This module provides texture features.

vertex

Vertex formats, associated types and functions.

Macros

chain

If your compiler supports the type_macrosfeature, you can use this macro to create chains without the syntactic nesting boilerplate.