VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::Batch Class Reference

#include <framework/batching/batch.h>

Public Member Functions

void updateBoundingBox ()

Public Attributes

int batchGroupId = BatchGroup::NOID
bool dynamic = false
std::shared_ptr< IndexBufferindexBuffer
std::shared_ptr< Meshmesh
std::unique_ptr< MeshInstancemeshInstance
GraphNode node
std::vector< MeshInstance * > origMeshInstances
std::unique_ptr< SkinBatchInstanceskinBatchInstance
std::shared_ptr< VertexBuffervertexBuffer

Detailed Description

A Batch is the output of BatchManager::createBatch(). It holds the combined mesh that replaces multiple original MeshInstances sharing the same material.

The originals are hidden (visible=false) while the batch is alive; calling BatchManager::destroy() restores them.

For dynamic batches, the SkinBatchInstance provides a per-frame matrix palette and updateBoundingBox() refreshes the AABB from the originals.

Definition at line 34 of file batch.h.

Member Function Documentation

◆ updateBoundingBox()

void visutwin::canvas::Batch::updateBoundingBox ( )
inline

Update AABB from all original mesh instances (dynamic batches only).

Definition at line 64 of file batch.h.

References visutwin::canvas::BoundingBox::add(), meshInstance, and origMeshInstances.

Member Data Documentation

◆ batchGroupId

int visutwin::canvas::Batch::batchGroupId = BatchGroup::NOID

The batch group this batch belongs to.

Definition at line 38 of file batch.h.

◆ dynamic

bool visutwin::canvas::Batch::dynamic = false

True for dynamic batches (transforms change per frame).

Definition at line 41 of file batch.h.

◆ indexBuffer

std::shared_ptr<IndexBuffer> visutwin::canvas::Batch::indexBuffer

Definition at line 56 of file batch.h.

◆ mesh

std::shared_ptr<Mesh> visutwin::canvas::Batch::mesh

Owned resources — kept alive as long as the batch exists.

Definition at line 54 of file batch.h.

◆ meshInstance

std::unique_ptr<MeshInstance> visutwin::canvas::Batch::meshInstance

The combined mesh instance that replaces the originals.

Definition at line 47 of file batch.h.

Referenced by updateBoundingBox().

◆ node

GraphNode visutwin::canvas::Batch::node

Identity-transform node for the combined mesh (geometry is in world space for static batches, or local space for dynamic batches).

Definition at line 60 of file batch.h.

◆ origMeshInstances

std::vector<MeshInstance*> visutwin::canvas::Batch::origMeshInstances

The original mesh instances that were merged into this batch.

Definition at line 44 of file batch.h.

Referenced by updateBoundingBox().

◆ skinBatchInstance

std::unique_ptr<SkinBatchInstance> visutwin::canvas::Batch::skinBatchInstance

SkinBatchInstance for dynamic batches (owns the matrix palette). nullptr for static batches.

Definition at line 51 of file batch.h.

◆ vertexBuffer

std::shared_ptr<VertexBuffer> visutwin::canvas::Batch::vertexBuffer

Definition at line 55 of file batch.h.


The documentation for this class was generated from the following file: