render iteration
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::entity::EntityHandle;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct CameraFollowComponent
|
||||
{
|
||||
pub target_entity: EntityHandle,
|
||||
pub offset: Vec3,
|
||||
pub is_following: bool,
|
||||
}
|
||||
|
||||
impl CameraFollowComponent
|
||||
{
|
||||
pub fn new(target_entity: EntityHandle) -> Self
|
||||
{
|
||||
Self {
|
||||
target_entity,
|
||||
offset: Vec3::ZERO,
|
||||
is_following: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_offset(target_entity: EntityHandle, offset: Vec3) -> Self
|
||||
{
|
||||
Self {
|
||||
target_entity,
|
||||
offset,
|
||||
is_following: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/components/dissolve.rs
Normal file
27
src/components/dissolve.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
pub struct DissolveComponent
|
||||
{
|
||||
pub amount: f32,
|
||||
pub target_amount: f32,
|
||||
pub transition_speed: f32,
|
||||
}
|
||||
|
||||
impl DissolveComponent
|
||||
{
|
||||
pub fn new() -> Self
|
||||
{
|
||||
Self {
|
||||
amount: 0.0,
|
||||
target_amount: 0.0,
|
||||
transition_speed: 3.0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_speed(transition_speed: f32) -> Self
|
||||
{
|
||||
Self {
|
||||
amount: 0.0,
|
||||
target_amount: 0.0,
|
||||
transition_speed,
|
||||
}
|
||||
}
|
||||
}
|
||||
10
src/components/follow.rs
Normal file
10
src/components/follow.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use crate::entity::EntityHandle;
|
||||
use crate::utility::transform::Transform;
|
||||
|
||||
pub struct FollowComponent
|
||||
{
|
||||
pub target: EntityHandle,
|
||||
pub offset: Transform,
|
||||
pub inherit_rotation: bool,
|
||||
pub inherit_scale: bool,
|
||||
}
|
||||
@@ -41,12 +41,7 @@ impl Default for JumpConfig
|
||||
max_air_momentum: 8.0,
|
||||
air_damping_active: 0.4,
|
||||
air_damping_passive: 0.9,
|
||||
jump_curve: CubicBez::new(
|
||||
(0.0, 0.0),
|
||||
(0.4, 0.75),
|
||||
(0.7, 0.9),
|
||||
(1.0, 1.0),
|
||||
),
|
||||
jump_curve: CubicBez::new((0.0, 0.0), (0.4, 0.75), (0.7, 0.9), (1.0, 1.0)),
|
||||
jump_context: JumpContext::default(),
|
||||
}
|
||||
}
|
||||
|
||||
18
src/components/lights/directional.rs
Normal file
18
src/components/lights/directional.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use glam::Vec3;
|
||||
|
||||
pub struct DirectionallightComponent
|
||||
{
|
||||
pub offset: Vec3,
|
||||
pub direction: Vec3,
|
||||
}
|
||||
|
||||
impl DirectionallightComponent
|
||||
{
|
||||
pub fn new(offset: Vec3, direction: Vec3) -> Self
|
||||
{
|
||||
Self {
|
||||
offset,
|
||||
direction: direction.normalize(),
|
||||
}
|
||||
}
|
||||
}
|
||||
3
src/components/lights/mod.rs
Normal file
3
src/components/lights/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod directional;
|
||||
pub mod point;
|
||||
pub mod spot;
|
||||
14
src/components/lights/point.rs
Normal file
14
src/components/lights/point.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use glam::Vec3;
|
||||
|
||||
pub struct PointlightComponent
|
||||
{
|
||||
pub offset: Vec3,
|
||||
}
|
||||
|
||||
impl PointlightComponent
|
||||
{
|
||||
pub fn new(offset: Vec3) -> Self
|
||||
{
|
||||
Self { offset }
|
||||
}
|
||||
}
|
||||
25
src/components/lights/spot.rs
Normal file
25
src/components/lights/spot.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use glam::Vec3;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct SpotlightComponent
|
||||
{
|
||||
pub offset: Vec3,
|
||||
pub direction: Vec3,
|
||||
pub range: f32,
|
||||
pub inner_angle: f32,
|
||||
pub outer_angle: f32,
|
||||
}
|
||||
|
||||
impl SpotlightComponent
|
||||
{
|
||||
pub fn new(offset: Vec3, direction: Vec3, range: f32, inner_angle: f32, outer_angle: f32) -> Self
|
||||
{
|
||||
Self {
|
||||
offset,
|
||||
direction: direction.normalize(),
|
||||
range,
|
||||
inner_angle,
|
||||
outer_angle,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,22 @@
|
||||
pub mod camera;
|
||||
pub mod camera_follow;
|
||||
pub mod dissolve;
|
||||
pub mod follow;
|
||||
pub mod input;
|
||||
pub mod jump;
|
||||
pub mod lights;
|
||||
pub mod mesh;
|
||||
pub mod movement;
|
||||
pub mod physics;
|
||||
pub mod player_tag;
|
||||
pub mod rotate;
|
||||
pub mod state_machine;
|
||||
pub mod tree_tag;
|
||||
|
||||
pub use camera::CameraComponent;
|
||||
pub use camera_follow::CameraFollowComponent;
|
||||
pub use dissolve::DissolveComponent;
|
||||
pub use follow::FollowComponent;
|
||||
pub use input::InputComponent;
|
||||
pub use mesh::MeshComponent;
|
||||
pub use movement::MovementComponent;
|
||||
pub use physics::PhysicsComponent;
|
||||
pub use rotate::RotateComponent;
|
||||
|
||||
@@ -43,7 +43,7 @@ impl MovementConfig
|
||||
(1.0, 1.0),
|
||||
),
|
||||
walking_damping: 0.8,
|
||||
max_walking_speed: 6.0,
|
||||
max_walking_speed: 12.0,
|
||||
idle_damping: 0.1,
|
||||
movement_context: MovementContext::new(),
|
||||
}
|
||||
|
||||
15
src/components/rotate.rs
Normal file
15
src/components/rotate.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use glam::Vec3;
|
||||
|
||||
pub struct RotateComponent
|
||||
{
|
||||
pub axis: Vec3,
|
||||
pub speed: f32,
|
||||
}
|
||||
|
||||
impl RotateComponent
|
||||
{
|
||||
pub fn new(axis: Vec3, speed: f32) -> Self
|
||||
{
|
||||
Self { axis, speed }
|
||||
}
|
||||
}
|
||||
1
src/components/tree_tag.rs
Normal file
1
src/components/tree_tag.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub struct TreeTag;
|
||||
Reference in New Issue
Block a user