Publish structs
This commit is contained in:
parent
455b69d447
commit
13da06b294
|
|
@ -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<Ray>,
|
||||
objects: Vec<Hit>,
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FlatTraceResult {
|
||||
pub end: Option<Ray>,
|
||||
pub objects: Vec<Hit>,
|
||||
}
|
||||
|
||||
fn draw_ray_2(gc: &mut Vec<Draw>, 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 }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user