VulkanCopyBlocks
Package: Libraries.Game.Graphics.Vulkan · Inherits from: Libraries.Language.Object
VulkanCopyBlocks keeps a model's copies packed for drawing: one VulkanInstanceBlock per mesh of the model, with what they were packed from. The 3D painter's batch keeps one on each model with copies (Model:SetCopyDrawingCache) and asks it for a mesh's block each frame. A block is packed again only when something it was packed from has changed: the copies (Model:GetCopyVersion), the model's place, the mesh's buffers, its material's buffer (which changes when the material is uploaded again, as for wind), the texture or color in place of the material's, or the texture's place in its group. Otherwise the block is copied into the draw queue as it is, so a foliage cell that hasn't changed costs one copy a frame, not a calculation per copy. Most programs never use this class directly.
Example Code
use Libraries.Game.Graphics.Vulkan.VulkanCopyBlocks
VulkanCopyBlocks blocks
Actions
GetBlock(Libraries.Game.Graphics.Model model, integer meshIndex, Libraries.Game.Graphics.Models.Vulkan.MeshVulkan mesh, Libraries.Game.Graphics.Texture textureOverride, Libraries.Game.Graphics.Color diffuseOverride)
This action returns the block for one mesh of a model with copies, packing it first if anything it was packed from has changed.
Parameters
modelLibraries.Game.Graphics.Model: The model with copies.meshIndexinteger: The mesh's place in the model.meshLibraries.Game.Graphics.Models.Vulkan.MeshVulkan: The mesh.textureOverrideLibraries.Game.Graphics.Texture: The model's texture for this mesh, or undefined.diffuseOverrideLibraries.Game.Graphics.Color: The model's color for this mesh, or undefined.
Returns
Libraries.Game.Graphics.Vulkan.VulkanInstanceBlock: The block, holding one instance per copy.