summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/eguictx.rs4
-rw-r--r--src/main.rs2
-rw-r--r--src/solar_system.rs95
-rw-r--r--src/solar_system/body.rs96
-rw-r--r--src/solar_system/orbit.rs64
-rw-r--r--src/solar_system/ship.rs34
-rw-r--r--src/tacmap.rs28
-rw-r--r--src/tacmap/body_render.rs24
-rw-r--r--src/tacmap/camera.rs6
-rw-r--r--src/tacmap/orbit_render.rs107
-rw-r--r--src/tacmap/render.rs4
-rw-r--r--src/texture.rs1
-rw-r--r--src/ui.rs5
-rw-r--r--src/ui/camera_info.rs2
-rw-r--r--src/ui/topbar.rs2
-rw-r--r--src/wgpuctx/mod.rs1
16 files changed, 308 insertions, 167 deletions
diff --git a/src/eguictx.rs b/src/eguictx.rs
index 572d352..3bc2841 100644
--- a/src/eguictx.rs
+++ b/src/eguictx.rs
@@ -1,7 +1,7 @@
use egui::{Context};
use egui_wgpu::Renderer;
use egui_winit::{EventResponse, State};
-use wgpu::{CommandEncoder, CommandEncoderDescriptor, Operations, RenderPassDescriptor, TextureView};
+use wgpu::{CommandEncoder, Operations, RenderPassDescriptor, TextureView};
use winit::{event::WindowEvent, window::{Theme, Window}};
use crate::wgpuctx::WgpuCtx;
@@ -113,7 +113,7 @@ impl EguiCtx
);
{
- let mut render_pass = encoder.begin_render_pass(&RenderPassDescriptor {
+ let render_pass = encoder.begin_render_pass(&RenderPassDescriptor {
label: Some("EguiCtx render pass"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view: view,
diff --git a/src/main.rs b/src/main.rs
index fad750d..923f357 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,7 +18,7 @@ use winit::event_loop::{EventLoop, ActiveEventLoop, ControlFlow};
use winit::error::{EventLoopError};
use winit::application::{ApplicationHandler};
use winit::keyboard::PhysicalKey;
-use winit::window::{Window, WindowId, WindowAttributes};
+use winit::window::WindowId;
use solar_system::*;
diff --git a/src/solar_system.rs b/src/solar_system.rs
index 81567d0..ad1f304 100644
--- a/src/solar_system.rs
+++ b/src/solar_system.rs
@@ -1,10 +1,13 @@
-pub mod orbit;
+pub mod body;
pub mod ship;
+pub mod orbit;
+
+use self::body::*;
+use self::ship::*;
+use self::orbit::*;
use serde::{Deserialize};
use crate::known_stars::*;
-use crate::solar_system::orbit::*;
-use crate::solar_system::ship::*;
use crate::timeman::Second;
use std::error::Error;
@@ -15,7 +18,6 @@ pub type Kilometers = f64;
pub type Percentage = f64;
pub type Angle = f64;
-pub type BodyId = usize;
pub type SystemId = usize;
#[derive(Debug, Deserialize)]
@@ -36,17 +38,6 @@ pub struct CSVOrbitalBody
semi_major_axis: Kilometers,
}
-pub struct OrbitalBody
-{
- name: String,
- mass: Kilograms,
- radius: Kilometers,
- sgp: f64,
-
- orbit: Option<StaticOrbit>,
- position: Option<cgmath::Vector3<Kilometers>>
-}
-
pub struct SolarSystem
{
id: SystemId,
@@ -73,7 +64,7 @@ impl SolarSystem
match record.orbits {
Some(orbits) => {
if record.sgp == 0.0 {
- record.sgp = (bodies[orbits].mass + record.mass) * GRAVITATIONAL_CONSTANT;
+ record.sgp = (bodies[orbits].mass() + record.mass) * GRAVITATIONAL_CONSTANT;
}
}
None => {}
@@ -81,22 +72,7 @@ impl SolarSystem
if record.radius == 0.0 { continue; }
println!("New body: {:?}", record);
- bodies.push(OrbitalBody {
- name: record.name,
- mass: record.mass,
- radius: record.radius,
- sgp: record.sgp,
- orbit: Some(StaticOrbit {
- parent: record.orbits,
- eccentricity: record.eccentricity,
- inclination: record.inclination,
- long_asc_node: record.long_asc_node,
- long_periapsis: record.long_periapsis,
- mean_long: record.mean_long,
- semi_major_axis: record.semi_major_axis
- }),
- position: None
- });
+ bodies.push(OrbitalBody::new_from_record(bodies.len(), record));
}
Ok(Self {
@@ -133,19 +109,7 @@ impl SolarSystem
body: &OrbitalBody)
-> cgmath::Vector3<Kilometers>
{
- match &body.orbit {
- Some(orbit) => {
- match orbit.parent {
- Some(parent) => {
- let this_pos = body.position();
- let parent_pos = self.bodies[parent].position();
- this_pos + parent_pos
- },
- None => body.position()
- }
- },
- None => body.position()
- }
+ body.absolute_position(self)
}
pub fn update(
@@ -153,46 +117,7 @@ impl SolarSystem
time: Second)
{
self.bodies.iter_mut().for_each(|body| {
- body.position = Some(body.calculate_orbit_at(time));
+ body.update(time);
});
}
}
-
-impl OrbitalBody
-{
- pub fn name(&self) -> &String { &self.name }
- pub fn radius(&self) -> f32 { self.radius as f32 }
- pub fn position(&self) -> cgmath::Vector3<f64> { self.position.unwrap() }
- pub fn does_orbit(&self) -> bool {
- match &self.orbit {
- Some(orbit) => orbit.parent.is_some(),
- None => false
- }
- }
- pub fn get_orbits(&self) -> Option<BodyId> {
- match &self.orbit {
- Some(orbit) => orbit.parent(),
- None => None
- }
- }
-
- pub fn orbital_period(&self) -> Second
- {
- match &self.orbit {
- Some(v) => v.period(self),
- None => return 0
- }
- }
-
- pub fn calculate_orbit_at(
- &self,
- time: Second)
- -> cgmath::Vector3<Kilometers>
- {
- match &self.orbit {
- Some(orbit) => orbit.calculate_position_at(self, time),
- None => cgmath::vec3(0.0, 0.0, 0.0)
- }
- }
-}
-
diff --git a/src/solar_system/body.rs b/src/solar_system/body.rs
new file mode 100644
index 0000000..55d3d4a
--- /dev/null
+++ b/src/solar_system/body.rs
@@ -0,0 +1,96 @@
+use super::*;
+
+pub type BodyId = usize;
+
+pub struct OrbitalBody
+{
+ id: BodyId,
+ name: String,
+ mass: Kilograms,
+ radius: Kilometers,
+ sgp: f64,
+
+ orbit: Option<StaticOrbit>,
+ rel_pos: Option<cgmath::Vector3<Kilometers>>
+}
+
+impl OrbitalBody
+{
+ pub fn new_from_record(
+ id: BodyId,
+ record: CSVOrbitalBody)
+ -> Self {
+ Self {
+ id: id,
+ name: record.name,
+ mass: record.mass,
+ radius: record.radius,
+ sgp: record.sgp,
+ orbit: match record.orbits {
+ Some(parent) => Some(StaticOrbit::new(
+ parent,
+ record.eccentricity,
+ record.inclination,
+ record.long_asc_node,
+ record.long_periapsis,
+ record.mean_long,
+ record.semi_major_axis
+ )),
+ None => None
+ },
+ rel_pos: None
+ }
+ }
+
+ pub fn id(&self) -> BodyId { self.id }
+ pub fn name(&self) -> &String { &self.name }
+ pub fn radius(&self) -> f32 { self.radius as f32 }
+ pub fn relative_position(&self) -> cgmath::Vector3<f64> { self.rel_pos.unwrap() }
+ pub fn mass(&self) -> Kilograms { self.mass }
+ pub fn sgp(&self) -> f64 { self.sgp }
+
+ pub fn absolute_position(
+ &self,
+ solar_system: &SolarSystem)
+ -> cgmath::Vector3<Kilometers>
+ {
+ match &self.orbit {
+ Some(orbit) => {
+ let parent_pos = solar_system.bodies()[orbit.parent()].absolute_position(solar_system);
+ parent_pos + self.relative_position()
+ },
+ None => self.relative_position()
+ }
+ }
+
+ pub fn get_orbit(&self) -> &Option<StaticOrbit> { &self.orbit }
+
+ pub fn orbital_period(
+ &self
+ ) -> Second
+ {
+ match &self.orbit {
+ Some(v) => v.period(self),
+ None => return 0
+ }
+ }
+
+ pub fn calculate_orbit_at(
+ &self,
+ time: Second)
+ -> cgmath::Vector3<Kilometers>
+ {
+ match &self.orbit {
+ Some(orbit) => orbit.calculate_position_at(self, time),
+ None => cgmath::vec3(0.0, 0.0, 0.0)
+ }
+ }
+
+ pub fn update(
+ &mut self,
+ time: Second)
+ {
+ self.rel_pos = Some(self.calculate_orbit_at(time));
+ }
+}
+
diff --git a/src/solar_system/orbit.rs b/src/solar_system/orbit.rs
index b042bd3..461de7b 100644
--- a/src/solar_system/orbit.rs
+++ b/src/solar_system/orbit.rs
@@ -1,29 +1,65 @@
-use crate::solar_system::{Angle, BodyId, Kilometers, OrbitalBody, Percentage};
+use crate::solar_system::{Angle, BodyId, Kilometers, OrbitalBody, Percentage, SolarSystem};
use crate::timeman::{Second};
pub struct StaticOrbit
{
- pub parent: Option<BodyId>,
- pub eccentricity: Percentage,
- pub inclination: Angle,
- pub long_asc_node: Angle,
- pub long_periapsis: Angle,
- pub mean_long: Angle,
-
- pub semi_major_axis: Kilometers,
+ parent: BodyId,
+ eccentricity: Percentage,
+ inclination: Angle,
+ long_asc_node: Angle,
+ long_periapsis: Angle,
+ mean_long: Angle,
+
+ semi_major_axis: Kilometers,
}
impl StaticOrbit
{
+ pub fn new(
+ parent: BodyId,
+ eccentricity: Percentage,
+ inclination: Angle,
+ long_asc_node: Angle,
+ long_periapsis: Angle,
+ mean_long: Angle,
+ semi_major_axis: Kilometers)
+ -> Self {
+ Self {
+ parent,
+ eccentricity,
+ inclination,
+ long_asc_node,
+ long_periapsis,
+ mean_long,
+ semi_major_axis
+ }
+ }
+
+ pub fn new_circular(
+ parent: &OrbitalBody,
+ radius: Kilometers)
+ -> Self
+ {
+ Self {
+ parent: parent.id(),
+ eccentricity: 1e-6,
+ inclination: 0.0,
+ long_asc_node: 0.0,
+ long_periapsis: 0.0,
+ mean_long: 0.0,
+ semi_major_axis: radius
+ }
+ }
+
pub fn period(
&self,
this_body: &OrbitalBody)
-> Second
{
- ((self.semi_major_axis.powf(3.0) / this_body.sgp).sqrt() * std::f64::consts::TAU) as Second
+ ((self.semi_major_axis.powf(3.0) / this_body.sgp()).sqrt() * std::f64::consts::TAU) as Second
}
- pub fn parent(&self) -> Option<BodyId> {
+ pub fn parent(&self) -> BodyId {
self.parent
}
@@ -33,17 +69,13 @@ impl StaticOrbit
time: Second)
-> cgmath::Vector3<f64>
{
- if self.parent.is_none() {
- return cgmath::Vector3::<f64>::new(0.0, 0.0, 0.0);
- }
-
let eccentricity = self.eccentricity;
let long_asc_node = self.long_asc_node;
let arg_periaps = self.long_periapsis - long_asc_node;
let sma_cubed = self.semi_major_axis.powf(3.0);
- let mean_motion = (this_body.sgp / sma_cubed).sqrt();
+ let mean_motion = (this_body.sgp() / sma_cubed).sqrt();
let mean_anomaly_epoch = self.mean_long - self.long_periapsis;
let mean_anomaly = mean_anomaly_epoch + (mean_motion * time as f64);
diff --git a/src/solar_system/ship.rs b/src/solar_system/ship.rs
index eb4cdf3..57c0184 100644
--- a/src/solar_system/ship.rs
+++ b/src/solar_system/ship.rs
@@ -1,4 +1,36 @@
+use crate::solar_system::{Kilograms, Kilometers, SolarSystem, body::BodyId, orbit::StaticOrbit};
+
+pub type ShipId = usize;
+
pub struct Ship
{
-
+ name: String,
+ mass: Kilograms,
+
+ position: cgmath::Vector3<Kilometers>,
+ velocity: cgmath::Vector3<f32>,
+ acceleration: cgmath::Vector3<f32>,
+
+ baked_orbit: Option<StaticOrbit>
+}
+
+impl Ship
+{
+ pub fn new(
+ name: String,
+ mass: Kilograms,
+ system: &SolarSystem,
+ orbiting: BodyId,
+ orbit_sma: Kilometers)
+ -> Self
+ {
+ Self {
+ name,
+ mass,
+ position: cgmath::vec3(0.0, 0.0, 0.0),
+ velocity: cgmath::vec3(0.0, 0.0, 0.0),
+ acceleration: cgmath::vec3(0.0, 0.0, 0.0),
+ baked_orbit: None
+ }
+ }
}
diff --git a/src/tacmap.rs b/src/tacmap.rs
index 8d9e2c4..c04cc92 100644
--- a/src/tacmap.rs
+++ b/src/tacmap.rs
@@ -117,12 +117,16 @@ impl TacticalMap
self.body_renderer.rebuild(wgpuctx, solar_system);
self.orbit_renderer.rebuild(wgpuctx, solar_system);
- self.orbit_renderer.update(wgpuctx, solar_system, timeman.seconds());
+ match self.orbit_renderer.update(wgpuctx, solar_system, timeman.seconds())
+ {
+ Ok(()) => {},
+ Err(e) => println!("Tactical map orbit render update error: {}", e)
+ }
match self.body_renderer.update(
wgpuctx, solar_system, timeman.seconds())
{
Ok(()) => {},
- Err(e) => println!("Tactical map render update error: {}", e)
+ Err(e) => println!("Tactical map body render update error: {}", e)
}
Ok(())
@@ -162,14 +166,28 @@ impl TacticalMap
let world_pos = solar_system.body_position(body);
let local_pos = world_pos - self.camera.get_abs_position();
- let relative_pos = body.position() * self.camera.get_scale() as f64;
- if relative_pos.magnitude() < 0.05 && relative_pos.magnitude() != 0.0
- { return; }
+ let origin_pos = match body.get_orbit() {
+ Some(orbit) => {
+ solar_system.body_position(&bodies[orbit.parent()])
+ },
+ None => cgmath::vec3(0.0, 0.0, 0.0)
+ };
+ let origin_local_pos = origin_pos - self.camera.get_abs_position();
let scaled_pos = local_pos * self.camera.get_scale() as f64;
+ let scaled_origin_pos = origin_local_pos * self.camera.get_scale() as f64;
let clip_pos = pv_matrix * scaled_pos.map(|v| { v as f32 }).extend(1.0);
+ let origin_clip_pos = pv_matrix * scaled_origin_pos.map(|v| { v as f32 }).extend(1.0);
+
let ndc_pos = clip_pos.truncate() / clip_pos.w;
+ let origin_ndc_pos = origin_clip_pos.truncate() / origin_clip_pos.w;
+
+ if (ndc_pos - origin_ndc_pos).magnitude() < 0.05 {
+ if ndc_pos != origin_ndc_pos {
+ return;
+ }
+ }
let screen_pos = egui::pos2(
((ndc_pos.x + 1.0) * 0.5) * screen_size.x,
diff --git a/src/tacmap/body_render.rs b/src/tacmap/body_render.rs
index 8b32532..92ac13f 100644
--- a/src/tacmap/body_render.rs
+++ b/src/tacmap/body_render.rs
@@ -1,7 +1,7 @@
use std::error::Error;
use crate::solar_system::Kilometers;
-use crate::timeman::Second;
+use crate::timeman::{SYSTEM_TICK_INTERVAL, Second};
use crate::wgpuctx::{WgpuCtx, pipeline::RenderPipelineBuilder};
use super::*;
@@ -92,6 +92,18 @@ impl BodyRenderer
return Ok(());
}
+ //Round to the nearest tick
+ let tick_time = match self.last_time {
+ Some(last_time) => {
+ let this_tick = time / SYSTEM_TICK_INTERVAL;
+ let last_tick = last_time / SYSTEM_TICK_INTERVAL;
+
+ if this_tick == last_tick { return Ok(()) }
+ this_tick * SYSTEM_TICK_INTERVAL
+ }
+ None => 0
+ };
+
self.last_time = Some(time);
let (_, bodies_buffer) = match &self.body_instance_buffer {
@@ -101,11 +113,11 @@ impl BodyRenderer
let bodies = solar_system.bodies();
let body_instances = bodies.iter().map(|body| {
- let position = body.position();
- let origin = match body.get_orbits() {
- Some(origin_id) => {
- let origin_body = &bodies[origin_id];
- origin_body.position()
+ let position = body.relative_position();
+ let origin = match body.get_orbit() {
+ Some(orbit) => {
+ let origin_body = &bodies[orbit.parent()];
+ origin_body.relative_position()
},
None => cgmath::Vector3::new(0.0, 0.0, 0.0)
};
diff --git a/src/tacmap/camera.rs b/src/tacmap/camera.rs
index 5efc24c..57856e2 100644
--- a/src/tacmap/camera.rs
+++ b/src/tacmap/camera.rs
@@ -4,7 +4,7 @@ use cgmath::{InnerSpace, Point3, Rad, Vector2, Vector3, perspective};
use winit::event::ElementState;
use winit::keyboard::KeyCode;
-use crate::solar_system::{self, BodyId, Kilometers, SolarSystem};
+use crate::solar_system::{self, Kilometers, SolarSystem};
use crate::ui;
use crate::wgpuctx::WgpuCtx;
@@ -16,7 +16,7 @@ pub struct Camera
yaw: Rad<f32>,
scale: f32,
- target: Option<solar_system::BodyId>,
+ target: Option<solar_system::body::BodyId>,
buffer: wgpu::Buffer,
staging_buffer: wgpu::Buffer,
@@ -166,7 +166,7 @@ impl Camera
pub fn set_target(
&mut self,
- target: Option<solar_system::BodyId>)
+ target: Option<solar_system::body::BodyId>)
{
if target == self.target { return; }
if !target.is_some() || !self.target.is_some() {
diff --git a/src/tacmap/orbit_render.rs b/src/tacmap/orbit_render.rs
index a6a90d1..c003366 100644
--- a/src/tacmap/orbit_render.rs
+++ b/src/tacmap/orbit_render.rs
@@ -1,6 +1,8 @@
+use std::error::Error;
+
use super::*;
-use crate::solar_system::BodyId;
+use crate::solar_system::body::{BodyId, OrbitalBody};
use crate::timeman::{SYSTEM_TICK_INTERVAL, Second};
use crate::wgpuctx::{WgpuCtx, pipeline::RenderPipelineBuilder};
@@ -68,6 +70,52 @@ impl OrbitRenderer
pub fn mark_to_rebuild(&mut self)
{ self.needs_rebuild = true; }
+ fn create_orbit_buffer_for_body(
+ &self,
+ wgpuctx: &WgpuCtx,
+ body: &OrbitalBody,
+ time: Second)
+ -> (usize, Option<wgpu::Buffer>)
+ {
+ let orbit = match body.get_orbit() {
+ Some(orbit) => orbit,
+ None => return (0, None)
+ };
+
+ let period = body.orbital_period();
+
+ let num_points = ((period / (SYSTEM_TICK_INTERVAL)) as usize).clamp(90, 360);
+ let period_interval = period as f64 / num_points as f64;
+
+ let mut points = vec![
+ OrbitVertex::default();(num_points+1)*2];
+
+ for i in 0..num_points {
+ let position = body.calculate_orbit_at(
+ time + (i as f64 * period_interval) as Second);
+
+ points[i*2].origin_id = orbit.parent() as _;
+ points[i*2].position = [
+ position.x as f32,
+ position.y as f32,
+ position.z as f32
+ ];
+
+ points[(i*2)+1] = points[i*2];
+ }
+ points[num_points*2] = points[0];
+ points[num_points*2+1] = points[1];
+
+ let buffer = wgpuctx.create_buffer_init(
+ &wgpu::util::BufferInitDescriptor {
+ label: None,
+ usage: wgpu::BufferUsages::VERTEX,
+ contents: bytemuck::cast_slice(&points)
+ }
+ );
+ ((num_points+1)*2, Some(buffer))
+ }
+
pub fn rebuild(
&mut self,
wgpuctx: &WgpuCtx,
@@ -123,41 +171,6 @@ impl OrbitRenderer
}
));
self.origin_buffer = Some(origin_buffer);
-
- self.orbit_vertex_buffers = Some(bodies.iter().map(|body| {
- if !body.does_orbit() { return (0, None); }
-
- let period = body.orbital_period();
- let num_points = ((period / (SYSTEM_TICK_INTERVAL)) as usize).clamp(180, 360*4);
- let period_interval = period as f64 / num_points as f64;
-
- let mut points = vec![
- OrbitVertex::default();(num_points+1)*2];
- for i in 0..num_points {
- let position = body.calculate_orbit_at(
- (i as f64 * period_interval) as Second);
-
- points[i*2].origin_id = body.get_orbits().unwrap() as _;
- points[i*2].position = [
- position.x as f32,
- position.y as f32,
- position.z as f32
- ];
-
- points[(i*2)+1] = points[i*2].clone();
- }
- points[num_points*2] = points[0].clone();
- points[num_points*2+1] = points[1].clone();
-
- let buffer = wgpuctx.create_buffer_init(
- &wgpu::util::BufferInitDescriptor {
- label: None,
- usage: wgpu::BufferUsages::VERTEX,
- contents: bytemuck::cast_slice(&points)
- }
- );
- ((num_points+1)*2, Some(buffer))
- }).collect::<Vec<_>>());
}
pub fn update(
@@ -165,11 +178,23 @@ impl OrbitRenderer
wgpuctx: &WgpuCtx,
solar_system: &SolarSystem,
time: Second)
+ -> Result<(), Box<dyn Error>>
{
if self.last_time.is_some_and(|t| { t == time }) {
- return;
+ return Ok(());
}
+ let tick_time = match self.last_time {
+ Some(last_time) => {
+ let this_tick = time / SYSTEM_TICK_INTERVAL;
+ let last_tick = last_time / SYSTEM_TICK_INTERVAL;
+
+ if this_tick == last_tick { return Ok(()) }
+ this_tick * SYSTEM_TICK_INTERVAL
+ }
+ None => 0
+ };
+
self.last_time = Some(time);
let positions = solar_system.bodies().iter().map(|body| {
let pos = solar_system.body_position(body);
@@ -180,8 +205,14 @@ impl OrbitRenderer
Some(buffer) => {
wgpuctx.queue().write_buffer(buffer, 0, bytemuck::cast_slice(&positions));
},
- None => { return; }
+ None => { return Err(Box::new(NeedsRebuildError)); }
};
+
+ let bodies = solar_system.bodies();
+ self.orbit_vertex_buffers = Some(bodies.iter().map(|body| {
+ self.create_orbit_buffer_for_body(wgpuctx, body, tick_time)
+ }).collect::<Vec<_>>());
+ Ok(())
}
pub fn render(
diff --git a/src/tacmap/render.rs b/src/tacmap/render.rs
index fd93941..58efae0 100644
--- a/src/tacmap/render.rs
+++ b/src/tacmap/render.rs
@@ -3,10 +3,8 @@ use std::error::Error;
use wgpu::RenderPass;
-use crate::solar_system::Kilometers;
use crate::tacmap::camera::Camera;
-use crate::timeman::{DAY, SYSTEM_TICK_INTERVAL};
-use crate::{solar_system::{SolarSystem, SystemId}, timeman::Second, vertex::{self, Vertex}, wgpuctx::{WgpuCtx, pipeline::RenderPipelineBuilder}};
+use crate::wgpuctx::{WgpuCtx, pipeline::RenderPipelineBuilder};
#[derive(Debug, Clone)]
pub struct NeedsRebuildError;
diff --git a/src/texture.rs b/src/texture.rs
index be07dd3..f5165a7 100644
--- a/src/texture.rs
+++ b/src/texture.rs
@@ -1,4 +1,3 @@
-use crate::wgpuctx::WgpuCtx;
pub struct Texture
{
diff --git a/src/ui.rs b/src/ui.rs
index ab75001..d6cbe7f 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -3,12 +3,11 @@ pub mod camera_info;
use std::cell::RefCell;
-use cgmath::Vector3;
-use crate::{GameState, eguictx::EguiCtx, solar_system, timeman::{self, Second, TimeMan}, ui::{camera_info::CameraWindowState, topbar::TopBarState}};
+use crate::{GameState, eguictx::EguiCtx, ui::{camera_info::CameraWindowState, topbar::TopBarState}};
mod ui {
- pub use super::camera_info;
+
}
#[derive(Default, Clone)]
diff --git a/src/ui/camera_info.rs b/src/ui/camera_info.rs
index fa46f50..8114f63 100644
--- a/src/ui/camera_info.rs
+++ b/src/ui/camera_info.rs
@@ -9,7 +9,7 @@ pub struct CameraWindowState
pub camera_scale: f32,
pub camera_pos: Option<cgmath::Vector3<f64>>,
pub camera_rot: Option<cgmath::Vector2<cgmath::Rad<f32>>>,
- pub target: Option<solar_system::BodyId>,
+ pub target: Option<solar_system::body::BodyId>,
}
impl CameraWindowState
diff --git a/src/ui/topbar.rs b/src/ui/topbar.rs
index faa809f..296a84e 100644
--- a/src/ui/topbar.rs
+++ b/src/ui/topbar.rs
@@ -1,6 +1,6 @@
use std::cell::RefCell;
-use crate::{GameState, eguictx::EguiCtx, solar_system::{SolarSystem, SystemId}, timeman::{self, Second, TimeMan}};
+use crate::{GameState, eguictx::EguiCtx, solar_system::SystemId, timeman::{self, Second, TimeMan}};
#[derive(Default, Clone)]
pub struct TopBarState
diff --git a/src/wgpuctx/mod.rs b/src/wgpuctx/mod.rs
index 5f26a99..5f8e381 100644
--- a/src/wgpuctx/mod.rs
+++ b/src/wgpuctx/mod.rs
@@ -1,5 +1,4 @@
use std::sync::Arc;
-use std::error::Error;
use wgpu::util::DeviceExt;
use winit::window::{Window};