Template Function Kataglyphis::VulkanRendererInternals::walkSceneMeshes#
Defined in File MeshDrawRecorder.ixx
Function Documentation#
-
template<typename PerModelSetup, typename CullPredicate, typename PerMeshSetup>
MeshDrawStats Kataglyphis::VulkanRendererInternals::walkSceneMeshes(vk::CommandBuffer commandBuffer, Kataglyphis::Scene *scene, PerModelSetup &&onModel, CullPredicate &&shouldCull, PerMeshSetup &&onMesh)# The per-frame model x mesh draw walk, shared by every pass that iterates
scene’s flattened meshes: forward/deferred rasterization (recordSceneMeshDrawsbelow) andCascadedShadowMap::recordCommands. Owns the parts that must not drift between callers - the flat mesh index bookkeeping, the findMesh()+unknownBounds fallback, transformAABB, the considered/drawn counters, and the bind-VB/bind-IB/drawIndexed sequence - while leaving genuine per-caller differences to the two callbacks:onModel(modelMatrix)runs once per model, before its meshes. Forward rasterization uses it to seed the push constant’s model/invModelRows; the shadow pass has nothing model-level to precompute and passes a no-op.shouldCull(worldBounds)runs once per mesh (afteronModel, before any draw-related side effect) and returning true skips the mesh. Forward rasterization tests one camera frustum; the shadow pass unionsisVisibleAsShadowCasterover every cascade.onMesh(modelMatrix, objectIndex, mesh)runs once per surviving mesh, before the shared bind+draw. It is where each caller pushes its own push-constant type/content (PushConstantRasterizerwith inverse-transpose rows and the dynamicsetCullMode, vsShadowPushConstantswith no cull-mode toggle since the shadow pipeline is builteCullMode = eNone).
meshpassed toshouldCull’s bounds and toonMeshmay be null (a findMesh() miss); the shared walk treats a null mesh as an empty draw (unknown bounds, zero-size vertex/index buffers) rather than skipping it, matching the callers’ former inline behaviour.