Fixed camera. Can see texture now
This commit is contained in:
parent
6f3c1ed97b
commit
b7adf8815b
Binary file not shown.
|
@ -81,6 +81,7 @@ namespace Sandbox
|
||||||
SHADE::SHAssetManager::LoadDataTemp("../../Assets/racoon.fbx");
|
SHADE::SHAssetManager::LoadDataTemp("../../Assets/racoon.fbx");
|
||||||
SHADE::SHAssetManager::LoadDataTemp("../../Assets/RaccoonBag_Color_Ver4.dds");
|
SHADE::SHAssetManager::LoadDataTemp("../../Assets/RaccoonBag_Color_Ver4.dds");
|
||||||
SHADE::SHAssetManager::LoadDataTemp("../../Assets/RaccoonPreTexturedVer1_Base9.dds");
|
SHADE::SHAssetManager::LoadDataTemp("../../Assets/RaccoonPreTexturedVer1_Base9.dds");
|
||||||
|
SHADE::SHAssetManager::LoadDataTemp("../../Assets/TD_Checker_Base_Color.dds");
|
||||||
//TODO: REMOVE AFTER PRESENTATION
|
//TODO: REMOVE AFTER PRESENTATION
|
||||||
|
|
||||||
// Set up graphics system and windows
|
// Set up graphics system and windows
|
||||||
|
|
|
@ -68,11 +68,11 @@ namespace Sandbox
|
||||||
auto matInst = graphicsSystem->AddOrGetBaseMaterialInstance();
|
auto matInst = graphicsSystem->AddOrGetBaseMaterialInstance();
|
||||||
|
|
||||||
// Create Stress Test Objects
|
// Create Stress Test Objects
|
||||||
static const SHVec3 TEST_OBJ_SCALE = { 0.2f, 0.2f, 0.2f };
|
static const SHVec3 TEST_OBJ_SCALE = { 0.05f, 0.05f, 0.05f };
|
||||||
constexpr int NUM_ROWS = 1;
|
constexpr int NUM_ROWS = 2;
|
||||||
constexpr int NUM_COLS = 1;
|
constexpr int NUM_COLS = 2;
|
||||||
static const SHVec3 TEST_OBJ_SPACING = { 1.0f, 1.0f, 1.0f };
|
static const SHVec3 TEST_OBJ_SPACING = { 20.0f, 20.0f, 20.0f };
|
||||||
static const SHVec3 TEST_OBJ_START_POS = { - (NUM_COLS / 2 * TEST_OBJ_SPACING.x ), 0.0f, 0.0f };
|
static const SHVec3 TEST_OBJ_START_POS = { - (NUM_COLS / 2 * TEST_OBJ_SPACING.x ) + 15.0f, 0.0f, -2.0f };
|
||||||
//for (int z = 0; z < NUM_ROWS; ++z)
|
//for (int z = 0; z < NUM_ROWS; ++z)
|
||||||
//for (int x = 0; x < NUM_COLS; ++x)
|
//for (int x = 0; x < NUM_COLS; ++x)
|
||||||
//{
|
//{
|
||||||
|
@ -85,26 +85,28 @@ namespace Sandbox
|
||||||
|
|
||||||
// // Set initial positions
|
// // Set initial positions
|
||||||
// transform.SetWorldPosition(TEST_OBJ_START_POS + SHVec3{ x * TEST_OBJ_SPACING.x, 0.0f, z * TEST_OBJ_SPACING.z });
|
// transform.SetWorldPosition(TEST_OBJ_START_POS + SHVec3{ x * TEST_OBJ_SPACING.x, 0.0f, z * TEST_OBJ_SPACING.z });
|
||||||
// //transform.SetLocalScale(TEST_OBJ_SCALE);
|
// transform.SetWorldRotation(3.14159265f * 1.5f, -3.14159265f / 2.0f, 0.0f);
|
||||||
|
// transform.SetLocalScale(TEST_OBJ_SCALE);
|
||||||
|
|
||||||
// stressTestObjects.emplace_back(entity);
|
// stressTestObjects.emplace_back(entity);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
auto entity = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
|
auto entity = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
|
||||||
auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity);
|
auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity);
|
||||||
auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity);
|
auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity);
|
||||||
|
|
||||||
renderable.Mesh = handles.front();
|
renderable.Mesh = handles.front();
|
||||||
renderable.SetMaterial(matInst);
|
renderable.SetMaterial(matInst);
|
||||||
|
|
||||||
//transform.SetLocalScale(TEST_OBJ_SCALE);
|
transform.SetWorldPosition({0.0f, 0.0f, -1.0f});
|
||||||
|
transform.SetLocalScale(TEST_OBJ_SCALE);
|
||||||
|
|
||||||
stressTestObjects.emplace_back(entity);
|
stressTestObjects.emplace_back(entity);
|
||||||
|
|
||||||
// Create blank entity with a script
|
// Create blank entity with a script
|
||||||
testObj = SHADE::SHEntityManager::CreateEntity();
|
//testObj = SHADE::SHEntityManager::CreateEntity();
|
||||||
SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
|
//SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
|
||||||
scriptEngine->AddScript(testObj, "TestScript");
|
//scriptEngine->AddScript(testObj, "TestScript");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBTestScene::Update(float dt)
|
void SBTestScene::Update(float dt)
|
||||||
|
@ -115,16 +117,17 @@ namespace Sandbox
|
||||||
|
|
||||||
transform.SetLocalRotation(rotation, 0.0f, 0.0f);
|
transform.SetLocalRotation(rotation, 0.0f, 0.0f);
|
||||||
rotation += dt * 10.0f;*/
|
rotation += dt * 10.0f;*/
|
||||||
/*static float rotation = 0.0f;
|
static float rotation = 0.0f;
|
||||||
|
|
||||||
auto& transform = *SHADE::SHComponentManager::GetComponent_s<SHADE::SHTransformComponent>(stressTestObjects[0]);
|
auto& transform = *SHADE::SHComponentManager::GetComponent_s<SHADE::SHTransformComponent>(stressTestObjects[0]);
|
||||||
|
|
||||||
transform.SetWorldPosition({rotation, 0.0f, 0.0f});
|
transform.SetWorldRotation(0.0f, 0.0f + rotation, 0.0f);
|
||||||
rotation += dt * 10.0f;*/
|
rotation += dt * 0.2f;
|
||||||
|
|
||||||
// Destroy entity if space is pressed
|
// Destroy entity if space is pressed
|
||||||
if (GetKeyState(VK_SPACE) & 0x8000)
|
if (GetKeyState(VK_SPACE) & 0x8000)
|
||||||
{
|
{
|
||||||
|
rotation = 0.0f;
|
||||||
SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
|
SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
|
||||||
scriptEngine->RemoveAllScripts(testObj);
|
scriptEngine->RemoveAllScripts(testObj);
|
||||||
}
|
}
|
||||||
|
@ -132,6 +135,7 @@ namespace Sandbox
|
||||||
|
|
||||||
void SBTestScene::Render()
|
void SBTestScene::Render()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBTestScene::Unload()
|
void SBTestScene::Unload()
|
||||||
|
|
|
@ -292,7 +292,7 @@ namespace SHADE
|
||||||
imguiCommandBuffer->EndRecording();
|
imguiCommandBuffer->EndRecording();
|
||||||
gfxSystem->GetQueue()->SubmitCommandBuffer({ imguiCommandBuffer }, {}, {}, vk::PipelineStageFlagBits::eNone, {});
|
gfxSystem->GetQueue()->SubmitCommandBuffer({ imguiCommandBuffer }, {}, {}, vk::PipelineStageFlagBits::eNone, {});
|
||||||
|
|
||||||
ImGui_ImplVulkan_DestroyFontUploadObjects();
|
//ImGui_ImplVulkan_DestroyFontUploadObjects();
|
||||||
|
|
||||||
renderGraph->GetNode("ImGui Node")->GetSubpass("ImGui Draw")->AddExteriorDrawCalls([](Handle<SHVkCommandBuffer>& cmd) {
|
renderGraph->GetNode("ImGui Node")->GetSubpass("ImGui Draw")->AddExteriorDrawCalls([](Handle<SHVkCommandBuffer>& cmd) {
|
||||||
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), cmd->GetVkCommandBuffer());
|
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), cmd->GetVkCommandBuffer());
|
||||||
|
|
|
@ -23,21 +23,39 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHVec3 view = target - pos; view = SHVec3::Normalise(view);
|
SHVec3 view = target - pos; view = SHVec3::Normalise(view);
|
||||||
SHVec3 right = SHVec3::Cross(view, up); right = SHVec3::Normalise(right);
|
SHVec3 right = SHVec3::Cross(view, up); right = SHVec3::Normalise(right);
|
||||||
const SHVec3 UP = SHVec3::Cross(right, view);
|
const SHVec3 UP = SHVec3::Cross(view, right);
|
||||||
|
|
||||||
|
//viewMatrix = SHMatrix::Identity;
|
||||||
|
//viewMatrix(0, 0) = UP[0];
|
||||||
|
//viewMatrix(1, 0) = UP[1];
|
||||||
|
//viewMatrix(2, 0) = UP[2];
|
||||||
|
//viewMatrix(0, 1) = right[0];
|
||||||
|
//viewMatrix(1, 1) = right[1];
|
||||||
|
//viewMatrix(2, 1) = right[2];
|
||||||
|
//viewMatrix(0, 2) = view[0];
|
||||||
|
//viewMatrix(1, 2) = view[1];
|
||||||
|
//viewMatrix(2, 2) = view[2];
|
||||||
|
//viewMatrix(3, 0) = -UP.Dot(pos);
|
||||||
|
//viewMatrix(3, 1) = -right.Dot(pos);
|
||||||
|
//viewMatrix(3, 2) = -view.Dot(pos);
|
||||||
|
|
||||||
viewMatrix = SHMatrix::Identity;
|
viewMatrix = SHMatrix::Identity;
|
||||||
viewMatrix(0, 0) = UP[0];
|
viewMatrix(0, 0) = right[0];
|
||||||
viewMatrix(1, 0) = UP[1];
|
viewMatrix(0, 1) = right[1];
|
||||||
viewMatrix(2, 0) = UP[2];
|
viewMatrix(0, 2) = right[2];
|
||||||
viewMatrix(0, 1) = right[0];
|
|
||||||
viewMatrix(1, 1) = right[1];
|
viewMatrix(1, 0) = UP[0];
|
||||||
viewMatrix(2, 1) = right[2];
|
viewMatrix(1, 1) = UP[1];
|
||||||
viewMatrix(0, 2) = view[0];
|
viewMatrix(1, 2) = UP[2];
|
||||||
viewMatrix(1, 2) = view[1];
|
|
||||||
viewMatrix(2, 2) = view[2];
|
viewMatrix(2, 0) = view[0];
|
||||||
viewMatrix(3, 0) = -UP.Dot(pos);
|
viewMatrix(2, 1) = view[1];
|
||||||
viewMatrix(3, 1) = -right.Dot(pos);
|
viewMatrix(2, 2) = view[2];
|
||||||
viewMatrix(3, 2) = -view.Dot(pos);
|
|
||||||
|
viewMatrix(0, 3) = -right.Dot(pos);
|
||||||
|
viewMatrix(1, 3) = -UP.Dot(pos);
|
||||||
|
viewMatrix(2, 3) = -view.Dot(pos);
|
||||||
|
|
||||||
|
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace SHADE
|
||||||
screenCamera->SetOrthographic(static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.01f, 100.0f);
|
screenCamera->SetOrthographic(static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.01f, 100.0f);
|
||||||
worldCamera = resourceManager.Create<SHCamera>();
|
worldCamera = resourceManager.Create<SHCamera>();
|
||||||
//worldCamera->SetLookAt(SHVec3(1.0f, 0.0f, -1.0f), SHVec3(0.0f, 0.0f, 2.0f), SHVec3(0.0f, 1.0f, 0.0f));
|
//worldCamera->SetLookAt(SHVec3(1.0f, 0.0f, -1.0f), SHVec3(0.0f, 0.0f, 2.0f), SHVec3(0.0f, 1.0f, 0.0f));
|
||||||
worldCamera->SetLookAt(SHVec3(0.0f, 5.0f, -1.0f), SHVec3(0.0f, 0.0f, 2.0f), SHVec3(0.0f, 1.0f, 0.0f));
|
worldCamera->SetLookAt(SHVec3(0.0f, 0.0f, 0.0f), SHVec3(0.0f, 0.0f, -2.0f), SHVec3(0.0f, 1.0f, 0.0f));
|
||||||
worldCamera->SetPerspective(90.0f, static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.0f, 100.0f);
|
worldCamera->SetPerspective(90.0f, static_cast<float>(windowDims.first), static_cast<float>(windowDims.second), 0.0f, 100.0f);
|
||||||
|
|
||||||
// Create Default Viewport
|
// Create Default Viewport
|
||||||
|
@ -136,17 +136,19 @@ namespace SHADE
|
||||||
|
|
||||||
// Initialize world render graph
|
// Initialize world render graph
|
||||||
worldRenderGraph->Init(device, swapchain, globalData);
|
worldRenderGraph->Init(device, swapchain, globalData);
|
||||||
|
worldRenderGraph->AddResource("Depth Buffer", SH_ATT_DESC_TYPE::DEPTH_STENCIL, windowDims.first, windowDims.second, swapchain->GetDepthFormat());
|
||||||
//worldRenderGraph->AddResource("Position", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
//worldRenderGraph->AddResource("Position", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
//worldRenderGraph->AddResource("Normals", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
//worldRenderGraph->AddResource("Normals", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
//worldRenderGraph->AddResource("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
//worldRenderGraph->AddResource("Composite", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eR16G16B16A16Sfloat);
|
||||||
worldRenderGraph->AddResource("Scene", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eB8G8R8A8Unorm);
|
//worldRenderGraph->AddResource("Scene", SH_ATT_DESC_TYPE::COLOR, windowDims.first, windowDims.second, vk::Format::eB8G8R8A8Unorm);
|
||||||
worldRenderGraph->AddResource("Present", SH_ATT_DESC_TYPE::COLOR_PRESENT, windowDims.first, windowDims.second);
|
worldRenderGraph->AddResource("Present", SH_ATT_DESC_TYPE::COLOR_PRESENT, windowDims.first, windowDims.second);
|
||||||
auto node = worldRenderGraph->AddNode("G-Buffer", { /*"Composite", "Position", */"Present" }, {}); // no predecessors
|
auto node = worldRenderGraph->AddNode("G-Buffer", { /*"Composite", "Position", */"Depth Buffer", "Present" }, {}); // no predecessors
|
||||||
|
|
||||||
//First subpass to write to G-Buffer
|
//First subpass to write to G-Buffer
|
||||||
auto gBufferWriteSubpass = node->AddSubpass("G-Buffer Write");
|
auto gBufferWriteSubpass = node->AddSubpass("G-Buffer Write");
|
||||||
//gBufferWriteSubpass->AddColorOutput("Scene");
|
//gBufferWriteSubpass->AddColorOutput("Scene");
|
||||||
gBufferWriteSubpass->AddColorOutput("Present");
|
gBufferWriteSubpass->AddColorOutput("Present");
|
||||||
|
gBufferWriteSubpass->AddDepthOutput ("Depth Buffer", SH_ATT_DESC_TYPE::DEPTH_STENCIL);
|
||||||
//writeSubpass->AddColorOutput("Normals");
|
//writeSubpass->AddColorOutput("Normals");
|
||||||
|
|
||||||
// //Second subpass to read from G-Buffer
|
// //Second subpass to read from G-Buffer
|
||||||
|
|
|
@ -226,33 +226,63 @@ namespace SHADE
|
||||||
|
|
||||||
vk::Format SHTextureLibrary::ddsLoaderToVkFormat(tinyddsloader::DDSFile::DXGIFormat format, bool isLinear)
|
vk::Format SHTextureLibrary::ddsLoaderToVkFormat(tinyddsloader::DDSFile::DXGIFormat format, bool isLinear)
|
||||||
{
|
{
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC1_UNorm:
|
case tinyddsloader::DDSFile::DXGIFormat::BC1_UNorm:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC1_UNorm_SRGB:
|
return vk::Format::eBc1RgbaUnormBlock;
|
||||||
return isLinear ? vk::Format::eBc1RgbaUnormBlock : vk::Format::eBc1RgbaSrgbBlock;
|
case tinyddsloader::DDSFile::DXGIFormat::BC1_UNorm_SRGB:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC2_UNorm:
|
return vk::Format::eBc1RgbaSrgbBlock;
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC2_UNorm_SRGB:
|
case tinyddsloader::DDSFile::DXGIFormat::BC2_UNorm:
|
||||||
return isLinear ? vk::Format::eBc2UnormBlock : vk::Format::eBc2SrgbBlock;
|
case tinyddsloader::DDSFile::DXGIFormat::BC2_UNorm_SRGB:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC3_UNorm:
|
return isLinear ? vk::Format::eBc2UnormBlock : vk::Format::eBc2SrgbBlock;
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC3_UNorm_SRGB:
|
case tinyddsloader::DDSFile::DXGIFormat::BC3_UNorm:
|
||||||
return isLinear ? vk::Format::eBc3UnormBlock : vk::Format::eBc3SrgbBlock;
|
case tinyddsloader::DDSFile::DXGIFormat::BC3_UNorm_SRGB:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC5_UNorm:
|
return isLinear ? vk::Format::eBc3UnormBlock : vk::Format::eBc3SrgbBlock;
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::BC5_SNorm:
|
case tinyddsloader::DDSFile::DXGIFormat::BC5_UNorm:
|
||||||
return isLinear ? vk::Format::eBc5UnormBlock : vk::Format::eBc5SnormBlock;
|
case tinyddsloader::DDSFile::DXGIFormat::BC5_SNorm:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_UNorm:
|
return isLinear ? vk::Format::eBc5UnormBlock : vk::Format::eBc5SnormBlock;
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_UNorm_SRGB:
|
case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_UNorm:
|
||||||
return isLinear ? vk::Format::eR8G8B8A8Unorm : vk::Format::eR8G8B8A8Srgb;
|
case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_UNorm_SRGB:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_SNorm:
|
return isLinear ? vk::Format::eR8G8B8A8Unorm : vk::Format::eR8G8B8A8Srgb;
|
||||||
return vk::Format::eR8G8B8A8Snorm;
|
case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_SNorm:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8A8_UNorm:
|
return vk::Format::eR8G8B8A8Snorm;
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8A8_UNorm_SRGB:
|
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8A8_UNorm:
|
||||||
return isLinear ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8A8Srgb;
|
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8A8_UNorm_SRGB:
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8X8_UNorm:
|
return isLinear ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8A8Srgb;
|
||||||
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8X8_UNorm_SRGB:
|
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8X8_UNorm:
|
||||||
return isLinear ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8Srgb;
|
case tinyddsloader::DDSFile::DXGIFormat::B8G8R8X8_UNorm_SRGB:
|
||||||
default:
|
return isLinear ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8Srgb;
|
||||||
throw std::runtime_error("Unsupported DDS format.");
|
default:
|
||||||
}
|
throw std::runtime_error("Unsupported DDS format.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//switch (format)
|
||||||
|
//{
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_UNorm:
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::R8G8B8A8_UNorm_SRGB:
|
||||||
|
// return (isLinear) ? vk::Format::eR8G8B8A8Unorm : vk::Format::eR8G8B8A8Srgb;
|
||||||
|
//
|
||||||
|
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::B8G8R8A8_UNorm:
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::B8G8R8A8_UNorm_SRGB:
|
||||||
|
// return (isLinear) ? vk::Format::eB8G8R8A8Unorm : vk::Format::eB8G8R8A8Srgb;
|
||||||
|
//
|
||||||
|
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC1_UNorm:
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC1_UNorm_SRGB:
|
||||||
|
// return (isLinear) ? vk::Format::eBc1RgbaUnormBlock : vk::Format::eBc1RgbaSrgbBlock;
|
||||||
|
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC2_UNorm:
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC2_UNorm_SRGB:
|
||||||
|
// return (isLinear) ? vk::Format::eBc2UnormBlock : vk::Format::eBc2SrgbBlock;
|
||||||
|
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC3_UNorm:
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC3_UNorm_SRGB:
|
||||||
|
// return (isLinear) ? vk::Format::eBc3UnormBlock : vk::Format::eBc3SrgbBlock;
|
||||||
|
|
||||||
|
//case tinyddsloader::DDSFile::DXGIFormat::BC5_UNorm:
|
||||||
|
// return (isLinear) ? vk::Format::eBc5UnormBlock : vk::Format::eBc5SnormBlock;
|
||||||
|
//
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
#version 450
|
#version 450
|
||||||
#extension GL_ARB_separate_shader_objects : enable
|
#extension GL_ARB_separate_shader_objects : enable
|
||||||
#extension GL_ARB_shading_language_420pack : enable
|
#extension GL_ARB_shading_language_420pack : enable
|
||||||
|
#extension GL_EXT_nonuniform_qualifier : require
|
||||||
|
|
||||||
layout(location = 0) in struct
|
layout(location = 0) in struct
|
||||||
{
|
{
|
||||||
//mat3 BTN;
|
//mat3 BTN;
|
||||||
vec4 vertColor;
|
vec4 vertColor;
|
||||||
//vec3 localSpacePosition;
|
//vec3 localSpacePosition;
|
||||||
//vec2 uv;
|
vec2 uv;
|
||||||
//vec3 localLightPosition;
|
//vec3 localLightPosition;
|
||||||
//vec3 localEyePosition;
|
//vec3 localEyePosition;
|
||||||
|
|
||||||
|
@ -31,42 +32,11 @@ layout(location = 0) out vec4 outColor;
|
||||||
//layout(binding = 3) uniform sampler2D glossinessMap;
|
//layout(binding = 3) uniform sampler2D glossinessMap;
|
||||||
//layout(binding = 4) uniform sampler2D samplerRoughnessMap;
|
//layout(binding = 4) uniform sampler2D samplerRoughnessMap;
|
||||||
|
|
||||||
|
layout (set = 0, binding = 1) uniform sampler2D textures[];
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//vec3 normal;
|
vec4 color;
|
||||||
|
color = (texture (textures[1], In.uv));
|
||||||
//// Get the tangent space normal from normal map. It is a BC5 texture and therefore only use red and green
|
outColor = color;
|
||||||
//normal.xy = (texture (normalMap, In.uv).gr * 2.0f) - 1.0f;
|
|
||||||
|
|
||||||
//// z value is derived (TODO: Find out what this does)
|
|
||||||
//normal.z = sqrt(1.0f - dot(normal.xy, normal.xy));
|
|
||||||
|
|
||||||
//// Transform the normal from tangent space to local space
|
|
||||||
//normal = In.BTN * normal;
|
|
||||||
|
|
||||||
//// Get the vector from fragment to light
|
|
||||||
//vec3 localLightDir = normalize(In.localLightPosition - In.localSpacePosition);
|
|
||||||
|
|
||||||
//// get the value of dot between normal from texture and frag to light
|
|
||||||
//float diffuse = max(0, dot(normal, localLightDir));
|
|
||||||
|
|
||||||
//// sample the diffuse texture
|
|
||||||
//vec4 diffuseColor = texture (diffuseMap, In.uv) * In.vertColor;
|
|
||||||
|
|
||||||
//vec3 eyeDirection = normalize(In.localSpacePosition - In.localEyePosition);
|
|
||||||
|
|
||||||
//const float shininess = mix(1, 100, 1 - texture (samplerRoughnessMap, In.uv).r);
|
|
||||||
|
|
||||||
//float specular = pow(max(0, dot(normal, normalize(localLightDir - eyeDirection))), shininess);
|
|
||||||
|
|
||||||
//outColor.rgb = testPushConstant.ambientColor.rgb * diffuseColor.rgb * texture (aoMap, In.uv).rgb;
|
|
||||||
|
|
||||||
//outColor.rgb += testPushConstant.lightColor.rgb * (specular.rrr * 0.4 + diffuse.rrr * diffuseColor.rgb);
|
|
||||||
|
|
||||||
//const float gamma = testPushConstant.eyePosition.w;
|
|
||||||
//outColor.rgb = pow(outColor.rgb, vec3(1.0f / gamma));
|
|
||||||
//outColor.a = diffuseColor.a;
|
|
||||||
|
|
||||||
|
|
||||||
outColor = vec4 (1.0f);
|
|
||||||
}
|
}
|
Binary file not shown.
|
@ -24,7 +24,7 @@ layout(location = 0) out struct
|
||||||
//mat3 BTN;
|
//mat3 BTN;
|
||||||
vec4 vertColor;
|
vec4 vertColor;
|
||||||
//vec3 localSpacePosition;
|
//vec3 localSpacePosition;
|
||||||
//vec2 uv;
|
vec2 uv;
|
||||||
//vec3 localLightPosition;
|
//vec3 localLightPosition;
|
||||||
//vec3 localEyePosition;
|
//vec3 localEyePosition;
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ void main()
|
||||||
|
|
||||||
// render NDC first
|
// render NDC first
|
||||||
//gl_Position = vec4(aVertexPos, 1.0f);
|
//gl_Position = vec4(aVertexPos, 1.0f);
|
||||||
|
Out.uv = aUV;
|
||||||
gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
||||||
Out.vertColor = vec4 (aVertexPos, 1.0f);
|
Out.vertColor = vec4 (aVertexPos, 1.0f);
|
||||||
}
|
}
|
Binary file not shown.
Loading…
Reference in New Issue