three_rs/objects/quad_mesh.rs
1//! Port of `three.js/src/renderers/common/QuadMesh.js` (rung 1 subset).
2//!
3//! three.js draws a single oversized triangle with clip-space positions
4//! `(-1, 3)`, `(-1, -1)`, `(3, -1)` supplied by `QuadMesh.render()`'s
5//! `vertexNode`, and uvs `(0, -1)`, `(0, 1)`, `(2, 1)` from the geometry. Those
6//! constants live in the quad WGSL (`src/renderer/shaders/quad.wgsl`).
7
8use crate::materials::MeshBasicNodeMaterial;
9
10/// `QuadMesh` — draws one oversized triangle covering the full screen, for a
11/// post-processing pass.
12pub struct QuadMesh {
13 /// The material the full-screen triangle is drawn with.
14 pub material: MeshBasicNodeMaterial,
15}
16
17impl QuadMesh {
18 /// `new QuadMesh( material )`.
19 pub fn new(material: MeshBasicNodeMaterial) -> Self {
20 Self { material }
21 }
22}