1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! *Crystal Ball* is a path tracing library written in Rust.
//!
//! It uses [rayon](https://github.com/rayon-rs/rayon) for parallelization
//! and can save the rendered image in various formats thanks to the [image](https://github.com/image-rs/image) crate.
//!
//! Note that Crystal Ball is a hobby project
//! and will most likely see a lot of API changes in future versions.
//!
//! ## Features
//!
//! - Multithreaded CPU rendering
//! - Save rendered images in [various formats](https://github.com/image-rs/image#supported-image-formats)
//! - Environment textures
//! - General purpose PBR material
//! - Shapes: spheres and triangle meshes
//! - Easily create your own textures, materials, and shapes
//! - Load [glTF](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html) files
//! - Depth of field
//! - Bounding Volume Hierarchies
//! - Optional denoising using [Open Image Denoise](https://www.openimagedenoise.org/)
//!
//! ## Usage
//!
//! ### Basic Example
//!
//! A basic example rendering two spheres.
//!
//! ```
//! use std::default::Default;
//! use std::sync::Arc;
//!
//! use crystal_ball::prelude::*;
//!
//! fn main() -> Result<(), Error> {
//! let objects = vec![
//! Object::new(
//! Arc::new(Sphere::new()),
//! Arc::new(PbrMaterial {
//! base_color: Color::new(1.0, 0.45, 0.31),
//! ..Default::default()
//! }),
//! ),
//! Object::new(
//! Arc::new(
//! Sphere::new()
//! .translate(Vec3::new(0.0, -101.0, 0.0))
//! .scale_xyz(Vec3::splat(100.0)),
//! ),
//! Arc::new(PbrMaterial::default()),
//! ),
//! ];
//!
//! let scene = Scene {
//! objects,
//! camera: Camera::default().translate(Vec3::new(0.0, 0.0, 5.0)),
//! ..Default::default()
//! };
//!
//! let engine = RenderEngine::default();
//! let image = engine.render(&scene);
//!
//! image.write("basic.png")?;
//!
//! Ok(())
//! }
//! ```
//!
//! Take a look at the examples to see how to use Crystal Ball's different features.
//!
//! ### Coordinate System
//!
//! Crystal Ball uses a right-handed coordinate system where
//! - +X points right
//! - +Y points up
//! - +Z points to the screen
//!
//! ## Feature Flags
//!
//! ### Optional Features
//!
//! | Name | description |
//! |--------|-----------------------------------------------------------------------------|
//! | `oidn` | Image denoising using [Open Image Denoise](https://www.openimagedenoise.org/) |
pub use Transformable;