Unlocks mesh and uploads changes to GPU (finalizes vertex/triangle modifications).
Takes mesh (surface-based mesh entity).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
meshInt
Returns
Void
Quick Summary
Unlocks mesh and uploads changes to GPU (finalizes vertex/triangle modifications).
Takes mesh (surface-based mesh entity).
Returns nothing.
Technical Exegesis...
Unlocks mesh and uploads changes to GPU (finalizes vertex/triangle modifications). Takes mesh (surface-based mesh entity). Returns nothing. Validates mesh exists, type is ENTITY_MESH, and is surface-based. Sets mesh->locked=false. If mesh->needsGPUUpload=true, calls RebuildGPUBuffersFromSurfaces(mesh) to create/update GPU vertex and index buffers. Silently returns on validation errors.
This function finalizes mesh editing and synchronizes CPU data to GPU.
Unlocks mesh and uploads changes to GPU (finalizes vertex/triangle modifications). Takes mesh (surface-based mesh entity). Returns nothing. Validates mesh exists, type is ENTITY_MESH, and is surface-based. Sets mesh->locked=false. If mesh->needsGPUUpload=true, calls RebuildGPUBuffersFromSurfaces(mesh) to create/update GPU vertex and index buffers. Silently returns on validation errors.
This function finalizes mesh editing and synchronizes CPU data to GPU. Critical step: all vertex/triangle modifications stay CPU-side until unlock - unlock triggers GPU buffer rebuild for rendering. RebuildGPUBuffersFromSurfaces: creates D3D12 vertex buffer (upload heap -> default heap copy), creates index buffer, updates buffer views, clears needsGPUUpload flag. Must call after: any mesh modification (b3dAddVertex/Triangle, b3dVertexCoords/Normal/TexCoords/Color, b3dDeleteVertex/Triangle, b3dUpdateNormals, b3dClearSurface). Unlock without modifications: if needsGPUUpload=false, simply sets locked=false (no GPU work). Use cases: (1) Finalize procedural mesh after building, (2) Apply vertex animation frame, (3) Complete mesh editing session, (4) Trigger rendering of modified geometry. Common pattern: b3dLockMesh(mesh), modify mesh, b3dUnlockMesh(mesh), render frame. GPU buffer creation: allocates GPU memory, copies vertex/index data via command queue, creates descriptor views, sets resource states. Performance: unlock can be expensive for large meshes (GPU upload bottleneck) - prefer batching modifications between single lock/unlock pair rather than lock/unlock per vertex. Multiple unlocks: calling unlock multiple times harmless but wasteful (rebuilds GPU buffers unnecessarily if needsGPUUpload still true from another operation). Frame-by-frame animation: lock once, modify vertices in loop, unlock once per frame for deforming mesh. Alternative: keep mesh locked for long editing sessions, unlock only when ready to render. Buffer size: GPU buffers sized to current vertex/index count - deleting vertices frees GPU memory on next unlock. Render timing: modified mesh renders with new geometry starting next frame after unlock. Error symptoms: if mesh modifications don't appear, check b3dUnlockMesh called, check needsGPUUpload being set properly. Upload heap: uses intermediate upload buffer for CPU->GPU transfer, then copies to default heap for GPU-optimal access.