use std::time::Instant;
+use crate::{
+ fonts::{FontFamily, Fonts},
+ pipelines::{BasicPipeline, TextPipeline},
+};
use helpers::{create_buffer_with_data, create_image_with_data, load_image, load_obj};
use mapped_buffer::MappedBuffer;
use narcissus_app::{create_app, Event, Key, PressedState, WindowDesc};
ImageUsageFlags, LoadOp, MemoryLocation, Offset2d, Offset3d, RenderingAttachment,
RenderingDesc, Scissor, StoreOp, ThreadToken, Viewport,
};
-
use narcissus_maths::{sin_cos_pi_f32, vec3, Affine3, Deg, HalfTurn, Mat3, Mat4, Point3, Vec3};
use pipelines::{BasicUniforms, GlyphInstance, TextUniforms};
-use crate::{
- fonts::{FontFamily, Fonts},
- pipelines::{BasicPipeline, TextPipeline},
-};
-
mod fonts;
mod helpers;
mod mapped_buffer;
mod basic;
mod text;
-pub use basic::BasicPipeline;
-pub use basic::BasicUniforms;
-pub use basic::Vertex;
+pub use basic::{BasicPipeline, BasicUniforms, Vertex};
-pub use text::GlyphInstance;
-pub use text::TextPipeline;
-pub use text::TextUniforms;
+pub use text::{GlyphInstance, TextPipeline, TextUniforms};
macro_rules! thread_token_def {
($token_name:ident, $container_name:ident, $max_concurrency:expr) => {
mod private {
- use std::cell::UnsafeCell;
- use std::sync::atomic::AtomicUsize;
+ use std::{cell::UnsafeCell, sync::atomic::AtomicUsize};
use $crate::PhantomUnsend;
pub struct $token_name {
index: usize,
}
}
}
- pub use private::$container_name;
- pub use private::$token_name;
+ pub use private::{$container_name, $token_name};
};
}
mod tests {
use std::ffi::CStr;
- use super::cstr;
- use super::mod_inverse_u32;
- use super::mod_inverse_u64;
+ use super::{cstr, mod_inverse_u32, mod_inverse_u64};
#[test]
fn test_cstr() {
-use std::iter::repeat_with;
-use std::ops::{Index, IndexMut};
-use std::ptr;
-use std::slice;
+use std::{
+ iter::repeat_with,
+ ops::{Index, IndexMut},
+ ptr, slice,
+};
use super::VirtualRawVec;
mod raw_vec;
mod vec;
-pub use self::deque::VirtualDeque;
-pub use self::raw_vec::VirtualRawVec;
-pub use self::vec::VirtualVec;
+pub use self::{deque::VirtualDeque, raw_vec::VirtualRawVec, vec::VirtualVec};
#[cfg(test)]
mod tests {
-use std::cmp;
use std::{
+ cmp,
mem::{align_of, size_of},
ptr::NonNull,
};
-use std::ops::{Deref, DerefMut};
-use std::ptr;
+use std::{
+ ops::{Deref, DerefMut},
+ ptr,
+};
use super::VirtualRawVec;
+use crate::{font::GlyphBitmapBox, FontCollection, GlyphIndex, Oversample, Packer};
use rustc_hash::FxHashMap;
use stb_truetype_sys::rectpack::Rect;
-use crate::{font::GlyphBitmapBox, FontCollection, GlyphIndex, Oversample, Packer};
-
pub use narcissus_core::FiniteF32;
/// An index into the CachedGlyph slice.
-use std::{marker::PhantomData, mem::MaybeUninit, num::NonZeroI32};
-
use stb_truetype_sys::{
stbtt_FindGlyphIndex, stbtt_GetFontOffsetForIndex, stbtt_GetFontVMetrics,
stbtt_GetGlyphBitmapBoxSubpixel, stbtt_GetGlyphHMetrics, stbtt_GetGlyphKernAdvance,
stbtt_InitFont, stbtt_MakeGlyphBitmapSubpixelPrefilter, truetype,
};
+use std::{marker::PhantomData, mem::MaybeUninit, num::NonZeroI32};
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Oversample {
mod font;
mod packer;
-pub use cache::CachedGlyph;
-pub use cache::CachedGlyphIndex;
-pub use cache::GlyphCache;
-pub use font::Font;
-pub use font::FontCollection;
-pub use font::GlyphIndex;
-pub use font::Oversample;
-pub use packer::Packer;
-pub use packer::Rect;
+pub use cache::{CachedGlyph, CachedGlyphIndex, GlyphCache};
+pub use font::{Font, FontCollection, GlyphIndex, Oversample};
+pub use packer::{Packer, Rect};