borger/generated/
interpolation.rs1use crate::interpolation::Interpolate;
8
9#[cfg(feature = "client")]
10use
11{
12 crate::simulation,
13 crate::presentation::{self, PresentTick},
14 crate::interpolation::InterpolateTicks,
15};
16
17#[cfg(feature = "client")]
18use crate::presentation::Client;
19
20use
21{
22 glam::{Vec2, DVec2, Vec3, DVec3, Quat, DQuat},
23 crate::networked_types::primitive::{usize32, isize32},
24 crate::networked_types::collections::slotmap::SlotMap,
25 crate::networked_types::event_dispatcher::EventDispatcher,
26};
27
28#[cfg(feature = "client")]
29#[allow(non_camel_case_types, private_interfaces)]
30pub struct InterpolationOutput
31{
32
33}
34
35#[cfg(feature = "client")]
36impl InterpolateTicks for presentation::PresentationOutput
37{
38 type InterpolationOutput = InterpolationOutput;
39 fn interpolate_and_diff(_prv: Option<&Self>, _cur: &Self, _amount: f32, _received_new_tick: bool) -> Self::InterpolationOutput
40 {
41 Self::InterpolationOutput
42 {
43
44 }
45 }
46}
47
48#[cfg(feature = "client")]
49#[allow(non_camel_case_types, private_interfaces)]
50pub struct ClientOwned
51{
52
53}
54
55#[cfg(feature = "client")]
56impl InterpolateTicks for presentation::ClientOwned
57{
58 type InterpolationOutput = ClientOwned;
59 fn interpolate_and_diff(_prv: Option<&Self>, _cur: &Self, _amount: f32, _received_new_tick: bool) -> Self::InterpolationOutput
60 {
61 Self::InterpolationOutput
62 {
63
64 }
65 }
66}
67
68#[cfg(feature = "client")]
69#[allow(non_camel_case_types, private_interfaces)]
70pub struct ClientRemote
71{
72
73}
74
75#[cfg(feature = "client")]
76impl InterpolateTicks for presentation::ClientRemote
77{
78 type InterpolationOutput = ClientRemote;
79 fn interpolate_and_diff(_prv: Option<&Self>, _cur: &Self, _amount: f32, _received_new_tick: bool) -> Self::InterpolationOutput
80 {
81 Self::InterpolationOutput
82 {
83
84 }
85 }
86}
87
88#[cfg(feature = "client")]
89impl InterpolateTicks<presentation::ClientOwned> for presentation::ClientRemote
90{
91 type InterpolationOutput = ClientRemote;
92 fn interpolate_and_diff(_prv: Option<&presentation::ClientOwned>, _cur: &Self, _amount: f32, _received_new_tick: bool) -> Self::InterpolationOutput
93 {
94 Self::InterpolationOutput
95 {
96
97 }
98 }
99}
100
101impl Interpolate for f32
102{
103 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
104 {
105 prv * (1.0 - amount) + cur * amount
106 }
107}
108
109impl Interpolate for f64
110{
111 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
112 {
113 let amount = amount as f64;
114 prv * (1.0 - amount) + cur * amount
115 }
116}
117
118impl Interpolate for Vec2
119{
120 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
121 {
122 prv.lerp(cur, amount)
123 }
124}
125
126impl Interpolate for DVec2
127{
128 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
129 {
130 let amount = amount as f64;
131 prv.lerp(cur, amount)
132 }
133}
134
135impl Interpolate for Vec3
136{
137 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
138 {
139 prv.lerp(cur, amount)
140 }
141}
142
143impl Interpolate for DVec3
144{
145 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
146 {
147 let amount = amount as f64;
148 prv.lerp(cur, amount)
149 }
150}
151
152impl Interpolate for Quat
153{
154 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
155 {
156 prv.slerp(cur, amount)
157 }
158}
159
160impl Interpolate for DQuat
161{
162 fn interpolate(prv: Self, cur: Self, amount: f32) -> Self
163 {
164 let amount = amount as f64;
165 prv.slerp(cur, amount)
166 }
167}