From a3880e83a232a4ac64c8cf736b1ec182b86d08af Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 27 Sep 2025 20:53:10 +0300 Subject: [PATCH] fixed confusing documentation about batching --- fyrox-impl/src/scene/mesh/mod.rs | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/fyrox-impl/src/scene/mesh/mod.rs b/fyrox-impl/src/scene/mesh/mod.rs index 242473192..b95298331 100644 --- a/fyrox-impl/src/scene/mesh/mod.rs +++ b/fyrox-impl/src/scene/mesh/mod.rs @@ -327,9 +327,20 @@ pub struct Mesh { #[reflect(setter = "set_render_path")] render_path: InheritableVariable, - /// Enable or disable dynamic batching. It could be useful to reduce amount of draw calls per - /// frame if you have lots of meshes with small vertex count. Does not work with meshes, that - /// have skin or blend shapes. Such meshes will be drawn in a separate draw call. + /// Defines the batching mode used by the mesh. + /// + /// ## Static batching + /// + /// Static batching. Render data of all **descendant** nodes will be baked into a static buffer, + /// and it will be drawn. This mode "bakes" world transform of a node into vertices, thus making + /// them immovable. + /// + /// ## Dynamic Batching + /// + /// Dynamically merges render data of all **descendant** nodes. It could be useful to reduce the + /// number of draw calls per frame if you have lots of meshes with small vertex count. Does not + /// work with meshes that have skin or blend shapes. Such meshes will be drawn in a separate draw + /// call. #[visit(optional)] #[reflect(setter = "set_batching_mode")] batching_mode: InheritableVariable, @@ -512,9 +523,20 @@ impl Mesh { bounding_box } - /// Enable or disable dynamic batching. It could be useful to reduce amount of draw calls per - /// frame if you have lots of meshes with small vertex count. Does not work with meshes, that - /// have skin or blend shapes. Such meshes will be drawn in a separate draw call. + /// Defines the batching mode used by the mesh. + /// + /// ## Static batching + /// + /// Static batching. Render data of all **descendant** nodes will be baked into a static buffer, + /// and it will be drawn. This mode "bakes" world transform of a node into vertices, thus making + /// them immovable. + /// + /// ## Dynamic Batching + /// + /// Dynamically merges render data of all **descendant** nodes. It could be useful to reduce the + /// number of draw calls per frame if you have lots of meshes with small vertex count. Does not + /// work with meshes that have skin or blend shapes. Such meshes will be drawn in a separate draw + /// call. pub fn set_batching_mode(&mut self, mode: BatchingMode) -> BatchingMode { if let BatchingMode::None | BatchingMode::Dynamic = mode { // Destroy batched data.