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
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::shared::PostEffectType;
/// Params for starting the engine.
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
#[serde(default)]
pub struct EngineParams {
/// Width of the video feed. Must be a multiple of 4.
pub video_res_width: u32,
/// Height of the video feed. Must be a multiple of 4.
pub video_res_height: u32,
/// Frames per second of the video feed.
pub fps: u32,
/// If true, engine will render video frames as fast as it can.
pub unlocked_framerate: bool,
/// Engine Post effects (such as SSAO)
pub post_effect: Option<PostEffectType>,
/// If true, will start a webrtc connection.
pub webrtc: bool,
/// An optional identifier for a pool of engine instances.
/// The 'default' pool is used when none is specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub pool: Option<String>,
/// If true, will show the grid at the start of the session.
pub show_grid: bool,
/// If given, when the session ends, the modeling commands sent during
/// the session will be written out to this filename.
/// For debugging.
pub replay: Option<String>,
/// API Call ID for distributed tracing
pub api_call_id: Option<String>,
/// Enables nicer visuals for transparent surfaces.
/// This slows down rendering, so it's off by default.
#[serde(default)]
pub order_independent_transparency: bool,
}
impl Default for EngineParams {
fn default() -> Self {
Self {
video_res_width: 1280,
video_res_height: 720,
fps: 60,
unlocked_framerate: false,
post_effect: None,
webrtc: true,
pool: None,
show_grid: false,
replay: None,
api_call_id: None,
order_independent_transparency: false,
}
}
}
impl EngineParams {
/// Returns a default EngineParams with the grid enabled.
/// This is primarily useful for engine testing.
pub fn default_with_grid() -> Self {
Self {
show_grid: true,
..Self::default()
}
}
}