Struct let_engine::prelude::Resources
source · pub struct Resources { /* private fields */ }Expand description
All the resources kept in the game engine like textures, fonts, sounds and models.
Implementations§
source§impl Resources
impl Resources
pub fn new() -> Self
sourcepub unsafe fn load_pipeline_cache(&self, data: &[u8])
pub unsafe fn load_pipeline_cache(&self, data: &[u8])
Merges a pipeline cache into the resources potentially making the creation of materials faster.
Safety
Unsafe because vulkan blindly trusts that this data comes from the get_pipeline_binary function.
The program will crash if the data provided is not right.
The binary given to the function must be made with the same hardware and vulkan driver version.
sourcepub fn get_pipeline_binary(&self) -> Vec<u8>
pub fn get_pipeline_binary(&self) -> Vec<u8>
Returns the binary of the pipeline cache.
Allows this binary to be loaded with the load_pipeline_cache function to make loading materials potentially faster.
pub fn load_model(&self, data: Data) -> Model
sourcepub fn load_texture_from_raw(
&self,
data: &[u8],
dimensions: (u32, u32),
format: Format,
layers: u32,
settings: TextureSettings
) -> Texture
pub fn load_texture_from_raw( &self, data: &[u8], dimensions: (u32, u32), format: Format, layers: u32, settings: TextureSettings ) -> Texture
Loads a texture to the GPU using a raw image.
sourcepub fn load_texture(
&self,
data: &[u8],
image_format: ImageFormat,
layers: u32,
settings: TextureSettings
) -> Result<Texture, InvalidFormatError>
pub fn load_texture( &self, data: &[u8], image_format: ImageFormat, layers: u32, settings: TextureSettings ) -> Result<Texture, InvalidFormatError>
Loads a texture to the GPU using the given image format.
sourcepub unsafe fn new_shader_from_raw(
&self,
vertex_data: &[u8],
fragment_data: &[u8]
) -> Shaders
pub unsafe fn new_shader_from_raw( &self, vertex_data: &[u8], fragment_data: &[u8] ) -> Shaders
sourcepub fn new_descriptor_write<T: BufferContents>(
&self,
buf: T,
set: u32
) -> WriteDescriptorSet
pub fn new_descriptor_write<T: BufferContents>( &self, buf: T, set: u32 ) -> WriteDescriptorSet
Loads a new write operation for a shader.
sourcepub fn new_material_with_shaders(
&self,
settings: MaterialSettings,
shaders: &Shaders,
descriptor_bindings: Vec<WriteDescriptorSet>
) -> Material
pub fn new_material_with_shaders( &self, settings: MaterialSettings, shaders: &Shaders, descriptor_bindings: Vec<WriteDescriptorSet> ) -> Material
Creates a new material using the given shaders, settings and write operations.
pub fn new_material(&self, settings: MaterialSettings) -> Material
sourcepub fn new_material_from_texture(
&self,
texture: &[u8],
format: ImageFormat,
layers: u32,
settings: TextureSettings
) -> Result<Material, InvalidFormatError>
pub fn new_material_from_texture( &self, texture: &[u8], format: ImageFormat, layers: u32, settings: TextureSettings ) -> Result<Material, InvalidFormatError>
Simplification of making a texture and putting it into a material.
sourcepub fn new_material_from_raw_texture(
&self,
texture: &[u8],
format: Format,
dimensions: (u32, u32),
layers: u32,
settings: TextureSettings
) -> Material
pub fn new_material_from_raw_texture( &self, texture: &[u8], format: Format, dimensions: (u32, u32), layers: u32, settings: TextureSettings ) -> Material
Simplification of making a texture from raw and putting it into a material.
sourcepub fn default_textured_material(&self, texture: &Texture) -> Material
pub fn default_textured_material(&self, texture: &Texture) -> Material
Creates a simple material made just for showing a texture.
sourcepub fn get_window(&self) -> Window
pub fn get_window(&self) -> Window
Returns the window instance from resources.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Resources
impl Send for Resources
impl Sync for Resources
impl Unpin for Resources
impl !UnwindSafe for Resources
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.