pub struct RenderStats {
pub draw_calls: u32,
pub triangles: u32,
pub vertices: u32,
pub active_lights: u32,
pub culled_objects: u32,
pub visible_objects: u32,
pub frame_time_ms: f32,
pub fps: f32,
pub gpu_memory_bytes: u64,
}Expand description
每帧渲染统计
§示例
use anvilkit_render::renderer::debug::RenderStats;
let mut stats = RenderStats::new();
stats.record_draw_call(100);
stats.record_draw_call(200);
assert_eq!(stats.draw_calls, 2);
assert_eq!(stats.triangles, 300);Fields§
§draw_calls: u32绘制调用次数
triangles: u32渲染的三角形总数
vertices: u32渲染的顶点总数
active_lights: u32活跃的光源数
culled_objects: u32视锥体剔除掉的物体数
visible_objects: u32可见物体数
frame_time_ms: f32帧时间(毫秒)
fps: f32FPS(基于帧时间计算)
gpu_memory_bytes: u64GPU 内存使用估计(字节)
Implementations§
Source§impl RenderStats
impl RenderStats
pub fn new() -> Self
Sourcepub fn record_draw_call(&mut self, triangle_count: u32)
pub fn record_draw_call(&mut self, triangle_count: u32)
记录一次绘制调用
Sourcepub fn update_frame_time(&mut self, dt_seconds: f32)
pub fn update_frame_time(&mut self, dt_seconds: f32)
更新帧时间
Sourcepub fn reset_frame(&mut self)
pub fn reset_frame(&mut self)
帧开始时重置计数器
Trait Implementations§
Source§impl Clone for RenderStats
impl Clone for RenderStats
Source§fn clone(&self) -> RenderStats
fn clone(&self) -> RenderStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RenderStats
impl Debug for RenderStats
Source§impl Default for RenderStats
impl Default for RenderStats
impl Resource for RenderStats
Auto Trait Implementations§
impl Freeze for RenderStats
impl RefUnwindSafe for RenderStats
impl Send for RenderStats
impl Sync for RenderStats
impl Unpin for RenderStats
impl UnsafeUnpin for RenderStats
impl UnwindSafe for RenderStats
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self using data from the given World.