Initial commit.
This commit is contained in:
commit
f215bc3742
43 changed files with 2983 additions and 0 deletions
45
Client/Graphics/Graphics.h
Normal file
45
Client/Graphics/Graphics.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include <webgpu/webgpu.h>
|
||||
|
||||
#include <Shared.h>
|
||||
#include "../Platform/Window.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
class Graphics;
|
||||
|
||||
class GraphicsSubsystem {
|
||||
public:
|
||||
Graphics * graphics;
|
||||
virtual void init() {}
|
||||
virtual void reload() {}
|
||||
virtual void deinit() {}
|
||||
virtual void render(WGPUTextureView nextTexture, WGPUCommandEncoder encoder) {}
|
||||
};
|
||||
|
||||
class Graphics: public BaseSubsystem, public Engine<GraphicsSubsystem> {
|
||||
public:
|
||||
WGPUInstance instance = nullptr;
|
||||
WGPUSurface surface = nullptr;
|
||||
WGPUAdapter adapter = nullptr;
|
||||
WGPUDevice device = nullptr;
|
||||
|
||||
WGPUTexture depthTexture = nullptr;
|
||||
WGPUTextureView depthTextureView = nullptr;
|
||||
WGPUQueue queue = nullptr;
|
||||
|
||||
Window * window;
|
||||
|
||||
void init() override;
|
||||
void deinit() override;
|
||||
void render() override;
|
||||
void onSubsystemAdd(GraphicsSubsystem * system) {
|
||||
system->graphics = this;
|
||||
}
|
||||
|
||||
WGPUTexture createTextureFromData(const void* data, uint32_t width, uint32_t height);
|
||||
WGPUTexture createTextureFromFile(const char* file);
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue