Added UI functionality to the Graphics System #232

Merged
Xenosas1337 merged 40 commits from UI_Integration into main 2022-11-20 15:43:34 +08:00
6 changed files with 22 additions and 15 deletions
Showing only changes of commit 292fdf4ee2 - Show all commits

View File

@ -148,7 +148,7 @@ namespace Sandbox
SHFrameRateController::UpdateFRC();
//std::system("FontCompiler.exe ../../Assets/Fonts/SegoeUI.ttf");
std::system("FontCompiler.exe ../../Assets/Fonts/SegoeUI.ttf");
// Link up SHDebugDraw
SHDebugDraw::Init(SHSystemManager::GetSystem<SHDebugDrawSystem>());

View File

@ -48,15 +48,17 @@ namespace SHADE
// read the height
file.read(reinterpret_cast<char*>(&newFontAsset->bitmapHeight), sizeof(SHFontAsset::bitmapHeight));
uint32_t bytesRequired = newFontAsset->bitmapWidth * newFontAsset->bitmapHeight * SHFontAsset::BYTES_PER_CHANNEL * SHFontAsset::NUM_CHANNELS;
uint32_t bytesRequired = 0;
file.read(reinterpret_cast<char*>(&bytesRequired), sizeof(uint32_t));
// Read the bitmap
newFontAsset->bitmapData.resize(bytesRequired);
file.read (reinterpret_cast<char*>(newFontAsset->bitmapData.data()), bytesRequired);
file.read(reinterpret_cast<char*>(newFontAsset->bitmapData.data()), bytesRequired);
file.close();
return nullptr;
return newFontAsset;
}
void SHFontLoader::Write(SHAssetData const* data, AssetPath path)

View File

@ -121,15 +121,16 @@ namespace SHADE
SHAssetManager::CompileAsset("../../Assets/Shaders/Text_FS.glsl", false);
// Load Built In Shaders
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
static constexpr AssetID FS_DEFAULT = 46377769; defaultFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEFAULT);
static constexpr AssetID VS_DEBUG = 48002439; debugVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEBUG);
static constexpr AssetID FS_DEBUG = 36671027; debugFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEBUG);
static constexpr AssetID CS_COMPOSITE = 45072428; deferredCompositeShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(CS_COMPOSITE);
static constexpr AssetID SSAO = 38430899; ssaoShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO);
static constexpr AssetID SSAO_BLUR = 39760835; ssaoBlurShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO_BLUR);
static constexpr AssetID TEXT_VS = 39816727; textVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_VS);
static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_FS);
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
static constexpr AssetID FS_DEFAULT = 46377769; defaultFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEFAULT);
static constexpr AssetID VS_DEBUG = 48002439; debugVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEBUG);
static constexpr AssetID FS_DEBUG = 36671027; debugFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEBUG);
static constexpr AssetID CS_COMPOSITE = 45072428; deferredCompositeShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(CS_COMPOSITE);
static constexpr AssetID SSAO = 38430899; ssaoShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO);
static constexpr AssetID SSAO_BLUR = 39760835; ssaoBlurShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO_BLUR);
static constexpr AssetID TEXT_VS = 39816727; textVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_VS);
static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_FS);
static constexpr AssetID SEGOE_UI_FONT = 176667660; testFont = SHResourceManager::LoadOrGet<SHFont>(SEGOE_UI_FONT);
}
void SHGraphicsSystem::InitSceneRenderGraph(void) noexcept

View File

@ -437,6 +437,8 @@ namespace SHADE
Handle<SHVkShaderModule> textVS;
Handle<SHVkShaderModule> textFS;
// Fonts
Handle<SHFont> testFont;
// Built-In Materials
Handle<SHMaterial> defaultMaterial;

View File

@ -42,12 +42,14 @@ namespace SHADE
.depth = 1,
.levels = 1,
.arrayLayers = 1,
//.imageFormat = vk::Format::eR8G8B8Snorm,
//.imageFormat = vk::Format::eR32Sfloat,
.imageFormat = vk::Format::eR32G32B32Sfloat,
.usageFlags = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eTransferDst,
.createFlags = {}
};
uint32_t bytesRequired = fontAsset.bitmapWidth * fontAsset.bitmapHeight * SHFontAsset::BYTES_PER_CHANNEL * SHFontAsset::NUM_CHANNELS;
uint32_t bytesRequired = asset.bitmapData.size();
uint32_t mipOffset = 0;
// Create the image

View File

@ -316,7 +316,7 @@ namespace SHADE
return matHandle;
}
else if constexpr (std::is_same_v<ResourceType, SHFontAsset>)
else if constexpr (std::is_same_v<ResourceType, SHFont>)
{
loadedAssetData.emplace_back(assetId);
textureChanged = true;