class final
materialclass that creates a bindable collection of resources that can be used in conjuction with a surface to render.
The material class is a container of various resources that can, together, describe what should happen to a surface in the render pipeline on the GPU, and what is all needed. The material class also can contain instance data and will manage this for you. Together with a core::
constructors, destructors, conversion operators
member-functions
Function documentation
core:: gfx:: material:: material(resource_ dependency packet,
core:: resource:: handle<core:: gfx:: context> context,
core:: resource:: handle<core:: data:: material> data,
core:: resource:: handle<core:: gfx:: pipeline_cache> pipeline_cache,
core:: resource:: handle<core:: gfx:: buffer> materialBuffer,
core:: resource:: handle<core:: gfx:: buffer> instanceBuffer)
Brief
the constructor that will create and bind the necesary resources to create a valid pipeline.
Parameters | |
---|---|
packet in | resource packet containing the data that is needed from the resource system. |
context in | a handle to a graphics context (needs to be valid and loaded) which will own the material. |
data in | the material data this instance will be based on. |
pipeline_cache | |
materialBuffer in | a GPU buffer that can be used by this instance to upload data to (if needed). |
instanceBuffer in | a GPU buffer that can be used to upload instance data to, if there is any. |
core:: resource:: handle<core:: data:: material> core:: gfx:: material:: data() const
Brief
returns a handle to the material data used to construct this object.
Details
const std::vector<std::pair<uint32_t, core:: resource:: handle<core:: gfx:: buffer>>>& core:: gfx:: material:: buffers() const
Brief
returns all currently used buffers and their binding slots.
Details
bool core:: gfx:: material:: bind_pipeline(vk::CommandBuffer cmdBuffer,
core:: resource:: handle<framebuffer> framebuffer,
uint32_t drawIndex)
Brief
prepares the material for rendering by binding the pipeline.
Details
Parameters | |
---|---|
cmdBuffer in | the command buffer you'll be recording to |
framebuffer in | the framebuffer the pipeline will be bound to. |
drawIndex in | the index to be set in the push constant. |
bool core:: gfx:: material:: bind_pipeline(vk::CommandBuffer cmdBuffer,
core:: resource:: handle<swapchain> swapchain,
uint32_t drawIndex)
Brief
prepares the material for rendering by binding the pipeline.
Details
Parameters | |
---|---|
cmdBuffer in | the command buffer you'll be recording to |
swapchain in | the swapchain the pipeline will be bound to. |
drawIndex in | the index to be set in the push constant. |
bool core:: gfx:: material:: bind_geometry(vk::CommandBuffer cmdBuffer,
const core:: resource:: handle<core:: gfx:: geometry> geometry)
Brief
prepares the material for rendering by binding the geometry's instance data.
Details
Parameters | |
---|---|
cmdBuffer in | the command buffer you'll be recording to |
geometry in | the geometry that will be bound. |
uint32_t core:: gfx:: material:: instances(const core:: resource:: handle<core:: gfx:: geometry> geometry) const
Brief
returns the instance count currently used for the given piece of geometry.
Parameters | |
---|---|
geometry in | the geometry to check. |
core:: resource:: handle<pipeline> core:: gfx:: material:: get(core:: resource:: handle<framebuffer> framebuffer) private
Details
tries to find, and return a core::
Parameters | |
---|---|
framebuffer in | the framebuffer to bind to. |
Returns | the pipeline this material instance uses for the given framebuffer. |
core:: resource:: handle<pipeline> core:: gfx:: material:: get(core:: resource:: handle<swapchain> swapchain) private
Details
tries to find, and return a core::
Parameters | |
---|---|
swapchain in | the swapchain to bind to. |
Returns | the pipeline this material instance uses for the given framebuffer. |