radiance/
screen_output_node.rs1use crate::context::{ArcTextureViewSampler, Context};
2use crate::render_target::RenderTargetId;
3use crate::CommonNodeProps;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
7pub struct AvailableOutputScreen {
8 pub name: String,
9 pub suggested_resolutions: Vec<[u32; 2]>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
13pub struct SelectedOutputScreen {
14 pub name: String,
15 pub resolution: [u32; 2],
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize, Default)]
20pub struct ScreenOutputNodeProps {
21 #[serde(default)]
22 pub visible: bool,
23 #[serde(default)]
24 pub screen: Option<SelectedOutputScreen>,
25 #[serde(default)]
26 pub available_screens: Vec<AvailableOutputScreen>,
27}
28
29impl From<&ScreenOutputNodeProps> for CommonNodeProps {
30 fn from(_props: &ScreenOutputNodeProps) -> Self {
31 CommonNodeProps {
32 input_count: Some(1),
33 }
34 }
35}
36
37pub struct ScreenOutputNodeState {}
38
39impl ScreenOutputNodeState {
40 pub fn new(
41 _ctx: &Context,
42 _device: &wgpu::Device,
43 _queue: &wgpu::Queue,
44 _props: &ScreenOutputNodeProps,
45 ) -> Self {
46 Self {}
47 }
48
49 pub fn update(
50 &mut self,
51 _ctx: &Context,
52 _device: &wgpu::Device,
53 _queue: &wgpu::Queue,
54 _props: &mut ScreenOutputNodeProps,
55 ) {
56 }
57
58 pub fn paint(
59 &mut self,
60 ctx: &Context,
61 _device: &wgpu::Device,
62 _queue: &wgpu::Queue,
63 _encoder: &mut wgpu::CommandEncoder,
64 _render_target_id: RenderTargetId,
65 inputs: &[Option<ArcTextureViewSampler>],
66 ) -> ArcTextureViewSampler {
67 inputs
68 .first()
69 .cloned()
70 .flatten()
71 .unwrap_or_else(|| ctx.blank_texture().clone())
72 }
73}