started adding spart, need to vendor and change it
This commit is contained in:
parent
583e541fbd
commit
16706c8338
4 changed files with 79 additions and 2 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
|
@ -336,8 +336,10 @@ dependencies = [
|
|||
"bevy",
|
||||
"dirs",
|
||||
"include_dir",
|
||||
"ordered-float",
|
||||
"rusqlite",
|
||||
"rusqlite_migration",
|
||||
"spart",
|
||||
"steel-core",
|
||||
]
|
||||
|
||||
|
|
@ -4793,6 +4795,16 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spart"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a05d85e94c16e35b2f963dee2eaa6f6b2494ee5dad740b045b139c5614872d6"
|
||||
dependencies = [
|
||||
"ordered-float",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.10.0"
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ edition = "2024"
|
|||
bevy = { version = "0.18", default-features = false, features = ["2d"] }
|
||||
dirs = "6.0.0"
|
||||
include_dir = "0.7.4"
|
||||
ordered-float = "5.1.0"
|
||||
rusqlite = { version = "0.37", default-features = false, features = ["bundled", "blob", "functions", "jiff"] }
|
||||
rusqlite_migration = { version = "2.3.0", features = ["from-directory"] }
|
||||
spart = "0.5.0"
|
||||
steel-core = { git="https://github.com/mattwparas/steel.git", branch = "master" }
|
||||
|
||||
# Enable a small amount of optimization in the dev profile.
|
||||
|
|
|
|||
63
src/geom.rs
Normal file
63
src/geom.rs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
use std::cmp::Ordering;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use ordered_float::OrderedFloat;
|
||||
use spart::{geometry::BoundingVolume, rstar_tree::RStarTreeObject};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Point {
|
||||
pub point: Vec2,
|
||||
pub entity: Entity,
|
||||
}
|
||||
|
||||
impl PartialEq for Point {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
OrderedFloat(self.point.x) == OrderedFloat(other.point.x)
|
||||
&& OrderedFloat(self.point.y) == OrderedFloat(other.point.y)
|
||||
&& self.entity == other.entity
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for Point {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
match (OrderedFloat(self.point.x), OrderedFloat(self.point.y))
|
||||
.partial_cmp(&(OrderedFloat(other.point.x), OrderedFloat(other.point.y)))
|
||||
{
|
||||
Some(Ordering::Equal) => self.entity.partial_cmp(&other.entity),
|
||||
other => other,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RStarTreeObject for Point {
|
||||
type B = PointBox;
|
||||
|
||||
fn mbr(&self) -> Self::B {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PointBox;
|
||||
|
||||
impl BoundingVolume for PointBox {
|
||||
fn area(&self) -> f64 {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn union(&self, other: &Self) -> Self {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn intersects(&self, other: &Self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn overlap(&self, other: &Self) -> f64 {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn margin(&self) -> f64 {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
//! Renders a 2D scene containing a single, moving sprite.
|
||||
use bevy::prelude::*;
|
||||
use db::init_db;
|
||||
|
||||
mod db;
|
||||
mod geom;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
@ -19,7 +19,7 @@ enum Direction {
|
|||
}
|
||||
|
||||
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
let conn = init_db().unwrap();
|
||||
let _conn = init_db().unwrap();
|
||||
commands.spawn(Camera2d);
|
||||
|
||||
commands.spawn((
|
||||
|
|
|
|||
Loading…
Reference in a new issue