physis/layer/
bg.rs

1// SPDX-FileCopyrightText: 2025 Joshua Goins <josh@redstrate.com>
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4use binrw::{binread, binrw};
5
6use super::{HeapString, StringHeap, read_bool_from};
7
8#[binrw]
9#[brw(repr = i32)]
10#[derive(Debug, PartialEq)]
11pub enum ModelCollisionType {
12    None = 0x0,
13    Replace = 0x1,
14    Box = 0x2,
15}
16
17#[binread]
18#[derive(Debug)]
19#[br(import(string_heap: &StringHeap))]
20#[br(little)]
21pub struct BGInstanceObject {
22    #[br(args(string_heap))]
23    pub asset_path: HeapString,
24    #[br(args(string_heap))]
25    pub collision_asset_path: HeapString,
26    pub collision_type: ModelCollisionType,
27    pub attribute_mask: u32,
28    pub attribute: u32,
29    pub collision_config: i32,
30    #[br(map = read_bool_from::<u8>)]
31    pub is_visible: bool,
32    #[br(map = read_bool_from::<u8>)]
33    pub render_shadow_enabled: bool,
34    #[br(map = read_bool_from::<u8>)]
35    pub render_light_shadow_enabeld: bool,
36    #[brw(pad_before = 1)] // padding
37    pub render_model_clip_range: f32,
38}