VulkanInstanceBlock
Package: Libraries.Game.Graphics.Vulkan · Inherits from: Libraries.Language.Object
A VulkanInstanceBlock holds the GPU instance data for many copies of one mesh, packed once in the same layout a VulkanDrawQueue3D writes. The 3D painter keeps one per mesh of a model with copies, such as a foliage cell, and copies the whole block into a draw queue each frame in one move (VulkanDrawQueue3D:AddInstanceBlock), instead of working out and writing every copy again. It is packed again only when the copies, the mesh's buffers, its material's buffer, its texture or its color change. Most programs never use this class directly.
Example Code
use Libraries.Game.Graphics.Vulkan.VulkanInstanceBlock
VulkanInstanceBlock block
block:SetCapacity(100)
Actions
AddInstance(Libraries.Game.Graphics.Vulkan.VulkanBuffer vertexBuffer, Libraries.Game.Graphics.Vulkan.VulkanBuffer indexBuffer, Libraries.Game.Graphics.Models.Vulkan.MaterialVulkan material, Libraries.Game.Graphics.Texture texture, Libraries.Game.Graphics.Color diffuse, Libraries.Compute.Matrix4 transform)
This action packs one instance at the end of the block, as a draw queue would write it: the mesh's vertex and index buffers, its material, an optional texture and color in place of the material's, and the instance's transform. The block grows if it is full.
Parameters
vertexBufferLibraries.Game.Graphics.Vulkan.VulkanBuffer: The mesh's vertex buffer.indexBufferLibraries.Game.Graphics.Vulkan.VulkanBuffer: The mesh's index buffer.materialLibraries.Game.Graphics.Models.Vulkan.MaterialVulkan: The mesh's material.textureLibraries.Game.Graphics.Texture: A texture in place of the material's, or undefined.diffuseLibraries.Game.Graphics.Color: A color in place of the material's, or undefined.transformLibraries.Compute.Matrix4: The instance's transform.
Empty()
This action empties the block, keeping its room.
GetCount()
This action returns how many instances are packed.
Returns
integer: The count.
SetCapacity(integer count)
This action empties the block and makes room for a number of instances, so packing that many makes nothing new.
Parameters
countinteger: How many instances it should hold.