Skip to content

Commit

Permalink
move all extension traits into utils
Browse files Browse the repository at this point in the history
  • Loading branch information
rlidwka committed Aug 6, 2023
1 parent a152cb9 commit e9bbddc
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/kinematic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::ffi::c_void;
use bevy::prelude::*;
use bevy::window::PrimaryWindow;
use bevy_mod_physx::prelude::{self as bpx, *};
use bevy_mod_physx::raycast::SceneQueryFilter;
use bevy_mod_physx::utils::get_actor_entity_from_ptr;
use bevy_mod_physx::utils::raycast::SceneQueryFilter;
use physx_sys::{PxFilterData, PxQueryHitType, PxRigidActor, PxShape};

#[derive(Component)]
Expand Down
1 change: 0 additions & 1 deletion examples/test_convex_shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use bevy::prelude::*;
use bevy::render::mesh::Indices;
use bevy::render::render_resource::PrimitiveTopology;
use bevy_mod_physx::assets::GeometryInner;
use bevy_mod_physx::physx_extras::ConvexMeshExtras;
use bevy_mod_physx::prelude::{self as bpx, *};

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use physx_sys::{
PxMeshScale_new_3,
};

use crate::physx_extras::HeightFieldSample;
use crate::utils::physx_extras::HeightFieldSample;
use crate::prelude::{self as bpx, *};
use crate::types::PxMaterial;

Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ pub mod components;
pub mod events;
pub mod plugins;
pub mod prelude;
pub mod raycast;
pub mod resources;
pub mod systems;
pub mod types;
Expand All @@ -58,7 +57,6 @@ pub mod utils;
// reexport physx to avoid version conflicts
pub use physx;
pub use physx_sys;
pub mod physx_extras;

use crate::prelude as bpx;
use crate::resources::{DefaultMaterial, DefaultMaterialHandle};
Expand Down
1 change: 0 additions & 1 deletion src/plugins/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use physx_sys::{

use crate::types::OnWakeSleep;
use crate::components::{ArticulationRootHandle, RigidDynamicHandle};
use crate::physx_extras::ActorMapExtras;
use crate::prelude::{Scene, *};

#[derive(Component, Debug, Default, PartialEq, Eq, Clone, Copy, Hash, Reflect)]
Expand Down
7 changes: 4 additions & 3 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
//! (e.g. [Material] vs [bevy::prelude::Material], [Scene] vs [bevy::prelude::Scene]).
//! Suggestions on how to resolve these conflicts are welcome.

pub use crate::utils::type_bridge::*;

pub use crate::{
FoundationDescriptor,
PhysicsCore,
Expand Down Expand Up @@ -47,5 +45,8 @@ pub use crate::plugins::shape_filter_data::ShapeFilterData;
pub use crate::plugins::sleep::{SleepControl, Sleeping};
pub use crate::plugins::velocity::{MaxVelocity, Velocity};

pub use crate::raycast::{RaycastHit, SceneQueryExt};
pub use crate::resources::{Physics, Scene};

pub use crate::utils::physx_extras::{ActorMapExtras, ConvexMeshExtras, HeightFieldExtras, TriangleMeshExtras};
pub use crate::utils::raycast::{RaycastHit, SceneQueryExt};
pub use crate::utils::type_bridge::*;
6 changes: 4 additions & 2 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Various helpers and extension traits.
pub mod physx_extras;
pub mod raycast;
pub mod type_bridge;

use bevy::prelude::*;
Expand All @@ -7,7 +9,7 @@ use physx_sys::PxBase_getConcreteType;

use crate::types::*;

/// Get actor [Entity] from raw PxRigidActor pointer from PhysX.
/// Get actor [Entity] from raw [PxRigidActor](physx_sys::PxRigidActor) pointer from PhysX.
///
/// # Safety
/// User must ensure that pointer is valid and created by bevy_mod_physx crate
Expand Down Expand Up @@ -49,7 +51,7 @@ pub unsafe fn get_actor_entity_from_ptr(actor: *const physx_sys::PxRigidActor) -
}
}

/// Get shape [Entity] from raw PxShape pointer from PhysX.
/// Get shape [Entity] from raw [PxShape](physx_sys::PxShape) pointer from PhysX.
///
/// # Safety
/// User must ensure that pointer is valid and created by bevy_mod_physx crate
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/raycast.rs → src/utils/raycast.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Extension trait for Scene that adds raycasts.
use std::ffi::c_void;
use std::mem::MaybeUninit;
use std::ptr::{drop_in_place, null_mut};
Expand Down

0 comments on commit e9bbddc

Please sign in to comment.