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
//! WIP Software Renderer in Rust
//!
//! [Documentation](https://docs.rs/softrender/)
//!
//! ### Example:
//!
//! See the [README.md](https://github.com/novacrazy/rust-softrender/blob/master/README.md) for examples.
//!
//! ### Current Features:
//!
//! * Rendering pipeline with user-defined vertex and fragment shaders.
//! * User-defined shader uniforms, both global and intermediate uniforms.
//! * Point, Line, Wireframe and Triangle shading models.
//! * All can be shaded using the next bullet point.
//! * Full Barycentric interpolation of intermediate uniforms for triangle rasterization.
//! * This means nice smooth shading on a per-fragment basis is easy and fast.
//! * Flexible framebuffer with color and depth components.
//! * Includes a `f32` RGBA color component for default use,
//! and nalgebra's `Vector4<f32>` can also be used as a color component.
//! * Parallel rendering with Rayon.
//! * Vertex processing and Fragment shading are all done in parallel, with as little overhead as possible.
//! * Simple yet flexible Mesh representation.
//! * Define your own vertex attributes.
//! * Built-in compatibility with the `image` crate, using the `image_compat` cargo feature.
//!
//! ### Planned Features:
//!
//! * Stencil buffer
//! * Generic texture support
//! * Multi-target framebuffers
//! * Such as multiple color components, which is useful for deferred rendering.
//! * Framebuffer to texture conversion, to compliment the above points.
//!
//! ### Glaring Problems
//!
//! #### Clipping, all of it.
//!
//! Geometry at the edge of the screen is totally messed up, and I don't know how to fix it as of writing this.
//! Any help would be greatly appreciated. I really want to fix it but have no idea how yet.
//!
//! #### Multi-mesh performance.
//!
//! Although this can chew through millions of triangles per second easy in a single mesh,
//! split that into ten meshes a tenth the size and suddenly it's quite a few times slower.
//!
//! This is mostly because while rendering meshes, each thread is given a partial empty framebuffer
//! (depth buffer is copied to allow early depth fails), which are all then merged together into the real framebuffer.
//! A single large mesh will allocate less memory overall than many small meshes.
//!
//! A potential solution to this would be to write an alternative pipeline meant for batch processing meshes,
//! so memory allocation is done once per all meshes, but some more work needs to be done until I can plan that out in more detail.
extern crate nalgebra;
extern crate rayon;
extern crate image;