1use super::class_requires::*;
2use super::*;
3#[allow(non_upper_case_globals, non_snake_case)]
10#[cfg_attr(feature = "json_schema", derive(schemars::JsonSchema))]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12#[derive(educe::Educe)]
13#[educe(Debug, Clone, Default, PartialEq)]
14pub struct hkpBvShape {
15 #[cfg_attr(
22 feature = "serde",
23 serde(skip_serializing_if = "Option::is_none", default)
24 )]
25 pub __ptr: Option<Pointer>,
26 #[cfg_attr(feature = "json_schema", schemars(flatten))]
28 #[cfg_attr(feature = "serde", serde(flatten))]
29 pub parent: hkpShape,
30 #[cfg_attr(feature = "json_schema", schemars(rename = "boundingVolumeShape"))]
35 #[cfg_attr(feature = "serde", serde(rename = "boundingVolumeShape"))]
36 pub m_boundingVolumeShape: Pointer,
37 #[cfg_attr(feature = "json_schema", schemars(rename = "childShape"))]
42 #[cfg_attr(feature = "serde", serde(rename = "childShape"))]
43 pub m_childShape: hkpSingleShapeContainer,
44}
45const _: () = {
46 use havok_serde as _serde;
47 impl _serde::HavokClass for hkpBvShape {
48 #[inline]
49 fn name(&self) -> &'static str {
50 "hkpBvShape"
51 }
52 #[inline]
53 fn signature(&self) -> _serde::__private::Signature {
54 _serde::__private::Signature::new(0x286eb64c)
55 }
56 #[allow(clippy::let_and_return, clippy::vec_init_then_push)]
57 fn deps_indexes(&self) -> Vec<usize> {
58 let mut v = Vec::new();
59 v.push(self.m_boundingVolumeShape.get());
60 v.extend(self.m_childShape.deps_indexes());
61 v
62 }
63 }
64 impl _serde::Serialize for hkpBvShape {
65 fn serialize<S>(&self, __serializer: S) -> Result<S::Ok, S::Error>
66 where
67 S: _serde::ser::Serializer,
68 {
69 let class_meta = self
70 .__ptr
71 .map(|name| (name, _serde::__private::Signature::new(0x286eb64c)));
72 let mut serializer = __serializer
73 .serialize_struct("hkpBvShape", class_meta, (28u64, 56u64))?;
74 serializer.pad_field([0u8; 4usize].as_slice(), [0u8; 8usize].as_slice())?;
75 serializer
76 .skip_field("memSizeAndFlags", &self.parent.parent.m_memSizeAndFlags)?;
77 serializer
78 .skip_field("referenceCount", &self.parent.parent.m_referenceCount)?;
79 serializer.pad_field([0u8; 0usize].as_slice(), [0u8; 4usize].as_slice())?;
80 serializer.serialize_field("userData", &self.parent.m_userData)?;
81 serializer.skip_field("type", &self.parent.m_type)?;
82 serializer.pad_field([0u8; 0usize].as_slice(), [0u8; 4usize].as_slice())?;
83 serializer
84 .serialize_field("boundingVolumeShape", &self.m_boundingVolumeShape)?;
85 serializer.serialize_field("childShape", &self.m_childShape)?;
86 serializer.end()
87 }
88 }
89};
90#[doc(hidden)]
91#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
92const _: () = {
93 use havok_serde as _serde;
94 #[automatically_derived]
95 impl<'de> _serde::Deserialize<'de> for hkpBvShape {
96 fn deserialize<__D>(deserializer: __D) -> core::result::Result<Self, __D::Error>
97 where
98 __D: _serde::Deserializer<'de>,
99 {
100 #[allow(non_camel_case_types)]
101 enum __Field {
102 m_userData,
103 m_boundingVolumeShape,
104 m_childShape,
105 __ignore,
106 }
107 struct __FieldVisitor;
108 impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
109 type Value = __Field;
110 fn expecting(
111 &self,
112 __formatter: &mut core::fmt::Formatter,
113 ) -> core::fmt::Result {
114 core::fmt::Formatter::write_str(__formatter, "field identifier")
115 }
116 #[allow(clippy::match_single_binding)]
118 #[allow(clippy::reversed_empty_ranges)]
119 #[allow(clippy::single_match)]
120 fn visit_key<__E>(
121 self,
122 __value: &str,
123 ) -> core::result::Result<Self::Value, __E>
124 where
125 __E: _serde::de::Error,
126 {
127 match __value {
128 "userData" => Ok(__Field::m_userData),
129 "boundingVolumeShape" => Ok(__Field::m_boundingVolumeShape),
130 "childShape" => Ok(__Field::m_childShape),
131 _ => Ok(__Field::__ignore),
132 }
133 }
134 }
135 impl<'de> _serde::Deserialize<'de> for __Field {
136 #[inline]
137 fn deserialize<__D>(
138 __deserializer: __D,
139 ) -> core::result::Result<Self, __D::Error>
140 where
141 __D: _serde::Deserializer<'de>,
142 {
143 _serde::Deserializer::deserialize_key(__deserializer, __FieldVisitor)
144 }
145 }
146 struct __hkpBvShapeVisitor<'de> {
147 marker: _serde::__private::PhantomData<hkpBvShape>,
148 lifetime: _serde::__private::PhantomData<&'de ()>,
149 }
150 #[allow(clippy::match_single_binding)]
151 #[allow(clippy::reversed_empty_ranges)]
152 #[allow(clippy::single_match)]
153 impl<'de> _serde::de::Visitor<'de> for __hkpBvShapeVisitor<'de> {
154 type Value = hkpBvShape;
155 fn expecting(
156 &self,
157 __formatter: &mut core::fmt::Formatter,
158 ) -> core::fmt::Result {
159 core::fmt::Formatter::write_str(__formatter, "struct hkpBvShape")
160 }
161 fn visit_struct_for_bytes<__A>(
162 self,
163 mut __map: __A,
164 ) -> _serde::__private::Result<Self::Value, __A::Error>
165 where
166 __A: _serde::de::MapAccess<'de>,
167 {
168 let __ptr = __A::class_ptr(&mut __map);
169 let parent = __A::parent_value(&mut __map)?;
170 let mut m_boundingVolumeShape: _serde::__private::Option<Pointer> = _serde::__private::None;
171 let mut m_childShape: _serde::__private::Option<
172 hkpSingleShapeContainer,
173 > = _serde::__private::None;
174 for i in 0..2usize {
175 match i {
176 0usize => {
177 if _serde::__private::Option::is_some(
178 &m_boundingVolumeShape,
179 ) {
180 return _serde::__private::Err(
181 <__A::Error as _serde::de::Error>::duplicate_field(
182 "boundingVolumeShape",
183 ),
184 );
185 }
186 m_boundingVolumeShape = _serde::__private::Some(
187 match __A::next_value::<Pointer>(&mut __map) {
188 _serde::__private::Ok(__val) => __val,
189 _serde::__private::Err(__err) => {
190 return _serde::__private::Err(__err);
191 }
192 },
193 );
194 }
195 1usize => {
196 if _serde::__private::Option::is_some(&m_childShape) {
197 return _serde::__private::Err(
198 <__A::Error as _serde::de::Error>::duplicate_field(
199 "childShape",
200 ),
201 );
202 }
203 m_childShape = _serde::__private::Some(
204 match __A::next_value::<
205 hkpSingleShapeContainer,
206 >(&mut __map) {
207 _serde::__private::Ok(__val) => __val,
208 _serde::__private::Err(__err) => {
209 return _serde::__private::Err(__err);
210 }
211 },
212 );
213 }
214 _ => {}
215 }
216 }
217 let m_boundingVolumeShape = match m_boundingVolumeShape {
218 _serde::__private::Some(__field) => __field,
219 _serde::__private::None => {
220 return _serde::__private::Err(
221 <__A::Error as _serde::de::Error>::missing_field(
222 "boundingVolumeShape",
223 ),
224 );
225 }
226 };
227 let m_childShape = match m_childShape {
228 _serde::__private::Some(__field) => __field,
229 _serde::__private::None => {
230 return _serde::__private::Err(
231 <__A::Error as _serde::de::Error>::missing_field(
232 "childShape",
233 ),
234 );
235 }
236 };
237 _serde::__private::Ok(hkpBvShape {
238 __ptr,
239 parent,
240 m_boundingVolumeShape,
241 m_childShape,
242 })
243 }
244 #[allow(clippy::manual_unwrap_or_default)]
245 fn visit_struct<__A>(
246 self,
247 mut __map: __A,
248 ) -> _serde::__private::Result<Self::Value, __A::Error>
249 where
250 __A: _serde::de::MapAccess<'de>,
251 {
252 let mut m_userData: _serde::__private::Option<Ulong> = _serde::__private::None;
253 let mut m_boundingVolumeShape: _serde::__private::Option<Pointer> = _serde::__private::None;
254 let mut m_childShape: _serde::__private::Option<
255 hkpSingleShapeContainer,
256 > = _serde::__private::None;
257 while let _serde::__private::Some(__key) = {
258 __A::next_key::<__Field>(&mut __map)?
259 } {
260 match __key {
261 __Field::m_userData => {
262 #[cfg(
263 any(feature = "strict", feature = "ignore_duplicates")
264 )]
265 if _serde::__private::Option::is_some(&m_userData) {
266 #[cfg(feature = "ignore_duplicates")]
267 {
268 __A::skip_value(&mut __map)?;
269 continue;
270 }
271 #[cfg(feature = "strict")]
272 return _serde::__private::Err(
273 <__A::Error as _serde::de::Error>::duplicate_field(
274 "userData",
275 ),
276 );
277 }
278 m_userData = _serde::__private::Some(
279 match __A::next_value::<Ulong>(&mut __map) {
280 _serde::__private::Ok(__val) => __val,
281 _serde::__private::Err(__err) => {
282 return _serde::__private::Err(__err);
283 }
284 },
285 );
286 }
287 __Field::m_boundingVolumeShape => {
288 #[cfg(
289 any(feature = "strict", feature = "ignore_duplicates")
290 )]
291 if _serde::__private::Option::is_some(
292 &m_boundingVolumeShape,
293 ) {
294 #[cfg(feature = "ignore_duplicates")]
295 {
296 __A::skip_value(&mut __map)?;
297 continue;
298 }
299 #[cfg(feature = "strict")]
300 return _serde::__private::Err(
301 <__A::Error as _serde::de::Error>::duplicate_field(
302 "boundingVolumeShape",
303 ),
304 );
305 }
306 m_boundingVolumeShape = _serde::__private::Some(
307 match __A::next_value::<Pointer>(&mut __map) {
308 _serde::__private::Ok(__val) => __val,
309 _serde::__private::Err(__err) => {
310 return _serde::__private::Err(__err);
311 }
312 },
313 );
314 }
315 __Field::m_childShape => {
316 #[cfg(
317 any(feature = "strict", feature = "ignore_duplicates")
318 )]
319 if _serde::__private::Option::is_some(&m_childShape) {
320 #[cfg(feature = "ignore_duplicates")]
321 {
322 __A::skip_value(&mut __map)?;
323 continue;
324 }
325 #[cfg(feature = "strict")]
326 return _serde::__private::Err(
327 <__A::Error as _serde::de::Error>::duplicate_field(
328 "childShape",
329 ),
330 );
331 }
332 m_childShape = _serde::__private::Some(
333 match __A::next_value::<
334 hkpSingleShapeContainer,
335 >(&mut __map) {
336 _serde::__private::Ok(__val) => __val,
337 _serde::__private::Err(__err) => {
338 return _serde::__private::Err(__err);
339 }
340 },
341 );
342 }
343 _ => __A::skip_value(&mut __map)?,
344 }
345 }
346 let m_userData = match m_userData {
347 _serde::__private::Some(__field) => __field,
348 _serde::__private::None => {
349 #[cfg(feature = "strict")]
350 return _serde::__private::Err(
351 <__A::Error as _serde::de::Error>::missing_field("userData"),
352 );
353 #[cfg(not(feature = "strict"))] Default::default()
354 }
355 };
356 let m_boundingVolumeShape = match m_boundingVolumeShape {
357 _serde::__private::Some(__field) => __field,
358 _serde::__private::None => {
359 #[cfg(feature = "strict")]
360 return _serde::__private::Err(
361 <__A::Error as _serde::de::Error>::missing_field(
362 "boundingVolumeShape",
363 ),
364 );
365 #[cfg(not(feature = "strict"))] Default::default()
366 }
367 };
368 let m_childShape = match m_childShape {
369 _serde::__private::Some(__field) => __field,
370 _serde::__private::None => {
371 #[cfg(feature = "strict")]
372 return _serde::__private::Err(
373 <__A::Error as _serde::de::Error>::missing_field(
374 "childShape",
375 ),
376 );
377 #[cfg(not(feature = "strict"))] Default::default()
378 }
379 };
380 let __ptr = None;
381 let parent = hkBaseObject { __ptr };
382 let parent = hkReferencedObject {
383 __ptr,
384 parent,
385 ..Default::default()
386 };
387 let parent = hkpShape {
388 __ptr,
389 parent,
390 m_userData,
391 ..Default::default()
392 };
393 let __ptr = __A::class_ptr(&mut __map);
394 _serde::__private::Ok(hkpBvShape {
395 __ptr,
396 parent,
397 m_boundingVolumeShape,
398 m_childShape,
399 })
400 }
401 }
402 const FIELDS: &[&str] = &["boundingVolumeShape", "childShape"];
403 _serde::Deserializer::deserialize_struct(
404 deserializer,
405 "hkpBvShape",
406 FIELDS,
407 __hkpBvShapeVisitor {
408 marker: _serde::__private::PhantomData::<hkpBvShape>,
409 lifetime: _serde::__private::PhantomData,
410 },
411 )
412 }
413 }
414};