bitflags 2

This commit is contained in:
Robin Appelman 2023-12-27 20:53:56 +01:00
commit 31fc82bbdb
5 changed files with 29 additions and 19 deletions

4
Cargo.lock generated
View file

@ -2874,10 +2874,10 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "vmdl"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"arrayvec 0.7.4",
"bitflags 1.3.2",
"bitflags 2.4.1",
"bytemuck",
"cgmath",
"clap 4.4.11",

View file

@ -1,6 +1,6 @@
[package]
name = "vmdl"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
description = "Rust parser for valve model files."
repository = "https://github.com/icewind1991/vmdl"
@ -12,7 +12,7 @@ rust-version = "1.62.0"
arrayvec = "0.7.2"
thiserror = "1.0.37"
static_assertions = "1.1.0"
bitflags = "1.3.2"
bitflags = "2.4.1"
itertools = "0.12.0"
tracing = "0.1.37"
bytemuck = { version = "1.14.0", features = ["derive"] }

View file

@ -174,10 +174,12 @@ pub struct StudioHeader {
unused3: i32,
}
#[derive(Zeroable, Pod, Copy, Clone, Debug)]
#[repr(C)]
pub struct ModelFlags(u32);
bitflags! {
#[derive(Zeroable, Pod)]
#[repr(C)]
pub struct ModelFlags: u32 {
impl ModelFlags: u32 {
const AUTOGENERATED_HITBOX = 0x00000001;
const USES_ENV_CUBEMAP = 0x00000002;
const FORCE_OPAQUE = 0x00000004;

View file

@ -33,10 +33,12 @@ pub struct Bone {
reserved: [i32; 8], // remove as appropriate
}
#[derive(Zeroable, Pod, Copy, Clone, Debug)]
#[repr(C)]
pub struct BoneFlags(u32);
bitflags! {
#[derive(Zeroable, Pod)]
#[repr(C)]
pub struct BoneFlags: u32 {
impl BoneFlags: u32 {
const BONE_PHYSICALLY_SIMULATED = 0x00000001;
const BONE_PHYSICS_PROCEDURAL = 0x00000002;
const BONE_ALWAYS_PROCEDURAL = 0x00000004;

View file

@ -102,10 +102,12 @@ impl MeshHeader {
}
}
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
#[repr(C)]
pub struct MeshFlags(u8);
bitflags! {
#[derive(Zeroable, Pod)]
#[repr(C)]
pub struct MeshFlags: u8 {
impl MeshFlags: u8 {
const IS_TEETH = 0x01;
const IS_EYES = 0x02;
}
@ -149,10 +151,12 @@ impl StripGroupHeader {
}
}
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
#[repr(C)]
pub struct StripGroupFlags(u8);
bitflags! {
#[derive(Zeroable, Pod)]
#[repr(C)]
pub struct StripGroupFlags: u8 {
impl StripGroupFlags: u8 {
const IS_FLEXED = 0x01;
const IS_HWSKINNED = 0x02;
const IS_DELTA_FLEXED = 0x04;
@ -176,10 +180,12 @@ pub struct StripHeader {
static_assertions::const_assert_eq!(size_of::<StripHeader>(), 27);
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
#[repr(C)]
pub struct StripFlags(u8);
bitflags! {
#[derive(Zeroable, Pod)]
#[repr(C)]
pub struct StripFlags: u8 {
impl StripFlags: u8 {
const IS_TRI_LIST = 0x01;
const IS_TRI_STRIP = 0x02;
}