weapons_mesh.rs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. use glam::Vec3;
  2. use crate::world::WeaponKind;
  3. /// Gameplay, sight-alignment, and animation metadata for each detailed weapon model.
  4. /// All weapon meshes use canonical weapon-local coordinates:
  5. /// - `+Z`: forward toward muzzle
  6. /// - `+Y`: up
  7. /// - `(0, 0, 0)`: receiver / pistol-grip pivot
  8. /// - Iron sights & PSO-1 optic line sit cleanly on `x = 0.0, y = sight_height_y`.
  9. #[derive(Clone, Copy, Debug)]
  10. pub struct WeaponModelMeta {
  11. pub sight_height_y: f32,
  12. pub hip_offset: Vec3,
  13. pub ads_offset: Vec3,
  14. pub sprint_offset: Vec3,
  15. pub sprint_rot: Vec3,
  16. pub muzzle_local: Vec3,
  17. pub ads_fov_deg: f32,
  18. pub has_pso1_scope: bool,
  19. pub mag_capacity: u32,
  20. pub reserve_default: u32,
  21. pub reload_secs: f32,
  22. pub auto_capable: bool,
  23. pub recoil_pitch: f32,
  24. pub recoil_yaw: f32,
  25. pub recoil_kick_z: f32,
  26. }
  27. pub const fn weapon_model_meta(kind: WeaponKind) -> WeaponModelMeta {
  28. match kind {
  29. WeaponKind::Ak74m => WeaponModelMeta {
  30. sight_height_y: 0.088,
  31. hip_offset: Vec3::new(0.20, -0.19, -0.35),
  32. ads_offset: Vec3::new(0.0, -0.088, -0.25),
  33. sprint_offset: Vec3::new(0.14, -0.24, -0.30),
  34. sprint_rot: Vec3::new(-0.32, 0.58, -0.18),
  35. muzzle_local: Vec3::new(0.0, 0.018, 0.72),
  36. ads_fov_deg: 44.0,
  37. has_pso1_scope: false,
  38. mag_capacity: 30,
  39. reserve_default: 150,
  40. reload_secs: 2.2,
  41. auto_capable: true,
  42. recoil_pitch: 0.022,
  43. recoil_yaw: 0.008,
  44. recoil_kick_z: 0.042,
  45. },
  46. WeaponKind::Akm => WeaponModelMeta {
  47. sight_height_y: 0.088,
  48. hip_offset: Vec3::new(0.21, -0.19, -0.35),
  49. ads_offset: Vec3::new(0.0, -0.088, -0.25),
  50. sprint_offset: Vec3::new(0.14, -0.25, -0.30),
  51. sprint_rot: Vec3::new(-0.34, 0.60, -0.18),
  52. muzzle_local: Vec3::new(0.0, 0.018, 0.71),
  53. ads_fov_deg: 44.0,
  54. has_pso1_scope: false,
  55. mag_capacity: 30,
  56. reserve_default: 150,
  57. reload_secs: 2.3,
  58. auto_capable: true,
  59. recoil_pitch: 0.032,
  60. recoil_yaw: 0.012,
  61. recoil_kick_z: 0.055,
  62. },
  63. WeaponKind::Aks74u => WeaponModelMeta {
  64. sight_height_y: 0.085,
  65. hip_offset: Vec3::new(0.19, -0.175, -0.32),
  66. ads_offset: Vec3::new(0.0, -0.085, -0.23),
  67. sprint_offset: Vec3::new(0.12, -0.22, -0.27),
  68. sprint_rot: Vec3::new(-0.28, 0.52, -0.15),
  69. muzzle_local: Vec3::new(0.0, 0.016, 0.50),
  70. ads_fov_deg: 47.0,
  71. has_pso1_scope: false,
  72. mag_capacity: 30,
  73. reserve_default: 150,
  74. reload_secs: 2.0,
  75. auto_capable: true,
  76. recoil_pitch: 0.024,
  77. recoil_yaw: 0.011,
  78. recoil_kick_z: 0.040,
  79. },
  80. WeaponKind::Pkm => WeaponModelMeta {
  81. sight_height_y: 0.106,
  82. hip_offset: Vec3::new(0.23, -0.22, -0.38),
  83. ads_offset: Vec3::new(0.0, -0.106, -0.27),
  84. sprint_offset: Vec3::new(0.16, -0.28, -0.32),
  85. sprint_rot: Vec3::new(-0.36, 0.64, -0.20),
  86. muzzle_local: Vec3::new(0.0, 0.020, 0.89),
  87. ads_fov_deg: 44.0,
  88. has_pso1_scope: false,
  89. mag_capacity: 100,
  90. reserve_default: 300,
  91. reload_secs: 3.6,
  92. auto_capable: true,
  93. recoil_pitch: 0.028,
  94. recoil_yaw: 0.015,
  95. recoil_kick_z: 0.048,
  96. },
  97. WeaponKind::Svd => WeaponModelMeta {
  98. sight_height_y: 0.122,
  99. hip_offset: Vec3::new(0.21, -0.20, -0.36),
  100. ads_offset: Vec3::new(0.0, -0.122, -0.24),
  101. sprint_offset: Vec3::new(0.15, -0.25, -0.31),
  102. sprint_rot: Vec3::new(-0.30, 0.60, -0.18),
  103. muzzle_local: Vec3::new(0.0, 0.018, 0.96),
  104. ads_fov_deg: 21.0,
  105. has_pso1_scope: true,
  106. mag_capacity: 10,
  107. reserve_default: 40,
  108. reload_secs: 2.4,
  109. auto_capable: false,
  110. recoil_pitch: 0.046,
  111. recoil_yaw: 0.008,
  112. recoil_kick_z: 0.068,
  113. },
  114. WeaponKind::Rpg7v => WeaponModelMeta {
  115. sight_height_y: 0.112,
  116. hip_offset: Vec3::new(0.23, -0.17, -0.30),
  117. ads_offset: Vec3::new(0.0, -0.112, -0.22),
  118. sprint_offset: Vec3::new(0.18, -0.24, -0.26),
  119. sprint_rot: Vec3::new(-0.26, 0.56, -0.15),
  120. muzzle_local: Vec3::new(0.0, 0.0, 0.80),
  121. ads_fov_deg: 48.0,
  122. has_pso1_scope: false,
  123. mag_capacity: 1,
  124. reserve_default: 4,
  125. reload_secs: 3.1,
  126. auto_capable: false,
  127. recoil_pitch: 0.055,
  128. recoil_yaw: 0.012,
  129. recoil_kick_z: 0.080,
  130. },
  131. }
  132. }
  133. #[cfg(feature = "cold_water_assets")]
  134. mod cold_water_weapon_meshes {
  135. use glam::{Mat4, Vec2, Vec3};
  136. use crate::core::materials::MaterialId;
  137. use crate::world::actors_mesh::MeshSlice;
  138. use crate::world::ActorVertex;
  139. /// Axis-aligned helper box.
  140. #[inline]
  141. fn push_aabb(
  142. v: &mut Vec<ActorVertex>,
  143. idx: &mut Vec<u32>,
  144. min: Vec3,
  145. max: Vec3,
  146. mat: MaterialId,
  147. ) {
  148. let center = (min + max) * 0.5;
  149. let half = (max - min) * 0.5;
  150. push_xform_box(v, idx, half, Mat4::from_translation(center), mat);
  151. }
  152. /// Oriented box with arbitrary rigid transform (`det > 0` preserves CCW outward winding).
  153. fn push_xform_box(
  154. vertices: &mut Vec<ActorVertex>,
  155. indices: &mut Vec<u32>,
  156. half: Vec3,
  157. xform: Mat4,
  158. mat: MaterialId,
  159. ) {
  160. let c = [
  161. Vec3::new(-half.x, -half.y, half.z),
  162. Vec3::new(half.x, -half.y, half.z),
  163. Vec3::new(half.x, half.y, half.z),
  164. Vec3::new(-half.x, half.y, half.z),
  165. Vec3::new(-half.x, -half.y, -half.z),
  166. Vec3::new(half.x, -half.y, -half.z),
  167. Vec3::new(half.x, half.y, -half.z),
  168. Vec3::new(-half.x, half.y, -half.z),
  169. ];
  170. let faces = [
  171. ([0, 1, 2, 3], Vec3::Z),
  172. ([5, 4, 7, 6], -Vec3::Z),
  173. ([1, 5, 6, 2], Vec3::X),
  174. ([4, 0, 3, 7], -Vec3::X),
  175. ([3, 2, 6, 7], Vec3::Y),
  176. ([4, 5, 1, 0], -Vec3::Y),
  177. ];
  178. let uvs = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]];
  179. let mat_id = mat.gpu_layer();
  180. for (f, n_local) in faces {
  181. let base = vertices.len() as u32;
  182. let wn = xform.transform_vector3(n_local).normalize_or_zero().to_array();
  183. for k in 0..4 {
  184. let wp = xform.transform_point3(c[f[k]]);
  185. vertices.push(ActorVertex {
  186. position: wp.to_array(),
  187. normal: wn,
  188. uv: uvs[k],
  189. mat_id,
  190. });
  191. }
  192. indices.extend_from_slice(&[base, base + 1, base + 2, base, base + 2, base + 3]);
  193. }
  194. }
  195. /// Tapered low-poly cylinder oriented along local `+Z` from `z0` to `z1` (`z0 < z1`), CCW outward.
  196. #[allow(clippy::too_many_arguments)]
  197. fn push_z_cylinder(
  198. verts: &mut Vec<ActorVertex>,
  199. indices: &mut Vec<u32>,
  200. center_xy: Vec2,
  201. z0: f32,
  202. z1: f32,
  203. r0: f32,
  204. r1: f32,
  205. sides: usize,
  206. mat: MaterialId,
  207. cap0: bool,
  208. cap1: bool,
  209. ) {
  210. let mat_id = mat.gpu_layer();
  211. let dz = (z1 - z0).max(0.0001);
  212. let dr = r0 - r1;
  213. let ring0 = verts.len() as u32;
  214. for s in 0..sides {
  215. let ang = (s as f32 / sides as f32) * std::f32::consts::TAU;
  216. let (sa, ca) = ang.sin_cos();
  217. let n = Vec3::new(ca * dz, sa * dz, dr).normalize_or_zero();
  218. verts.push(ActorVertex {
  219. position: [center_xy.x + ca * r0, center_xy.y + sa * r0, z0],
  220. normal: n.to_array(),
  221. uv: [s as f32 / sides as f32, 0.0],
  222. mat_id,
  223. });
  224. }
  225. let ring1 = verts.len() as u32;
  226. for s in 0..sides {
  227. let ang = (s as f32 / sides as f32) * std::f32::consts::TAU;
  228. let (sa, ca) = ang.sin_cos();
  229. let n = Vec3::new(ca * dz, sa * dz, dr).normalize_or_zero();
  230. verts.push(ActorVertex {
  231. position: [center_xy.x + ca * r1, center_xy.y + sa * r1, z1],
  232. normal: n.to_array(),
  233. uv: [s as f32 / sides as f32, 1.0],
  234. mat_id,
  235. });
  236. }
  237. for s in 0..sides {
  238. let sn = (s + 1) % sides;
  239. let a = ring0 + s as u32;
  240. let b = ring0 + sn as u32;
  241. let c = ring1 + sn as u32;
  242. let d = ring1 + s as u32;
  243. // (b-a) ≈ +Y, (d-a) = +Z -> (b-a) x (d-a) = +X outward
  244. indices.extend_from_slice(&[a, b, c, a, c, d]);
  245. }
  246. if cap0 && r0 > 0.0005 {
  247. let c_idx = verts.len() as u32;
  248. verts.push(ActorVertex {
  249. position: [center_xy.x, center_xy.y, z0],
  250. normal: [0.0, 0.0, -1.0],
  251. uv: [0.5, 0.5],
  252. mat_id,
  253. });
  254. for s in 0..sides {
  255. let sn = (s + 1) % sides;
  256. indices.extend_from_slice(&[c_idx, ring0 + sn as u32, ring0 + s as u32]);
  257. }
  258. }
  259. if cap1 && r1 > 0.0005 {
  260. let c_idx = verts.len() as u32;
  261. verts.push(ActorVertex {
  262. position: [center_xy.x, center_xy.y, z1],
  263. normal: [0.0, 0.0, 1.0],
  264. uv: [0.5, 0.5],
  265. mat_id,
  266. });
  267. for s in 0..sides {
  268. let sn = (s + 1) % sides;
  269. indices.extend_from_slice(&[c_idx, ring1 + s as u32, ring1 + sn as u32]);
  270. }
  271. }
  272. }
  273. fn push_curved_mag(
  274. v: &mut Vec<ActorVertex>,
  275. idx: &mut Vec<u32>,
  276. origin: Vec3,
  277. seg_count: usize,
  278. seg_len: f32,
  279. curve_step: f32,
  280. half_xz: (f32, f32),
  281. mat: MaterialId,
  282. ) {
  283. let mut cur = origin;
  284. let mut tilt = 0.14_f32;
  285. for s in 0..seg_count {
  286. let step_dir = Vec3::new(0.0, -tilt.cos(), tilt.sin());
  287. let center = cur + step_dir * (seg_len * 0.5);
  288. let rot = Mat4::from_rotation_x(-tilt);
  289. push_xform_box(
  290. v,
  291. idx,
  292. Vec3::new(half_xz.0, seg_len * 0.54, half_xz.1),
  293. Mat4::from_translation(center) * rot,
  294. mat,
  295. );
  296. cur += step_dir * seg_len;
  297. tilt += curve_step + (s as f32) * 0.03;
  298. }
  299. }
  300. fn push_ak_iron_sights(
  301. v: &mut Vec<ActorVertex>,
  302. idx: &mut Vec<u32>,
  303. rear_z: f32,
  304. front_z: f32,
  305. sight_y: f32,
  306. mat: MaterialId,
  307. ) {
  308. // Rear sight base + beveled open-notch cheeks (9mm aperture so front post stands crisp)
  309. push_aabb(v, idx, Vec3::new(-0.011, 0.044, rear_z - 0.020), Vec3::new(0.011, sight_y - 0.009, rear_z + 0.022), mat);
  310. push_aabb(v, idx, Vec3::new(-0.012, sight_y - 0.009, rear_z - 0.006), Vec3::new(-0.0045, sight_y + 0.003, rear_z + 0.006), mat);
  311. push_aabb(v, idx, Vec3::new(0.0045, sight_y - 0.009, rear_z - 0.006), Vec3::new(0.012, sight_y + 0.003, rear_z + 0.006), mat);
  312. // Front sight tower + slim protective ears + centered post at x=0, y=sight_y
  313. push_aabb(v, idx, Vec3::new(-0.007, 0.018, front_z - 0.009), Vec3::new(0.007, sight_y - 0.013, front_z + 0.009), mat);
  314. push_aabb(v, idx, Vec3::new(-0.009, sight_y - 0.013, front_z - 0.006), Vec3::new(-0.006, sight_y + 0.006, front_z + 0.006), mat);
  315. push_aabb(v, idx, Vec3::new(0.006, sight_y - 0.013, front_z - 0.006), Vec3::new(0.009, sight_y + 0.006, front_z + 0.006), mat);
  316. push_aabb(v, idx, Vec3::new(-0.0013, sight_y - 0.013, front_z - 0.002), Vec3::new(0.0013, sight_y + 0.002, front_z + 0.002), mat);
  317. }
  318. // ============================================================================
  319. // 1. AK-74M (5.45x39) — Black polymer folding stock, plum/bakelite furniture
  320. // ============================================================================
  321. pub fn push_weapon_ak74m(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  322. let off = idx.len() as u32;
  323. let metal = MaterialId::Gunmetal;
  324. let plum = MaterialId::BakelitePlum;
  325. // Polymer folding stock with sling cutout
  326. push_xform_box(v, idx, Vec3::new(0.014, 0.018, 0.115), Mat4::from_translation(Vec3::new(0.0, 0.018, -0.17)) * Mat4::from_rotation_x(0.05), metal);
  327. push_xform_box(v, idx, Vec3::new(0.014, 0.014, 0.11), Mat4::from_translation(Vec3::new(0.0, -0.036, -0.175)) * Mat4::from_rotation_x(-0.18), metal);
  328. push_aabb(v, idx, Vec3::new(-0.017, -0.068, -0.295), Vec3::new(0.017, 0.032, -0.268), metal);
  329. // Stamped receiver + ribbed dust cover + trigger guard
  330. push_aabb(v, idx, Vec3::new(-0.020, -0.018, -0.055), Vec3::new(0.020, 0.032, 0.185), metal);
  331. push_aabb(v, idx, Vec3::new(-0.017, 0.032, -0.052), Vec3::new(0.017, 0.054, 0.155), metal);
  332. push_aabb(v, idx, Vec3::new(-0.006, -0.042, 0.02), Vec3::new(0.006, -0.018, 0.075), metal);
  333. // Pistol grip (angled Bakelite/plum)
  334. push_xform_box(v, idx, Vec3::new(0.013, 0.050, 0.017), Mat4::from_translation(Vec3::new(0.0, -0.056, -0.022)) * Mat4::from_rotation_x(0.32), plum);
  335. // Curved 5.45 Bakelite 30-rd magazine
  336. push_curved_mag(v, idx, Vec3::new(0.0, -0.018, 0.112), 3, 0.062, 0.11, (0.013, 0.031), plum);
  337. // Polymer lower & upper handguard
  338. push_aabb(v, idx, Vec3::new(-0.018, -0.014, 0.185), Vec3::new(0.018, 0.019, 0.365), metal);
  339. push_aabb(v, idx, Vec3::new(-0.014, 0.020, 0.195), Vec3::new(0.014, 0.044, 0.355), plum);
  340. // Gas tube + 90 deg gas block + barrel + two-chamber AK-74 muzzle brake
  341. push_z_cylinder(v, idx, Vec2::new(0.0, 0.034), 0.16, 0.455, 0.010, 0.010, 6, metal, true, true);
  342. push_aabb(v, idx, Vec3::new(-0.010, 0.010, 0.438), Vec3::new(0.010, 0.044, 0.464), metal);
  343. push_z_cylinder(v, idx, Vec2::new(0.0, 0.016), 0.18, 0.635, 0.0105, 0.009, 8, metal, false, false);
  344. push_z_cylinder(v, idx, Vec2::new(0.0, 0.016), 0.635, 0.715, 0.0135, 0.0135, 8, metal, true, true);
  345. push_ak_iron_sights(v, idx, 0.168, 0.612, 0.088, metal);
  346. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  347. }
  348. // ============================================================================
  349. // 2. AKM (7.62x39) — Laminated Wood Stock & Handguard, Steeper Mag, Slant Brake
  350. // ============================================================================
  351. pub fn push_weapon_akm(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  352. let off = idx.len() as u32;
  353. let metal = MaterialId::Gunmetal;
  354. let wood = MaterialId::WoodFurniture;
  355. let bake = MaterialId::BakelitePlum;
  356. // Classic angled laminated wood stock + steel buttplate
  357. push_xform_box(v, idx, Vec3::new(0.015, 0.040, 0.115), Mat4::from_translation(Vec3::new(0.0, -0.012, -0.168)) * Mat4::from_rotation_x(-0.14), wood);
  358. push_aabb(v, idx, Vec3::new(-0.016, -0.068, -0.288), Vec3::new(0.016, 0.028, -0.276), metal);
  359. // Receiver + ribbed dust cover + trigger guard
  360. push_aabb(v, idx, Vec3::new(-0.020, -0.018, -0.055), Vec3::new(0.020, 0.032, 0.185), metal);
  361. push_aabb(v, idx, Vec3::new(-0.017, 0.032, -0.052), Vec3::new(0.017, 0.055, 0.155), metal);
  362. push_aabb(v, idx, Vec3::new(-0.006, -0.042, 0.02), Vec3::new(0.006, -0.018, 0.075), metal);
  363. // Bakelite grip
  364. push_xform_box(v, idx, Vec3::new(0.013, 0.050, 0.017), Mat4::from_translation(Vec3::new(0.0, -0.056, -0.022)) * Mat4::from_rotation_x(0.32), bake);
  365. // Ribbed steel 7.62x39 banana magazine (deeper curve)
  366. push_curved_mag(v, idx, Vec3::new(0.0, -0.018, 0.112), 3, 0.066, 0.17, (0.014, 0.033), metal);
  367. // Grooved wood handguard + gas tube + 45 deg gas block + slant muzzle brake
  368. push_aabb(v, idx, Vec3::new(-0.019, -0.015, 0.185), Vec3::new(0.019, 0.020, 0.365), wood);
  369. push_aabb(v, idx, Vec3::new(-0.015, 0.021, 0.195), Vec3::new(0.015, 0.045, 0.355), wood);
  370. push_z_cylinder(v, idx, Vec2::new(0.0, 0.034), 0.16, 0.455, 0.010, 0.010, 6, metal, true, true);
  371. push_xform_box(v, idx, Vec3::new(0.010, 0.018, 0.013), Mat4::from_translation(Vec3::new(0.0, 0.026, 0.445)) * Mat4::from_rotation_x(-0.35), metal);
  372. push_z_cylinder(v, idx, Vec2::new(0.0, 0.016), 0.18, 0.675, 0.0105, 0.0095, 8, metal, false, false);
  373. push_xform_box(v, idx, Vec3::new(0.011, 0.011, 0.018), Mat4::from_translation(Vec3::new(0.0, 0.017, 0.69)) * Mat4::from_rotation_x(0.25), metal);
  374. push_ak_iron_sights(v, idx, 0.168, 0.620, 0.088, metal);
  375. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  376. }
  377. // ============================================================================
  378. // 3. AKS-74U ("Krinkov") — Triangle Folder, Short Wood Handguard, Conical Booster
  379. // ============================================================================
  380. pub fn push_weapon_aks74u(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  381. let off = idx.len() as u32;
  382. let metal = MaterialId::Gunmetal;
  383. let wood = MaterialId::WoodFurniture;
  384. let bake = MaterialId::BakelitePlum;
  385. // Open triangular folding steel skeleton stock
  386. push_xform_box(v, idx, Vec3::new(0.007, 0.009, 0.112), Mat4::from_translation(Vec3::new(-0.010, 0.020, -0.16)) * Mat4::from_rotation_x(0.06), metal);
  387. push_xform_box(v, idx, Vec3::new(0.007, 0.009, 0.112), Mat4::from_translation(Vec3::new(0.010, 0.020, -0.16)) * Mat4::from_rotation_x(0.06), metal);
  388. push_xform_box(v, idx, Vec3::new(0.009, 0.009, 0.116), Mat4::from_translation(Vec3::new(0.0, -0.026, -0.162)) * Mat4::from_rotation_x(-0.24), metal);
  389. push_aabb(v, idx, Vec3::new(-0.015, -0.062, -0.278), Vec3::new(0.015, 0.030, -0.258), metal);
  390. // Compact receiver + top cover + rear flip sight
  391. push_aabb(v, idx, Vec3::new(-0.020, -0.018, -0.052), Vec3::new(0.020, 0.032, 0.165), metal);
  392. push_aabb(v, idx, Vec3::new(-0.017, 0.032, -0.050), Vec3::new(0.017, 0.054, 0.155), metal);
  393. // Bakelite grip & curved mag
  394. push_xform_box(v, idx, Vec3::new(0.013, 0.048, 0.016), Mat4::from_translation(Vec3::new(0.0, -0.054, -0.020)) * Mat4::from_rotation_x(0.32), bake);
  395. push_curved_mag(v, idx, Vec3::new(0.0, -0.018, 0.102), 3, 0.060, 0.11, (0.013, 0.030), bake);
  396. // Stubby wooden handguard + short gas tube + conical Krinkov flash booster
  397. push_aabb(v, idx, Vec3::new(-0.018, -0.014, 0.165), Vec3::new(0.018, 0.019, 0.295), wood);
  398. push_aabb(v, idx, Vec3::new(-0.014, 0.020, 0.172), Vec3::new(0.014, 0.043, 0.290), wood);
  399. push_z_cylinder(v, idx, Vec2::new(0.0, 0.016), 0.165, 0.405, 0.010, 0.0095, 8, metal, false, false);
  400. // Iconic cylindrical expansion chamber + flared cone muzzle booster
  401. push_z_cylinder(v, idx, Vec2::new(0.0, 0.016), 0.405, 0.455, 0.014, 0.014, 8, metal, true, false);
  402. push_z_cylinder(v, idx, Vec2::new(0.0, 0.016), 0.455, 0.495, 0.013, 0.019, 8, metal, false, true);
  403. push_ak_iron_sights(v, idx, 0.040, 0.390, 0.085, metal);
  404. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  405. }
  406. // ============================================================================
  407. // 4. PKM (7.62x54mmR) — Heavy Feed Cover, Skeleton Wood Stock, 100-rd Belt Box & Bipod
  408. // ============================================================================
  409. pub fn push_weapon_pkm(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  410. let off = idx.len() as u32;
  411. let metal = MaterialId::Gunmetal;
  412. let steel = MaterialId::SteelHulk;
  413. let wood = MaterialId::WoodFurniture;
  414. let brass = MaterialId::Sandbag;
  415. // Skeletonized wood buttstock
  416. push_aabb(v, idx, Vec3::new(-0.017, 0.004, -0.29), Vec3::new(0.017, 0.032, -0.06), wood);
  417. push_xform_box(v, idx, Vec3::new(0.016, 0.014, 0.11), Mat4::from_translation(Vec3::new(0.0, -0.045, -0.175)) * Mat4::from_rotation_x(-0.18), wood);
  418. push_aabb(v, idx, Vec3::new(-0.018, -0.072, -0.305), Vec3::new(0.018, 0.034, -0.265), wood);
  419. // Heavy rectangular receiver + hinged ribbed feed tray cover
  420. push_aabb(v, idx, Vec3::new(-0.028, -0.028, -0.06), Vec3::new(0.028, 0.040, 0.275), metal);
  421. push_aabb(v, idx, Vec3::new(-0.024, 0.040, -0.045), Vec3::new(0.024, 0.068, 0.245), metal);
  422. // Pistol grip + angled carry handle
  423. push_xform_box(v, idx, Vec3::new(0.014, 0.052, 0.018), Mat4::from_translation(Vec3::new(0.0, -0.062, -0.025)) * Mat4::from_rotation_x(0.28), metal);
  424. push_xform_box(v, idx, Vec3::new(0.008, 0.008, 0.055), Mat4::from_translation(Vec3::new(0.028, 0.060, 0.30)) * Mat4::from_rotation_z(-0.5), wood);
  425. // Suspended 100-rd olive steel ammo box + visible brass belt strip
  426. push_aabb(v, idx, Vec3::new(-0.056, -0.165, 0.045), Vec3::new(0.046, -0.030, 0.205), steel);
  427. push_aabb(v, idx, Vec3::new(0.026, -0.035, 0.11), Vec3::new(0.044, 0.032, 0.175), brass);
  428. // Heavy fluted barrel + under-barrel gas cylinder + slotted flash hider
  429. push_z_cylinder(v, idx, Vec2::new(0.0, 0.020), 0.27, 0.79, 0.014, 0.012, 8, metal, false, false);
  430. push_z_cylinder(v, idx, Vec2::new(0.0, -0.008), 0.24, 0.56, 0.011, 0.011, 6, metal, true, true);
  431. push_z_cylinder(v, idx, Vec2::new(0.0, 0.020), 0.79, 0.885, 0.0155, 0.0155, 8, metal, true, true);
  432. // Folded twin bipod legs tucked along gas block
  433. push_aabb(v, idx, Vec3::new(-0.026, -0.032, 0.32), Vec3::new(-0.014, -0.014, 0.56), metal);
  434. push_aabb(v, idx, Vec3::new(0.014, -0.032, 0.32), Vec3::new(0.026, -0.014, 0.56), metal);
  435. push_ak_iron_sights(v, idx, -0.015, 0.755, 0.106, metal);
  436. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  437. }
  438. // ============================================================================
  439. // 5. SVD Dragunov (7.62x54mmR) — Thumbhole Stock, Slender Barrel & PSO-1 4x Scope
  440. // ============================================================================
  441. pub fn push_weapon_svd(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  442. let off = idx.len() as u32;
  443. let metal = MaterialId::Gunmetal;
  444. let scope = MaterialId::SteelHulk;
  445. let wood = MaterialId::WoodFurniture;
  446. // Iconic skeletonized SVD thumbhole wood stock + padded cheekpiece
  447. push_aabb(v, idx, Vec3::new(-0.015, 0.010, -0.325), Vec3::new(0.015, 0.036, -0.045), wood);
  448. push_aabb(v, idx, Vec3::new(-0.016, 0.036, -0.25), Vec3::new(0.016, 0.056, -0.115), metal);
  449. push_xform_box(v, idx, Vec3::new(0.015, 0.014, 0.115), Mat4::from_translation(Vec3::new(0.0, -0.046, -0.205)) * Mat4::from_rotation_x(-0.18), wood);
  450. push_xform_box(v, idx, Vec3::new(0.014, 0.046, 0.018), Mat4::from_translation(Vec3::new(0.0, -0.034, -0.068)) * Mat4::from_rotation_x(0.26), wood);
  451. push_aabb(v, idx, Vec3::new(-0.017, -0.072, -0.338), Vec3::new(0.017, 0.038, -0.312), wood);
  452. // Long milled receiver + top cover + straight 10-rd magazine
  453. push_aabb(v, idx, Vec3::new(-0.018, -0.018, -0.055), Vec3::new(0.018, 0.032, 0.225), metal);
  454. push_aabb(v, idx, Vec3::new(-0.015, 0.032, -0.045), Vec3::new(0.015, 0.052, 0.195), metal);
  455. push_xform_box(v, idx, Vec3::new(0.012, 0.056, 0.036), Mat4::from_translation(Vec3::new(0.0, -0.068, 0.125)) * Mat4::from_rotation_x(-0.10), metal);
  456. // Long ventilated wooden handguard + slender barrel + long slotted flash hider
  457. push_aabb(v, idx, Vec3::new(-0.017, -0.010, 0.225), Vec3::new(0.017, 0.034, 0.505), wood);
  458. push_z_cylinder(v, idx, Vec2::new(0.0, 0.018), 0.22, 0.87, 0.010, 0.009, 8, metal, false, false);
  459. push_z_cylinder(v, idx, Vec2::new(0.0, 0.018), 0.87, 0.955, 0.013, 0.013, 8, metal, true, true);
  460. push_ak_iron_sights(v, idx, 0.215, 0.855, 0.082, metal);
  461. // Side-mounted PSO-1 4x24 Telescopic Optic (centered on optical axis y=0.122, rigidly clamped to receiver)
  462. // Solid L-shaped dovetail side bracket & dual scope rings
  463. push_aabb(v, idx, Vec3::new(0.015, 0.012, 0.040), Vec3::new(0.025, 0.118, 0.125), metal);
  464. push_aabb(v, idx, Vec3::new(-0.016, 0.098, 0.044), Vec3::new(0.025, 0.124, 0.068), metal);
  465. push_aabb(v, idx, Vec3::new(-0.016, 0.098, 0.102), Vec3::new(0.025, 0.124, 0.124), metal);
  466. // Main PSO-1 tube + objective bell + dark rubber eyecup + elevation/windage turrets
  467. push_z_cylinder(v, idx, Vec2::new(0.0, 0.122), -0.025, 0.175, 0.015, 0.015, 8, scope, true, false);
  468. push_z_cylinder(v, idx, Vec2::new(0.0, 0.122), 0.175, 0.255, 0.015, 0.022, 8, scope, false, true);
  469. push_z_cylinder(v, idx, Vec2::new(0.0, 0.122), -0.075, -0.025, 0.019, 0.015, 8, metal, true, false);
  470. push_aabb(v, idx, Vec3::new(-0.007, 0.136, 0.068), Vec3::new(0.007, 0.149, 0.088), metal);
  471. push_aabb(v, idx, Vec3::new(-0.024, 0.114, 0.068), Vec3::new(-0.014, 0.130, 0.088), metal);
  472. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  473. }
  474. // ============================================================================
  475. // 6. RPG-7V — Flared Venturi Tube, Wood Heat Shields & Separable PG-7V Warhead
  476. // ============================================================================
  477. pub fn push_weapon_rpg_tube(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  478. let off = idx.len() as u32;
  479. let metal = MaterialId::Gunmetal;
  480. let steel = MaterialId::SteelHulk;
  481. let wood = MaterialId::WoodFurniture;
  482. // Rear Venturi cone -> narrow waist -> main steel tube -> flared front collar
  483. push_z_cylinder(v, idx, Vec2::ZERO, -0.58, -0.44, 0.044, 0.026, 8, metal, true, false);
  484. push_z_cylinder(v, idx, Vec2::ZERO, -0.44, -0.28, 0.026, 0.028, 8, steel, false, false);
  485. push_z_cylinder(v, idx, Vec2::ZERO, -0.28, 0.42, 0.028, 0.028, 8, steel, false, false);
  486. push_z_cylinder(v, idx, Vec2::ZERO, 0.42, 0.47, 0.032, 0.035, 8, metal, true, true);
  487. // Mid-tube laminated wood heat-shield staves
  488. push_z_cylinder(v, idx, Vec2::ZERO, -0.20, 0.08, 0.033, 0.033, 8, wood, true, true);
  489. // Front pistol grip/trigger housing + rear steadying grip
  490. push_xform_box(v, idx, Vec3::new(0.014, 0.056, 0.018), Mat4::from_translation(Vec3::new(0.0, -0.072, 0.175)) * Mat4::from_rotation_x(0.18), wood);
  491. push_xform_box(v, idx, Vec3::new(0.013, 0.048, 0.016), Mat4::from_translation(Vec3::new(0.0, -0.064, -0.06)) * Mat4::from_rotation_x(0.12), metal);
  492. push_aabb(v, idx, Vec3::new(-0.008, -0.056, 0.115), Vec3::new(0.008, -0.026, 0.205), metal);
  493. // Open-frame folding iron ladder sight (rear notch + open front protective frame & post)
  494. push_aabb(v, idx, Vec3::new(-0.009, 0.026, 0.138), Vec3::new(-0.004, 0.114, 0.148), metal);
  495. push_aabb(v, idx, Vec3::new(0.004, 0.026, 0.138), Vec3::new(0.009, 0.114, 0.148), metal);
  496. push_aabb(v, idx, Vec3::new(-0.009, 0.026, 0.138), Vec3::new(0.009, 0.098, 0.148), metal);
  497. push_aabb(v, idx, Vec3::new(-0.009, 0.026, 0.428), Vec3::new(-0.006, 0.115, 0.438), metal);
  498. push_aabb(v, idx, Vec3::new(0.006, 0.026, 0.428), Vec3::new(0.009, 0.115, 0.438), metal);
  499. push_aabb(v, idx, Vec3::new(-0.009, 0.026, 0.428), Vec3::new(0.009, 0.058, 0.438), metal);
  500. push_aabb(v, idx, Vec3::new(-0.0015, 0.058, 0.430), Vec3::new(0.0015, 0.112, 0.436), metal);
  501. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  502. }
  503. pub fn push_weapon_rpg_warhead(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  504. let off = idx.len() as u32;
  505. let warhead = MaterialId::SteelHulk;
  506. let fuze = MaterialId::Gunmetal;
  507. // Rocket motor stem protruding from muzzle -> expanding cone -> main HEAT warhead -> tapered nose + piezo probe
  508. push_z_cylinder(v, idx, Vec2::ZERO, 0.44, 0.54, 0.021, 0.022, 8, fuze, true, false);
  509. push_z_cylinder(v, idx, Vec2::ZERO, 0.54, 0.62, 0.022, 0.048, 8, warhead, false, false);
  510. push_z_cylinder(v, idx, Vec2::ZERO, 0.62, 0.68, 0.048, 0.048, 8, warhead, false, false);
  511. push_z_cylinder(v, idx, Vec2::ZERO, 0.68, 0.77, 0.048, 0.015, 8, warhead, false, false);
  512. push_z_cylinder(v, idx, Vec2::ZERO, 0.77, 0.85, 0.015, 0.008, 6, fuze, false, true);
  513. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  514. }
  515. // ============================================================================
  516. // First-Person Viewmodel Helper Meshes (Camo Sleeves, Gloved Hands, Flash Star)
  517. // ============================================================================
  518. /// Builds two camo-sleeved forearms reaching toward pistol grip & handguard in weapon-local space.
  519. pub fn push_vm_sleeve_arms(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  520. let off = idx.len() as u32;
  521. let m = MaterialId::FloraCamo;
  522. // Right forearm: rear-right hip up to pistol grip
  523. push_xform_box(
  524. v,
  525. idx,
  526. Vec3::new(0.036, 0.034, 0.145),
  527. Mat4::from_translation(Vec3::new(-0.075, -0.115, -0.135))
  528. * Mat4::from_rotation_y(0.42)
  529. * Mat4::from_rotation_x(0.36),
  530. m,
  531. );
  532. // Left support forearm: tucked smoothly under the front handguard
  533. push_xform_box(
  534. v,
  535. idx,
  536. Vec3::new(0.036, 0.034, 0.165),
  537. Mat4::from_translation(Vec3::new(0.105, -0.115, 0.085))
  538. * Mat4::from_rotation_y(-0.58)
  539. * Mat4::from_rotation_x(0.30),
  540. m,
  541. );
  542. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  543. }
  544. /// Builds dark leather/wool gloved hands cradling the pistol grip & lower handguard.
  545. pub fn push_vm_gloves(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  546. let off = idx.len() as u32;
  547. let g = MaterialId::Gunmetal;
  548. push_xform_box(
  549. v,
  550. idx,
  551. Vec3::new(0.018, 0.026, 0.026),
  552. Mat4::from_translation(Vec3::new(0.0, -0.052, -0.020)) * Mat4::from_rotation_x(0.28),
  553. g,
  554. );
  555. push_xform_box(
  556. v,
  557. idx,
  558. Vec3::new(0.021, 0.018, 0.036),
  559. Mat4::from_translation(Vec3::new(0.004, -0.026, 0.250)) * Mat4::from_rotation_y(-0.12),
  560. g,
  561. );
  562. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  563. }
  564. /// Builds a compact 3D starburst flash mesh centered at origin (rendered near weapon muzzle).
  565. pub fn push_vm_muzzle_flash(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  566. let off = idx.len() as u32;
  567. let m = MaterialId::Sandbag;
  568. push_xform_box(v, idx, Vec3::new(0.095, 0.014, 0.045), Mat4::IDENTITY, m);
  569. push_xform_box(v, idx, Vec3::new(0.014, 0.095, 0.045), Mat4::IDENTITY, m);
  570. push_xform_box(v, idx, Vec3::new(0.065, 0.014, 0.055), Mat4::from_rotation_z(0.785), m);
  571. push_xform_box(v, idx, Vec3::new(0.014, 0.065, 0.055), Mat4::from_rotation_z(0.785), m);
  572. MeshSlice { index_offset: off, index_count: idx.len() as u32 - off }
  573. }
  574. }
  575. #[cfg(feature = "cold_water_assets")]
  576. pub use cold_water_weapon_meshes::*;
  577. #[cfg(not(feature = "cold_water_assets"))]
  578. mod engine_weapon_fallbacks {
  579. use glam::Vec3;
  580. use crate::core::materials::MaterialId;
  581. use crate::world::actors_mesh::MeshSlice;
  582. use crate::world::ActorVertex;
  583. fn push_neutral_box(
  584. vertices: &mut Vec<ActorVertex>,
  585. indices: &mut Vec<u32>,
  586. min: Vec3,
  587. max: Vec3,
  588. mat: MaterialId,
  589. ) {
  590. let c = [
  591. Vec3::new(min.x, min.y, max.z),
  592. Vec3::new(max.x, min.y, max.z),
  593. Vec3::new(max.x, max.y, max.z),
  594. Vec3::new(min.x, max.y, max.z),
  595. Vec3::new(min.x, min.y, min.z),
  596. Vec3::new(max.x, min.y, min.z),
  597. Vec3::new(max.x, max.y, min.z),
  598. Vec3::new(min.x, max.y, min.z),
  599. ];
  600. let faces = [
  601. ([0, 1, 2, 3], Vec3::Z),
  602. ([5, 4, 7, 6], -Vec3::Z),
  603. ([1, 5, 6, 2], Vec3::X),
  604. ([4, 0, 3, 7], -Vec3::X),
  605. ([3, 2, 6, 7], Vec3::Y),
  606. ([4, 5, 1, 0], -Vec3::Y),
  607. ];
  608. let uvs = [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]];
  609. let mat_id = mat.gpu_layer();
  610. for (f, n) in faces {
  611. let base = vertices.len() as u32;
  612. let wn = n.to_array();
  613. for k in 0..4 {
  614. vertices.push(ActorVertex {
  615. position: c[f[k]].to_array(),
  616. normal: wn,
  617. uv: uvs[k],
  618. mat_id,
  619. });
  620. }
  621. indices.extend_from_slice(&[base, base + 1, base + 2, base, base + 2, base + 3]);
  622. }
  623. }
  624. fn push_generic_rifle(
  625. v: &mut Vec<ActorVertex>,
  626. idx: &mut Vec<u32>,
  627. barrel_len: f32,
  628. heavy: bool,
  629. ) -> MeshSlice {
  630. let off = idx.len() as u32;
  631. let steel = MaterialId::SteelHulk;
  632. let body = MaterialId::Concrete;
  633. // Neutral receiver block
  634. push_neutral_box(
  635. v,
  636. idx,
  637. Vec3::new(-0.022, -0.020, -0.08),
  638. Vec3::new(0.022, 0.042, 0.20),
  639. steel,
  640. );
  641. // Neutral stock
  642. push_neutral_box(
  643. v,
  644. idx,
  645. Vec3::new(-0.016, -0.045, -0.28),
  646. Vec3::new(0.016, 0.032, -0.08),
  647. body,
  648. );
  649. // Neutral grip + magazine prism
  650. push_neutral_box(
  651. v,
  652. idx,
  653. Vec3::new(-0.014, -0.095, -0.03),
  654. Vec3::new(0.014, -0.018, 0.02),
  655. body,
  656. );
  657. push_neutral_box(
  658. v,
  659. idx,
  660. Vec3::new(-0.015, -0.145, 0.05),
  661. Vec3::new(0.015, -0.015, 0.12),
  662. steel,
  663. );
  664. // Neutral barrel + simple iron post
  665. let br = if heavy { 0.016 } else { 0.011 };
  666. push_neutral_box(
  667. v,
  668. idx,
  669. Vec3::new(-br, 0.008, 0.20),
  670. Vec3::new(br, 0.008 + br * 2.0, 0.20 + barrel_len),
  671. steel,
  672. );
  673. push_neutral_box(
  674. v,
  675. idx,
  676. Vec3::new(-0.002, 0.042, 0.18 + barrel_len),
  677. Vec3::new(0.002, 0.088, 0.19 + barrel_len),
  678. steel,
  679. );
  680. MeshSlice {
  681. index_offset: off,
  682. index_count: idx.len() as u32 - off,
  683. }
  684. }
  685. pub fn push_weapon_ak74m(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  686. push_generic_rifle(v, idx, 0.48, false)
  687. }
  688. pub fn push_weapon_akm(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  689. push_generic_rifle(v, idx, 0.46, false)
  690. }
  691. pub fn push_weapon_aks74u(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  692. push_generic_rifle(v, idx, 0.30, false)
  693. }
  694. pub fn push_weapon_pkm(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  695. push_generic_rifle(v, idx, 0.62, true)
  696. }
  697. pub fn push_weapon_svd(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  698. push_generic_rifle(v, idx, 0.68, false)
  699. }
  700. pub fn push_weapon_rpg_tube(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  701. let off = idx.len() as u32;
  702. push_neutral_box(
  703. v,
  704. idx,
  705. Vec3::new(-0.032, -0.032, -0.45),
  706. Vec3::new(0.032, 0.032, 0.48),
  707. MaterialId::SteelHulk,
  708. );
  709. MeshSlice {
  710. index_offset: off,
  711. index_count: idx.len() as u32 - off,
  712. }
  713. }
  714. pub fn push_weapon_rpg_warhead(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  715. let off = idx.len() as u32;
  716. push_neutral_box(
  717. v,
  718. idx,
  719. Vec3::new(-0.042, -0.042, 0.48),
  720. Vec3::new(0.042, 0.042, 0.80),
  721. MaterialId::Concrete,
  722. );
  723. MeshSlice {
  724. index_offset: off,
  725. index_count: idx.len() as u32 - off,
  726. }
  727. }
  728. pub fn push_vm_sleeve_arms(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  729. let off = idx.len() as u32;
  730. push_neutral_box(
  731. v,
  732. idx,
  733. Vec3::new(-0.11, -0.15, -0.26),
  734. Vec3::new(-0.04, -0.07, 0.0),
  735. MaterialId::Concrete,
  736. );
  737. push_neutral_box(
  738. v,
  739. idx,
  740. Vec3::new(0.06, -0.15, -0.06),
  741. Vec3::new(0.13, -0.07, 0.24),
  742. MaterialId::Concrete,
  743. );
  744. MeshSlice {
  745. index_offset: off,
  746. index_count: idx.len() as u32 - off,
  747. }
  748. }
  749. pub fn push_vm_gloves(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  750. let off = idx.len() as u32;
  751. push_neutral_box(
  752. v,
  753. idx,
  754. Vec3::new(-0.02, -0.08, -0.04),
  755. Vec3::new(0.02, -0.02, 0.01),
  756. MaterialId::SteelHulk,
  757. );
  758. push_neutral_box(
  759. v,
  760. idx,
  761. Vec3::new(-0.02, -0.05, 0.20),
  762. Vec3::new(0.02, -0.01, 0.28),
  763. MaterialId::SteelHulk,
  764. );
  765. MeshSlice {
  766. index_offset: off,
  767. index_count: idx.len() as u32 - off,
  768. }
  769. }
  770. pub fn push_vm_muzzle_flash(v: &mut Vec<ActorVertex>, idx: &mut Vec<u32>) -> MeshSlice {
  771. let off = idx.len() as u32;
  772. push_neutral_box(
  773. v,
  774. idx,
  775. Vec3::new(-0.07, -0.07, -0.03),
  776. Vec3::new(0.07, 0.07, 0.03),
  777. MaterialId::Sandbag,
  778. );
  779. MeshSlice {
  780. index_offset: off,
  781. index_count: idx.len() as u32 - off,
  782. }
  783. }
  784. }
  785. #[cfg(not(feature = "cold_water_assets"))]
  786. pub use engine_weapon_fallbacks::*;