Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 1d63314

Browse files
committed
Demonstrate RGBM texture
1 parent c6ae38c commit 1d63314

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

App/Src/Main.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Tkge/Graphics/Drawable.hpp>
44
#include <Tkge/Graphics/Shader.hpp>
55
#include <klib/assert.hpp>
6+
#include <kvf/color_bitmap.hpp>
67
#include <kvf/time.hpp>
78
#include <cmath>
89
#include <exception>
@@ -56,7 +57,16 @@ namespace
5657
auto quad = Tkge::Graphics::Quad{};
5758
quad.Create(glm::vec2{400.0f});
5859
quad.transform.position.x = -250.0f;
59-
quad.tint = kvf::magenta_v;
60+
61+
auto colourBitmap = kvf::ColorBitmap{glm::ivec2{2, 2}};
62+
colourBitmap[0, 0] = kvf::red_v;
63+
colourBitmap[0, 1] = kvf::green_v;
64+
colourBitmap[1, 0] = kvf::blue_v;
65+
colourBitmap[1, 1] = kvf::magenta_v;
66+
auto texture = Tkge::Graphics::Texture{&engine.RenderDevice()};
67+
texture.Create(colourBitmap.bitmap());
68+
texture.sampler.filter = vk::Filter::eNearest;
69+
quad.texture = &texture;
6070

6171
auto instancedQuad = Tkge::Graphics::InstancedQuad{};
6272
instancedQuad.Create(glm::vec2{150.0f});

Lib/Include/Tkge/Engine.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Tkge
2525
explicit Engine(const WindowSurface& surface = {}, vk::SampleCountFlagBits aa = AntiAliasing);
2626

2727
[[nodiscard]] const kvf::RenderDevice& RenderDevice() const { return _renderDevice; }
28+
[[nodiscard]] kvf::RenderDevice& RenderDevice() { return _renderDevice; }
2829

2930
[[nodiscard]] glm::ivec2 FramebufferSize() const;
3031
[[nodiscard]] auto FramebufferFormat() const -> vk::Format { return _renderPass.get_color_format(); }

0 commit comments

Comments
 (0)