diff --git a/Makefile b/Makefile index 5555260..ea1e0ac 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ SRC_CRATE = $(TARGET).rs EXTERN_DIR = $(ROOT_DIR)/extern BUILD_DIR = $(ROOT_DIR)/lib -CFG = --cfg=color --cfg=geom --cfg=noise --cfg=transform +CFG = --cfg=color --cfg=geom --cfg=noise --cfg=transform --cfg=space TEST = $(TARGET) TEST_BUILD_DIR = $(ROOT_DIR)/test diff --git a/src/core/core.rs b/src/core/core.rs index d9f0b99..846525f 100644 --- a/src/core/core.rs +++ b/src/core/core.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Core datatypes and conversion traits for 3D mathematics +//! Core datatypes and conversion traits for 3D mathematics pub use self::dim::Dimensional; pub use self::swap::Swap; diff --git a/src/geom/geom.rs b/src/geom/geom.rs index 80dc00e..8067480 100644 --- a/src/geom/geom.rs +++ b/src/geom/geom.rs @@ -13,18 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Types and traits for geometric intersections and transformations - pub use self::frustum::{Frustum, FrustumPoints}; pub use self::plane::Plane3; pub use self::point::{Point, Point2, Point3}; pub use self::ray::Ray3; +pub mod frustum; pub mod plane; pub mod point; pub mod ray; - -pub mod frustum; - -pub mod octree; -pub mod quadtree; diff --git a/src/lmath.rs b/src/lmath.rs index ed95591..a01ad87 100644 --- a/src/lmath.rs +++ b/src/lmath.rs @@ -41,3 +41,7 @@ pub mod noise; #[cfg(transform)] #[path = "transform/transform.rs"] pub mod transform; + +#[cfg(space)] +#[path = "space/space.rs"] +pub mod space; diff --git a/src/space/bsp.rs b/src/space/bsp.rs new file mode 100644 index 0000000..3c27ef9 --- /dev/null +++ b/src/space/bsp.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Lmath Developers. For a full listing of the authors, +// refer to the AUTHORS file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub struct BSP; diff --git a/src/geom/octree.rs b/src/space/octree.rs similarity index 97% rename from src/geom/octree.rs rename to src/space/octree.rs index 31a0028..f567e2a 100644 --- a/src/geom/octree.rs +++ b/src/space/octree.rs @@ -13,6 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// TODO - // http://gameprogrammingpatterns.com/spatial-partition.html + +pub struct Octree; diff --git a/src/geom/quadtree.rs b/src/space/quadtree.rs similarity index 97% rename from src/geom/quadtree.rs rename to src/space/quadtree.rs index cc94c55..448bb69 100644 --- a/src/geom/quadtree.rs +++ b/src/space/quadtree.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// TODO - // http://gameprogrammingpatterns.com/spatial-partition.html // http://github.com/mozilla/servo/blob/master/src/components/main/compositing/quadtree.rs + +pub struct Quadtree; diff --git a/src/space/space.rs b/src/space/space.rs new file mode 100644 index 0000000..17d80ab --- /dev/null +++ b/src/space/space.rs @@ -0,0 +1,24 @@ +// Copyright 2013 The Lmath Developers. For a full listing of the authors, +// refer to the AUTHORS file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Various data structures for space partitioning and visibility determination + +pub use self::bsp::BSP; +pub use self::octree::Octree; +pub use self::quadtree::Quadtree; + +pub mod bsp; +pub mod octree; +pub mod quadtree;