|
26 | 26 | //! ```
|
27 | 27 | //!
|
28 | 28 | //! The stage is neat in that it allows you to place values and arrays of values
|
29 |
| -//! directly onto the GPU. Those values can be modified on the CPU and synchronization |
30 |
| -//! will happen during [`Stage::render`](crate::stage::Stage::render). |
31 |
| -//! These values are called [`Hybrid`](crate::slab::Hybrid)s and [`HybridArray`](crate::slab::HybridArray)s. |
| 29 | +//! directly onto the GPU. Those values can be modified on the CPU and |
| 30 | +//! synchronization will happen during |
| 31 | +//! [`Stage::render`](crate::stage::Stage::render). These values are called |
| 32 | +//! [`Hybrid`](crate::slab::Hybrid)s and |
| 33 | +//! [`HybridArray`](crate::slab::HybridArray)s. |
32 | 34 | //!
|
33 | 35 | //! ```
|
34 | 36 | //! # use renderling::{Context, stage::Stage};
|
|
38 | 40 | //!
|
39 | 41 | //! let an_f32: Hybrid<f32> = stage.new_value(1337.0);
|
40 | 42 | //!
|
41 |
| -//! let an_array_of_tuples: HybridArray<(f32, u32, bool)> = stage.new_array([ |
42 |
| -//! (0.0, 0, false), |
43 |
| -//! (1.0, 1, true), |
44 |
| -//! ]); |
| 43 | +//! let an_array_of_tuples: HybridArray<(f32, u32, bool)> = |
| 44 | +//! stage.new_array([(0.0, 0, false), (1.0, 1, true)]); |
45 | 45 | //! ```
|
46 | 46 | //!
|
47 |
| -//! In order to render, we need to "stage" a [`Renderlet`](crate::stage::Renderlet), |
48 |
| -//! which is a bundle of rendering resources. |
49 |
| -//! We do this in the same way we "staged" `an_f32` above. |
| 47 | +//! In order to render, we need to "stage" a |
| 48 | +//! [`Renderlet`](crate::stage::Renderlet), which is a bundle of rendering |
| 49 | +//! resources. We do this in the same way we "staged" `an_f32` above. |
50 | 50 | //!
|
51 |
| -//! But first we'll need a [`Camera`](crate::camera::Camera) and some vertices of |
52 |
| -//! [`Vertex`](crate::stage::Vertex) organized as triangles with counter-clockwise winding. |
| 51 | +//! But first we'll need a [`Camera`](crate::camera::Camera) and some vertices |
| 52 | +//! of [`Vertex`](crate::stage::Vertex) organized as triangles with |
| 53 | +//! counter-clockwise winding. |
53 | 54 | //!
|
54 | 55 | //! ```
|
55 | 56 | //! # use renderling::{Context, stage::Stage};
|
56 | 57 | //! # let ctx = Context::headless(100, 100);
|
57 | 58 | //! # let mut stage: Stage = ctx.new_stage();
|
58 |
| -//! use renderling::{camera::Camera, stage::{Renderlet, Vertex}}; |
| 59 | +//! use renderling::{ |
| 60 | +//! camera::Camera, |
| 61 | +//! stage::{Renderlet, Vertex}, |
| 62 | +//! }; |
59 | 63 | //! let camera = stage.new_value(Camera::default_ortho2d(100.0, 100.0));
|
60 | 64 | //! let vertices = stage.new_array([
|
61 | 65 | //! Vertex::default()
|
|
75 | 79 | //! });
|
76 | 80 | //! ```
|
77 | 81 | //!
|
78 |
| -//! This gives us `triangle`, which is a `Hybrid<Renderlet>`. We can now pass `triangle` |
79 |
| -//! to the stage to draw each frame using |
| 82 | +//! This gives us `triangle`, which is a `Hybrid<Renderlet>`. We can now pass |
| 83 | +//! `triangle` to the stage to draw each frame using |
80 | 84 | //! [`Stage::add_renderlet`](crate::stage::Stage::add_renderlet).
|
81 | 85 | //!
|
82 |
| -//! Finally, we get the next frame from the context with [`Context::get_next_frame`], |
83 |
| -//! render to it using [`Stage::render`](crate::stage::Stage::render) and then present the |
| 86 | +//! Finally, we get the next frame from the context with |
| 87 | +//! [`Context::get_next_frame`], render to it using |
| 88 | +//! [`Stage::render`](crate::stage::Stage::render) and then present the |
84 | 89 | //! frame with [`Frame::present`].
|
85 | 90 | //!
|
86 | 91 | //! ```
|
87 | 92 | //! # use renderling::{
|
88 | 93 | //! # Context,
|
89 |
| -//! # camera::Camera, |
| 94 | +//! # camera::Camera, |
90 | 95 | //! # stage::{
|
91 |
| -//! # Vertex, |
| 96 | +//! # Vertex, |
92 | 97 | //! # Renderlet,
|
93 | 98 | //! # }
|
94 | 99 | //! # };
|
|
132 | 137 | //! PRs, criticisms and ideas are all very much welcomed [at the repo](https://github.com/schell/renderling).
|
133 | 138 | //!
|
134 | 139 | //! 😀☕
|
| 140 | +#![allow(unexpected_cfgs)] |
135 | 141 | #![cfg_attr(target_arch = "spirv", no_std)]
|
136 | 142 | #![deny(clippy::disallowed_methods)]
|
137 | 143 |
|
@@ -853,7 +859,8 @@ mod test {
|
853 | 859 | }
|
854 | 860 |
|
855 | 861 | #[test]
|
856 |
| - // shows how to "nest" children to make them appear transformed by their parent's transform |
| 862 | + // shows how to "nest" children to make them appear transformed by their |
| 863 | + // parent's transform |
857 | 864 | fn scene_parent_sanity() {
|
858 | 865 | let ctx = Context::headless(100, 100);
|
859 | 866 | let mut stage = ctx.new_stage().with_background_color(Vec4::splat(0.0));
|
|
0 commit comments