From 13da06b2945f96212a65f009f1d846cd92ced7e0 Mon Sep 17 00:00:00 2001 From: numzero Date: Tue, 25 Jun 2024 13:07:03 +0300 Subject: [PATCH] Publish structs --- src/bin/flat/main.rs | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/bin/flat/main.rs b/src/bin/flat/main.rs index e3f5cb4..948b208 100644 --- a/src/bin/flat/main.rs +++ b/src/bin/flat/main.rs @@ -105,30 +105,32 @@ pub fn main() { } #[derive(Copy, Clone, Debug)] -struct Location { +pub struct Location { /// Положение в основной СК - pos: Vec2, + pub pos: Vec2, /// Преобразование вектора из локальной ортонормированной в основную СК - rot: Mat2, + pub rot: Mat2, } #[derive(Copy, Clone, Debug)] -struct Object { - id: i32, - loc: Location, - r: f32, +pub struct Object { + pub id: i32, + pub loc: Location, + pub r: f32, } -struct Hit { - distance: f32, - id: i32, - pos: Vec2, // положение в основной СК - rel: Ray, // в локальной ортонормированной СК объекта +#[derive(Copy, Clone, Debug)] +pub struct Hit { + pub distance: f32, + pub id: i32, + pub pos: Vec2, // положение в основной СК + pub rel: Ray, // в локальной ортонормированной СК объекта } -struct FlatTraceResult { - end: Option, - objects: Vec, +#[derive(Clone, Debug)] +pub struct FlatTraceResult { + pub end: Option, + pub objects: Vec, } fn draw_ray_2(gc: &mut Vec, space: &Space, base: Vec2, dir: Vec2) { @@ -277,13 +279,13 @@ impl Renderable for Tube { } #[derive(Copy, Clone, Debug, PartialEq)] -struct Ray { - pos: Vec2, - dir: Vec2, +pub struct Ray { + pub pos: Vec2, + pub dir: Vec2, } impl Ray { - fn forward(&self, dist: f32) -> Ray { + pub fn forward(&self, dist: f32) -> Ray { Ray { pos: self.pos + self.dir * dist, dir: self.dir } } }