-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support grid view of cameras /w auto-yaw, position samplers (#25)
- Loading branch information
Showing
7 changed files
with
296 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: create a ZeroverseCamera abstraction to simplify viewer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
use bevy::prelude::*; | ||
|
||
pub mod room; | ||
|
||
|
||
pub struct ZeroverseScenePlugin; | ||
|
||
impl Plugin for ZeroverseScenePlugin { | ||
fn build(&self, app: &mut App) { | ||
app.add_plugins(( | ||
room::ZeroverseRoomPlugin, | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::{ | ||
material::ZeroverseMaterials, | ||
primitive::PrimitiveSettings, | ||
}; | ||
|
||
|
||
pub struct ZeroverseRoomPlugin; | ||
impl Plugin for ZeroverseRoomPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.register_type::<RoomSettings>(); | ||
|
||
app.add_systems(Update, process_rooms); | ||
} | ||
} | ||
|
||
|
||
#[derive(Clone, Component, Debug, Reflect, Resource)] | ||
#[reflect(Resource)] | ||
pub struct RoomSettings { | ||
pub base_settings: PrimitiveSettings, | ||
} | ||
|
||
impl Default for RoomSettings { | ||
fn default() -> RoomSettings { | ||
RoomSettings { | ||
base_settings: PrimitiveSettings::default(), | ||
} | ||
} | ||
} | ||
|
||
|
||
#[derive(Bundle, Default, Debug)] | ||
pub struct RoomBundle { | ||
pub settings: RoomSettings, | ||
pub spatial: SpatialBundle, | ||
} | ||
|
||
|
||
#[derive(Clone, Component, Debug, Reflect)] | ||
pub struct ZeroverseRoom; | ||
|
||
|
||
fn build_room( | ||
commands: &mut ChildBuilder, | ||
settings: &RoomSettings, | ||
meshes: &mut ResMut<Assets<Mesh>>, | ||
zeroverse_materials: &Res<ZeroverseMaterials>, | ||
) { | ||
let rng = &mut rand::thread_rng(); | ||
|
||
} | ||
|
||
|
||
fn process_rooms( | ||
mut commands: Commands, | ||
mut meshes: ResMut<Assets<Mesh>>, | ||
zeroverse_materials: Res<ZeroverseMaterials>, | ||
primitives: Query< | ||
( | ||
Entity, | ||
&RoomSettings, | ||
), | ||
Without<ZeroverseRoom>, | ||
>, | ||
) { | ||
for (entity, settings) in primitives.iter() { | ||
commands.entity(entity) | ||
.insert(ZeroverseRoom) | ||
.with_children(|subcommands| { | ||
build_room( | ||
subcommands, | ||
settings, | ||
&mut meshes, | ||
&zeroverse_materials, | ||
); | ||
}); | ||
} | ||
} |
Oops, something went wrong.