Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor mods #77

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Here is a very sample example:
```rust
use glam::Mat4;
use ozz_animation_rs::*;
use ozz_animation_rs::math::*;
use std::cell::RefCell;
use std::rc::Rc;

Expand Down
1 change: 0 additions & 1 deletion demo/src/blend.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy::tasks::futures_lite::future::try_zip;
use ozz_animation_rs::math::*;
use ozz_animation_rs::*;
use std::sync::{Arc, RwLock};

Expand Down
1 change: 0 additions & 1 deletion demo/src/playback.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy::tasks::futures_lite::future::try_zip;
use ozz_animation_rs::math::*;
use ozz_animation_rs::*;
use std::sync::{Arc, RwLock};

Expand Down
1 change: 0 additions & 1 deletion demo/src/two_bone_ik.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bevy::prelude::*;
use ozz_animation_rs::math::*;
use ozz_animation_rs::*;
use std::sync::{Arc, RwLock};

Expand Down
31 changes: 15 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//! ```no_run
//! use glam::Mat4;
//! use ozz_animation_rs::*;
//! use ozz_animation_rs::math::*;
//! use std::cell::RefCell;
//! use std::rc::Rc;
//!
Expand Down Expand Up @@ -50,32 +49,32 @@
#![feature(const_collections_with_hasher)]
#![feature(portable_simd)]

mod animation;
mod archive;
mod base;
mod blending_job;
pub mod animation;
pub mod archive;
pub mod base;
pub mod blending_job;
mod endian;
mod ik_aim_job;
mod ik_two_bone_job;
mod local_to_model_job;
mod sampling_job;
mod skeleton;
mod skinning_job;
mod track;
mod track_sampling_job;
mod track_triggering_job;

pub mod ik_aim_job;
pub mod ik_two_bone_job;
pub mod local_to_model_job;
pub mod math;
#[cfg(all(feature = "wasm", feature = "nodejs"))]
pub mod nodejs;
pub mod sampling_job;
pub mod skeleton;
pub mod skinning_job;
pub mod track;
pub mod track_sampling_job;
pub mod track_triggering_job;

pub use animation::Animation;
pub use archive::{Archive, ArchiveRead};
pub use base::*;
pub use base::{OzzBuf, OzzError, OzzMutBuf, OzzObj, SKELETON_MAX_JOINTS, SKELETON_MAX_SOA_JOINTS, SKELETON_NO_PARENT};
pub use blending_job::{BlendingContext, BlendingJob, BlendingJobArc, BlendingJobRc, BlendingJobRef, BlendingLayer};
pub use ik_aim_job::IKAimJob;
pub use ik_two_bone_job::IKTwoBoneJob;
pub use local_to_model_job::{LocalToModelJob, LocalToModelJobArc, LocalToModelJobRc, LocalToModelJobRef};
pub use math::{SoaMat4, SoaQuat, SoaTransform, SoaVec3};
pub use sampling_job::{
InterpSoaFloat3, InterpSoaQuaternion, SamplingContext, SamplingJob, SamplingJobArc, SamplingJobRc, SamplingJobRef,
};
Expand Down
32 changes: 16 additions & 16 deletions src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ use std::simd::*;
use crate::archive::{Archive, ArchiveRead};
use crate::base::OzzError;

pub const ZERO: f32x4 = f32x4::from_array([0.0; 4]);
pub const ONE: f32x4 = f32x4::from_array([1.0; 4]);
pub const TWO: f32x4 = f32x4::from_array([2.0; 4]);
pub const THREE: f32x4 = f32x4::from_array([3.0; 4]);
pub const NEG_ONE: f32x4 = f32x4::from_array([-1.0; 4]);
pub const FRAC_1_2: f32x4 = f32x4::from_array([0.5; 4]);
pub const PI: f32x4 = f32x4::from_array([core::f32::consts::PI; 4]);
pub const FRAC_2_PI: f32x4 = f32x4::from_array([core::f32::consts::FRAC_2_PI; 4]);
pub const FRAC_PI_2: f32x4 = f32x4::from_array([core::f32::consts::FRAC_PI_2; 4]);

pub const X_AXIS: f32x4 = f32x4::from_array([1.0, 0.0, 0.0, 0.0]);
pub const Y_AXIS: f32x4 = f32x4::from_array([0.0, 1.0, 0.0, 0.0]);
pub const Z_AXIS: f32x4 = f32x4::from_array([0.0, 0.0, 1.0, 0.0]);

pub const QUAT_UNIT: f32x4 = f32x4::from_array([0.0, 0.0, 0.0, 1.0]);
pub(crate) const ZERO: f32x4 = f32x4::from_array([0.0; 4]);
pub(crate) const ONE: f32x4 = f32x4::from_array([1.0; 4]);
pub(crate) const TWO: f32x4 = f32x4::from_array([2.0; 4]);
pub(crate) const THREE: f32x4 = f32x4::from_array([3.0; 4]);
pub(crate) const NEG_ONE: f32x4 = f32x4::from_array([-1.0; 4]);
pub(crate) const FRAC_1_2: f32x4 = f32x4::from_array([0.5; 4]);
pub(crate) const PI: f32x4 = f32x4::from_array([core::f32::consts::PI; 4]);
pub(crate) const FRAC_2_PI: f32x4 = f32x4::from_array([core::f32::consts::FRAC_2_PI; 4]);
pub(crate) const FRAC_PI_2: f32x4 = f32x4::from_array([core::f32::consts::FRAC_PI_2; 4]);

pub(crate) const X_AXIS: f32x4 = f32x4::from_array([1.0, 0.0, 0.0, 0.0]);
pub(crate) const Y_AXIS: f32x4 = f32x4::from_array([0.0, 1.0, 0.0, 0.0]);
pub(crate) const Z_AXIS: f32x4 = f32x4::from_array([0.0, 0.0, 1.0, 0.0]);

pub(crate) const QUAT_UNIT: f32x4 = f32x4::from_array([0.0, 0.0, 0.0, 1.0]);

const SIGN: i32x4 = i32x4::from_array([core::i32::MIN; 4]);
const SIGN_W: i32x4 = i32x4::from_array([0, 0, 0, core::i32::MIN]);
Expand Down Expand Up @@ -708,7 +708,7 @@ impl AosMat4 {
}

//
// SoaVec3
// SoaMat4
//
#[repr(C)]
#[derive(Debug, Default, Clone, Copy, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion tests/additive.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use glam::{Mat4, Vec4};
use ozz_animation_rs::math::*;
use ozz_animation_rs::math::f32_cos;
use ozz_animation_rs::*;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
1 change: 0 additions & 1 deletion tests/blend.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use glam::Mat4;
use ozz_animation_rs::math::*;
use ozz_animation_rs::*;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
2 changes: 1 addition & 1 deletion tests/look_at.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use glam::{Mat4, Quat, Vec3A};
use ozz_animation_rs::math::*;
use ozz_animation_rs::math::{f32_cos, f32_sin};
use ozz_animation_rs::*;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
1 change: 0 additions & 1 deletion tests/partial_blend.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use glam::{Mat4, Vec4};
use ozz_animation_rs::math::*;
use ozz_animation_rs::*;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
1 change: 0 additions & 1 deletion tests/playback.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use glam::Mat4;
use ozz_animation_rs::math::*;
use ozz_animation_rs::*;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
2 changes: 1 addition & 1 deletion tests/two_bone_ik.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use glam::{Mat4, Quat, Vec3A};
use ozz_animation_rs::math::*;
use ozz_animation_rs::math::f32_cos;
use ozz_animation_rs::*;
use std::cell::RefCell;
use std::rc::Rc;
Expand Down
Loading