47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#define NK_INCLUDE_FIXED_TYPES
|
|
#define NK_INCLUDE_STANDARD_IO
|
|
#define NK_INCLUDE_STANDARD_VARARGS
|
|
#define NK_INCLUDE_DEFAULT_ALLOCATOR
|
|
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
|
#define NK_INCLUDE_FONT_BAKING
|
|
#define NK_INCLUDE_DEFAULT_FONT
|
|
#include <nuklear.h>
|
|
#include <webgpu/webgpu.h>
|
|
|
|
#include <Shared.h>
|
|
#include "Graphics.h"
|
|
#include "../Platform/Window.h"
|
|
|
|
namespace Artifact {
|
|
|
|
class UIRenderer: public GraphicsSubsystem, public EventTarget {
|
|
nk_context ctx {};
|
|
nk_font_atlas atlas {};
|
|
|
|
WGPURenderPipeline pipeline = nullptr;
|
|
Window * window = nullptr;
|
|
|
|
WGPUBuffer vertexBuffer = nullptr;
|
|
WGPUBuffer indexBuffer = nullptr;
|
|
WGPUBuffer uniformBuffer = nullptr;
|
|
WGPUSampler sampler = nullptr;
|
|
WGPUBindGroupLayout bgl = nullptr;
|
|
WGPUTexture fontTexture = nullptr;
|
|
WGPUTextureView fontTextureView = nullptr;
|
|
WGPUTexture dummyTexture = nullptr;
|
|
WGPUTextureView dummyTextureView = nullptr;
|
|
|
|
nk_buffer vertexBufferNK;
|
|
nk_buffer indexBufferNK;
|
|
nk_buffer commandBufferNK;
|
|
|
|
void init() override;
|
|
void reload() override;
|
|
void render(WGPUTextureView nextTexture, WGPUCommandEncoder encoder) override;
|
|
|
|
WGPURenderPipeline makePipeline();
|
|
};
|
|
|
|
}
|