aboutsummaryrefslogtreecommitdiff
path: root/examples/render-quad/src/level.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:24 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:24 +0100
commit09a777d42d6301028cd3a8967ff6a82e703c8800 (patch)
tree79ac93287a15e8b0f90e1ac5d6981fa6eaeb6229 /examples/render-quad/src/level.rs
parent6367a9ba5a549b62f01da61fb50323877b9f52ff (diff)
refactor(all): remove levels and render
Diffstat (limited to 'examples/render-quad/src/level.rs')
-rw-r--r--examples/render-quad/src/level.rs79
1 files changed, 0 insertions, 79 deletions
diff --git a/examples/render-quad/src/level.rs b/examples/render-quad/src/level.rs
deleted file mode 100644
index 74d1cc3..0000000
--- a/examples/render-quad/src/level.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-use stockton_levels::parts::{
- data::{FaceRef, Geometry, TextureRef},
- HasFaces, HasTextures, HasVisData, IsFace, IsTexture,
-};
-use stockton_skeleton::components::{CameraSettings, Transform};
-
-pub struct DemoLevel {
- pub faces: Box<[Face]>,
- pub textures: Box<[Texture]>,
-}
-
-impl DemoLevel {
- fn face_idx(&self, search: &Face) -> FaceRef {
- for (idx, face) in self.faces.iter().enumerate() {
- if face == search {
- return idx as u32;
- }
- }
- panic!("face not in level")
- }
-}
-
-#[derive(Debug, Clone, PartialEq)]
-pub struct Face {
- pub geometry: Geometry,
- pub texture_idx: TextureRef,
-}
-
-impl HasFaces for DemoLevel {
- type Face = Face;
-
- fn get_face(&self, index: FaceRef) -> Option<&Self::Face> {
- self.faces.get(index as usize)
- }
-}
-
-impl IsFace<DemoLevel> for Face {
- fn index(&self, container: &DemoLevel) -> stockton_levels::parts::data::FaceRef {
- container.face_idx(self)
- }
-
- fn geometry(&self, _container: &DemoLevel) -> Geometry {
- self.geometry.clone()
- }
-
- fn texture_idx(&self, _container: &DemoLevel) -> TextureRef {
- self.texture_idx
- }
-}
-
-pub struct Texture {
- pub name: String,
-}
-
-impl HasTextures for DemoLevel {
- type Texture = Texture;
-
- fn get_texture(&self, idx: TextureRef) -> Option<&Self::Texture> {
- self.textures.get(idx as usize)
- }
-}
-
-impl IsTexture for Texture {
- fn name(&self) -> &str {
- &self.name
- }
-}
-
-impl<'a> HasVisData<'a> for DemoLevel {
- type Faces = std::ops::Range<FaceRef>;
-
- fn get_visible(
- &'a self,
- _transform: &Transform,
- _settings: &CameraSettings,
- ) -> Self::Faces {
- 0..self.faces.len() as u32
- }
-}