pub struct StreamingRenderer<PerFrameDataT: Copy = ()> { /* private fields */ }Expand description
A renderer optimized for streaming new vertex data to the GPU every frame.
Implementations§
Source§impl<PerFrameDataT: Copy> StreamingRenderer<PerFrameDataT>
impl<PerFrameDataT: Copy> StreamingRenderer<PerFrameDataT>
pub fn new( ctx: &VulkanContext, image_format: Format, frames_in_flight: &FramesInFlight, texture_atlas: &TextureAtlas, ) -> Result<Self>
Sourcepub fn new_material(
&self,
ctx: &VulkanContext,
vertex_shader: Option<&ShaderModule>,
fragment_shader: Option<&ShaderModule>,
) -> Result<Arc<Material>>
pub fn new_material( &self, ctx: &VulkanContext, vertex_shader: Option<&ShaderModule>, fragment_shader: Option<&ShaderModule>, ) -> Result<Arc<Material>>
Creates a new rendering material. See the documentation for [Material] for details on allowed shader inputs and outputs.
Default vertex and fragment shaders are used automatically if either is omitted.
Sourcepub fn default_material(&self) -> &Arc<Material>
pub fn default_material(&self) -> &Arc<Material>
Returns the default material for use by meshes without special material requirements.
Sourcepub fn prepare_meshes(
&mut self,
ctx: &VulkanContext,
frame: &Frame,
meshes: &[&dyn Mesh],
) -> Result<()>
pub fn prepare_meshes( &mut self, ctx: &VulkanContext, frame: &Frame, meshes: &[&dyn Mesh], ) -> Result<()>
Prepares the meshes for this frame.
This should only be called once per frame, calling it repeatedly will only render whatever meshes were provided last.
pub fn set_frame_constants( &mut self, frame: &Frame, data: PerFrameDataT, ) -> Result<()>
Sourcepub fn bind_texture_atlas(
&mut self,
ctx: &VulkanContext,
frame: &Frame,
texture_atlas: &TextureAtlas,
)
pub fn bind_texture_atlas( &mut self, ctx: &VulkanContext, frame: &Frame, texture_atlas: &TextureAtlas, )
Binds the texture atlas for the frame.
This only needs to be done once a frame, regardless of how many meshes there are as mesh pipelines are required to have compatible pipeline layouts.
Sourcepub fn write_draw_commands(
&mut self,
ctx: &VulkanContext,
frame: &Frame,
) -> Result<()>
pub fn write_draw_commands( &mut self, ctx: &VulkanContext, frame: &Frame, ) -> Result<()>
Emits draw commands for all of the meshes in the current frame.
NOTE: it is incorrect to call this multiple times for the same frame as there is only one internal vertex buffer per frame.
Auto Trait Implementations§
impl<PerFrameDataT> Freeze for StreamingRenderer<PerFrameDataT>
impl<PerFrameDataT = ()> !RefUnwindSafe for StreamingRenderer<PerFrameDataT>
impl<PerFrameDataT> Send for StreamingRenderer<PerFrameDataT>where
PerFrameDataT: Send,
impl<PerFrameDataT> Sync for StreamingRenderer<PerFrameDataT>where
PerFrameDataT: Sync,
impl<PerFrameDataT> Unpin for StreamingRenderer<PerFrameDataT>where
PerFrameDataT: Unpin,
impl<PerFrameDataT = ()> !UnwindSafe for StreamingRenderer<PerFrameDataT>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.