pub struct RenderData<App: PeterEngineApp + ?Sized> {
    pub main_uniforms: UniformsBuffer,
    pub device: Arc<Device>,
    pub queue: Arc<Queue>,
    pub shader: ShaderModule,
    pub mipmap_gen: MipMapGen,
    pub pixel_perfect_size: (u32, u32),
    pub resources: AnyMap,
    pub _phantom: PhantomData<App>,
}

Fields§

§main_uniforms: UniformsBuffer§device: Arc<Device>§queue: Arc<Queue>§shader: ShaderModule§mipmap_gen: MipMapGen§pixel_perfect_size: (u32, u32)§resources: AnyMap§_phantom: PhantomData<App>

Implementations§

source§

impl<App: PeterEngineApp> RenderData<App>

source

pub fn load_resources<K: ResourceKey>(&mut self)

Examples found in repository?
examples/test.rs (line 57)
56
57
58
  fn init(&mut self, _cc: &eframe::CreationContext, rd: &mut RenderData<Self>) {
    rd.load_resources::<Textures>();
  }
source

pub fn get_resource<K: ResourceKey>(&self, key: K) -> &K::Output

Examples found in repository?
examples/test.rs (line 75)
70
71
72
73
74
75
76
77
  fn prepare(
    &mut self,
    rd: &mut RenderData<Self>,
    encoder: &mut wgpu::CommandEncoder,
  ) -> Vec<wgpu::CommandBuffer> {
    let r = rd.get_resource(Textures::A);
    Vec::new()
  }
source

pub fn new(cc: &CreationContext<'_>) -> Self

source

pub fn load_texture(&self, bytes: &[u8]) -> (Texture, TextureView)

Examples found in repository?
examples/test.rs (lines 21-29)
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  fn load<App: PeterEngineApp>(self, rd: &mut RenderData<App>) -> Self::Output {
    match self {
      Self::A =>
        rd.load_texture(&[
          0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44,
          0x52, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x66,
          0xBC, 0x3A, 0x25, 0x00, 0x00, 0x00, 0x03, 0x50, 0x4C, 0x54, 0x45, 0xB5, 0xD0, 0xD0, 0x63,
          0x04, 0x16, 0xEA, 0x00, 0x00, 0x00, 0x1F, 0x49, 0x44, 0x41, 0x54, 0x68, 0x81, 0xED, 0xC1,
          0x01, 0x0D, 0x00, 0x00, 0x00, 0xC2, 0xA0, 0xF7, 0x4F, 0x6D, 0x0E, 0x37, 0xA0, 0x00, 0x00,
          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0x0D, 0x21, 0x00, 0x00, 0x01, 0x9A, 0x60, 0xE1,
          0xD5, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82,
        ])
        .1,
    }
  }

Trait Implementations§

Auto Trait Implementations§

§

impl<App> !RefUnwindSafe for RenderData<App>

§

impl<App: ?Sized> Unpin for RenderData<App>
where App: Unpin,

§

impl<App> !UnwindSafe for RenderData<App>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

source§

impl<T> Any for T
where T: Any,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSync for T
where T: Sync,