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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#![allow(deprecated)]
use bevy::prelude::*;
use bevy::render::camera::{DepthCalculation, ScalingMode, WindowOrigin};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetOrthographicProjection {
pub left: f32,
pub right: f32,
pub bottom: f32,
pub top: f32,
pub near: f32,
pub far: f32,
pub window_origin: WindowOrigin,
pub scaling_mode: ScalingMode,
pub scale: f32,
pub depth_calculation: DepthCalculation,
}
impl From<OrthographicProjection> for NetOrthographicProjection {
fn from(o: OrthographicProjection) -> Self {
NetOrthographicProjection {
left: o.left,
right: o.right,
bottom: o.bottom,
top: o.top,
near: o.near,
far: o.far,
window_origin: o.window_origin,
scaling_mode: o.scaling_mode,
scale: o.scale,
depth_calculation: o.depth_calculation,
}
}
}
impl From<NetOrthographicProjection> for OrthographicProjection {
fn from(o: NetOrthographicProjection) -> Self {
OrthographicProjection {
left: o.left,
right: o.right,
bottom: o.bottom,
top: o.top,
near: o.near,
far: o.far,
window_origin: o.window_origin,
scaling_mode: o.scaling_mode,
scale: o.scale,
depth_calculation: o.depth_calculation,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct NetName {
pub name: String,
}
impl From<Name> for NetName {
fn from(o: Name) -> Self {
NetName {
name: o.as_str().into(),
}
}
}
impl From<NetName> for Name {
fn from(o: NetName) -> Self {
Name::new(o.name)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct NetVisibility {
pub is_visible: bool,
}
impl From<Visibility> for NetVisibility {
fn from(o: Visibility) -> Self {
NetVisibility {
is_visible: o.is_visible,
}
}
}
impl From<NetVisibility> for Visibility {
fn from(o: NetVisibility) -> Self {
Visibility {
is_visible: o.is_visible,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub enum NetAlphaMode {
Opaque,
Mask(f32),
Blend,
}
impl From<AlphaMode> for NetAlphaMode {
fn from(o: AlphaMode) -> Self {
match o {
AlphaMode::Opaque => NetAlphaMode::Opaque,
AlphaMode::Mask(v) => NetAlphaMode::Mask(v),
AlphaMode::Blend => NetAlphaMode::Blend,
}
}
}
impl From<NetAlphaMode> for AlphaMode {
fn from(o: NetAlphaMode) -> Self {
match o {
NetAlphaMode::Opaque => AlphaMode::Opaque,
NetAlphaMode::Mask(v) => AlphaMode::Mask(v),
NetAlphaMode::Blend => AlphaMode::Blend,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub enum NetEulerRot {
ZYX,
ZXY,
YXZ,
YZX,
XYZ,
XZY,
#[deprecated(note = "Untested! Use at own risk!")]
ZYZ,
#[deprecated(note = "Untested! Use at own risk!")]
ZXZ,
#[deprecated(note = "Untested! Use at own risk!")]
YXY,
#[deprecated(note = "Untested! Use at own risk!")]
YZY,
#[deprecated(note = "Untested! Use at own risk!")]
XYX,
#[deprecated(note = "Untested! Use at own risk!")]
XZX,
}
impl From<EulerRot> for NetEulerRot {
fn from(o: EulerRot) -> Self {
match o {
EulerRot::ZYX => NetEulerRot::ZYX,
EulerRot::ZXY => NetEulerRot::ZXY,
EulerRot::YXZ => NetEulerRot::YXZ,
EulerRot::YZX => NetEulerRot::YZX,
EulerRot::XYZ => NetEulerRot::XYZ,
EulerRot::XZY => NetEulerRot::XZY,
EulerRot::ZYZ => NetEulerRot::ZYZ,
EulerRot::ZXZ => NetEulerRot::ZXZ,
EulerRot::YXY => NetEulerRot::YXY,
EulerRot::YZY => NetEulerRot::YZY,
EulerRot::XYX => NetEulerRot::XYX,
EulerRot::XZX => NetEulerRot::XZX,
}
}
}
impl From<NetEulerRot> for EulerRot {
fn from(o: NetEulerRot) -> Self {
match o {
NetEulerRot::ZYX => EulerRot::ZYX,
NetEulerRot::ZXY => EulerRot::ZXY,
NetEulerRot::YXZ => EulerRot::YXZ,
NetEulerRot::YZX => EulerRot::YZX,
NetEulerRot::XYZ => EulerRot::XYZ,
NetEulerRot::XZY => EulerRot::XZY,
NetEulerRot::ZYZ => EulerRot::ZYZ,
NetEulerRot::ZXZ => EulerRot::ZXZ,
NetEulerRot::YXY => EulerRot::YXY,
NetEulerRot::YZY => EulerRot::YZY,
NetEulerRot::XYX => EulerRot::XYX,
NetEulerRot::XZX => EulerRot::XZX,
}
}
}