Skip to content

Commit

Permalink
add rest of vrm0 schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Oct 29, 2023
1 parent 9ff71ed commit a40e039
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
36 changes: 26 additions & 10 deletions src/extensions/vrm0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ pub struct Vrm {
#[nserde(rename = "exporterVersion")]
pub exporter_version: Option<String>,
#[nserde(rename = "specVersion")]
pub spec_version: String,
pub meta: Meta,
pub spec_version: Option<String>,
pub meta: Option<Meta>,
pub humanoid: Humanoid,
#[nserde(rename = "firstPerson")]
pub first_person: FirstPerson,
pub first_person: Option<FirstPerson>,
#[nserde(rename = "blendShapeMaster")]
pub blend_shape_master: BlendShapeMaster,
pub blend_shape_master: Option<BlendShapeMaster>,
#[nserde(rename = "secondaryAnimation")]
pub secondary_animation: SecondaryAnimation,
pub secondary_animation: Option<SecondaryAnimation>,
#[nserde(rename = "materialProperties")]
pub material_properties: Vec<MaterialProperty>,
pub material_properties: Option<Vec<MaterialProperty>>,
}

#[derive(DeJson, SerJson, Debug, Clone)]
Expand Down Expand Up @@ -80,9 +80,8 @@ pub struct FirstPerson {
pub first_person_bone: u32,
#[nserde(rename = "firstPersonBoneOffset")]
pub first_person_bone_offset: Vec3,
// todo
#[nserde(rename = "meshAnnotations")]
pub mesh_annotations: Vec<()>,
pub mesh_annotations: Vec<MeshAnnotation>,
#[nserde(rename = "lookAtTypeName")]
pub look_at_type_name: String,
#[nserde(rename = "lookAtHorizontalInner")]
Expand All @@ -95,6 +94,13 @@ pub struct FirstPerson {
pub look_at_vertical_up: LookAtCurve,
}

#[derive(DeJson, SerJson, Debug, Clone)]
pub struct MeshAnnotation {
pub mesh: u32,
#[nserde(rename = "firstPersonFlag")]
pub first_person_flag: String,
}

#[derive(DeJson, SerJson, Debug, Clone)]
pub struct LookAtCurve {
pub curve: [u32; 8],
Expand All @@ -116,9 +122,19 @@ pub struct BlendShapeGroup {
#[nserde(rename = "presetName")]
pub preset_name: String,
pub binds: Vec<Bind>,
// todo
#[nserde(rename = "materialValues")]
pub material_values: Vec<()>,
pub material_values: Vec<MaterialBind>,
pub is_binary: bool,
}

#[derive(DeJson, SerJson, Debug, Clone)]
pub struct MaterialBind {
#[nserde(rename = "materialName")]
pub material_name: String,
#[nserde(rename = "propertyName")]
pub property_name: String,
#[nserde(rename = "targetValue")]
pub target_value: Vec<f32>,
}

#[derive(DeJson, SerJson, Debug, Clone)]
Expand Down
2 changes: 0 additions & 2 deletions src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ impl AssetLoader for VRMLoader {

#[derive(Default, Debug, Clone, DeJson)]
pub struct RootExtensions {
#[nserde(rename = "KHR_lights_punctual")]
pub khr_lights_punctual: Option<goth_gltf::extensions::KhrLightsPunctual>,
#[nserde(rename = "VRM")]
pub vrm0: Option<super::extensions::vrm0::Vrm>,
#[nserde(rename = "VRMC_vrm")]
Expand Down

0 comments on commit a40e039

Please sign in to comment.