Chronos 0.0
A advanced 2D rendering and animation system
Loading...
Searching...
No Matches
ColoredRectangle.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2024 Rahul Satish Vadhyar
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22
27#pragma once
28#include "object.hpp"
29#include "Vertex.hpp"
30#include "commonStructs.hpp"
31namespace Chronos {
32namespace Engine {
33 class ColoredRectangle : public Object {
34 public:
37 VkRenderPass* renderPass);
38 void update(uint32_t currentFrame) override;
39 void destroy() override;
40 const std::vector<uint16_t> indices
41 = std::vector<uint16_t> { 0, 1, 2, 2, 3, 0 };
43 const std::vector<ColorVertex> vertices
44 = std::vector<ColorVertex> { { { -0.5f, -0.5f } },
45 { { 0.5f, -0.5f } }, { { 0.5f, 0.5f } },
46 { { -0.5f, 0.5f } } };
47
52 void render(uint32_t currentFrame, uint32_t imageIndex,
53 float bgColor[3], VkViewport& viewport, VkRect2D& scissor,
54 std::vector<VkCommandBuffer>& commandBuffers) override;
55
60
61 private:
62 void createDescriptorSets() override;
63 std::vector<VkDescriptorType> getDescriptorTypes() override;
64 std::vector<VkShaderStageFlagBits> getDescriptorStages() override;
66 std::vector<Chronos::Engine::ColorBuffer> colorBuffers;
67 };
68};
69};
This file includes the structure of a vertex.
Used to store buffers in GPU.
Definition buffers.hpp:39
void init(Chronos::Engine::Device *device, VkCommandPool commandPool, Chronos::Engine::SwapChain *swapChain, VkSampler textureSampler, VkRenderPass *renderPass)
const std::vector< uint16_t > indices
Chronos::Engine::Buffer vertexBuffer
The vertex buffer that is used to store the vertices.
std::vector< Chronos::Engine::ColorBuffer > colorBuffers
std::vector< VkShaderStageFlagBits > getDescriptorStages() override
PipelineAttributes getPipelineAttributes() override
const std::vector< ColorVertex > vertices
Chronos::Engine::Buffer indexBuffer
The index buffer that is used to store the indices.
void update(uint32_t currentFrame) override
Updates the object for the current frame.
std::vector< VkDescriptorType > getDescriptorTypes() override
Chronos::Manager::ShapeParams params
void render(uint32_t currentFrame, uint32_t imageIndex, float bgColor[3], VkViewport &viewport, VkRect2D &scissor, std::vector< VkCommandBuffer > &commandBuffers) override
void destroy() override
Destroys the object and releases associated resources.
This initializes, manages and destroys the logical and physical devices(GPU).
Definition device.hpp:47
Abstract class for creating and managing generic graphical objects.
Definition object.hpp:66
VkCommandPool commandPool
Definition object.hpp:143
Chronos::Engine::SwapChain * swapChain
Definition object.hpp:141
Chronos::Engine::Device * device
Definition object.hpp:140
VkRenderPass * renderPass
Definition object.hpp:147
Header file that contains common structs used in Chronos.
Contains the class for creating a generic object.
Structure defining attributes required for creating a graphics pipeline.
Definition object.hpp:43
Parameters for creating a shape(any)