Trying to add fluid simulation
This commit is contained in:
1 parent
056589a6f9
commit
ac317a3829
65 files changed
+2708
-371
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "BasePass.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/EnvironmentMapAsset.h"
|
||||
#include "Component/Camera.h"
|
||||
#include "Graphics/Command.h"
|
||||
#include "Graphics/Descriptor.h"
|
||||
@@ -12,10 +13,9 @@
|
||||
#include "Math/Matrix.h"
|
||||
#include "Math/Vector.h"
|
||||
#include "MinimalEngine.h"
|
||||
#include "ShadowPass.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "Asset/EnvironmentMapAsset.h"
|
||||
#include "Scene/LightEnvironment.h"
|
||||
#include "Scene/Scene.h"
|
||||
#include "ShadowPass.h"
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
@@ -59,10 +59,8 @@ BasePass::BasePass(Gfx::PGraphics graphics, PScene scene) : RenderPass(graphics)
|
||||
.name = SHADOWSAMPLER_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLER,
|
||||
});
|
||||
shadowMappingLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = CASCADE_SPLIT_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER
|
||||
});
|
||||
shadowMappingLayout->addDescriptorBinding(
|
||||
Gfx::DescriptorBinding{.name = CASCADE_SPLIT_NAME, .descriptorType = Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER});
|
||||
shadowMappingLayout->create();
|
||||
|
||||
basePassLayout->addDescriptorLayout(lightCullingLayout);
|
||||
@@ -116,6 +114,58 @@ BasePass::BasePass(Gfx::PGraphics graphics, PScene scene) : RenderPass(graphics)
|
||||
.minLod = 0.0f,
|
||||
.borderColor = Gfx::SE_BORDER_COLOR_FLOAT_OPAQUE_WHITE,
|
||||
});
|
||||
debugPipelineLayout = graphics->createPipelineLayout("DebugPassLayout");
|
||||
debugPipelineLayout->addDescriptorLayout(viewParamsLayout);
|
||||
|
||||
graphics->beginShaderCompilation(ShaderCompilationInfo{
|
||||
.name = "DebugVertex",
|
||||
.modules = {"Debug"},
|
||||
.entryPoints =
|
||||
{
|
||||
{"vertexMain", "Debug"},
|
||||
{"fragmentMain", "Debug"},
|
||||
},
|
||||
.rootSignature = debugPipelineLayout,
|
||||
});
|
||||
debugVertexShader = graphics->createVertexShader({0});
|
||||
debugFragmentShader = graphics->createFragmentShader({1});
|
||||
debugPipelineLayout->create();
|
||||
|
||||
skyboxDataLayout = graphics->createDescriptorLayout("pSkyboxData");
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.name = "transformMatrix", .uniformLength = sizeof(Matrix4)});
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.name = "fogBlend", .uniformLength = sizeof(Vector4)});
|
||||
skyboxDataLayout->create();
|
||||
textureLayout = graphics->createDescriptorLayout("pSkyboxTextures");
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = SKYBOXDAY_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
.access = Gfx::SE_DESCRIPTOR_ACCESS_SAMPLE_BIT,
|
||||
});
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = SKYBOXNIGHT_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
.access = Gfx::SE_DESCRIPTOR_ACCESS_SAMPLE_BIT,
|
||||
});
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = SKYBOXSAMPLER_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLER,
|
||||
});
|
||||
textureLayout->create();
|
||||
|
||||
pipelineLayout = graphics->createPipelineLayout("SkyboxLayout");
|
||||
pipelineLayout->addDescriptorLayout(viewParamsLayout);
|
||||
pipelineLayout->addDescriptorLayout(skyboxDataLayout);
|
||||
pipelineLayout->addDescriptorLayout(textureLayout);
|
||||
|
||||
graphics->beginShaderCompilation(ShaderCompilationInfo{
|
||||
.name = "SkyboxVertex",
|
||||
.modules = {"Skybox"},
|
||||
.entryPoints = {{"vertexMain", "Skybox"}, {"fragmentMain", "Skybox"}},
|
||||
.rootSignature = pipelineLayout,
|
||||
});
|
||||
vertexShader = graphics->createVertexShader({0});
|
||||
fragmentShader = graphics->createFragmentShader({1});
|
||||
pipelineLayout->create();
|
||||
}
|
||||
|
||||
BasePass::~BasePass() {}
|
||||
@@ -176,7 +226,7 @@ void BasePass::render() {
|
||||
transparentCulling->updateTexture(LIGHTGRID_NAME, 0, tLightGrid->getDefaultView());
|
||||
opaqueCulling->writeChanges();
|
||||
transparentCulling->writeChanges();
|
||||
|
||||
|
||||
shadowMappingLayout->reset();
|
||||
shadowMapping = shadowMappingLayout->allocateDescriptorSet();
|
||||
for (uint32 i = 0; i < NUM_CASCADES; ++i) {
|
||||
@@ -268,7 +318,8 @@ void BasePass::render() {
|
||||
command->bindPipeline(graphics->createGraphicsPipeline(std::move(pipelineInfo)));
|
||||
}
|
||||
command->bindDescriptor({viewParamsSet, vertexData->getVertexDataSet(), vertexData->getInstanceDataSet(),
|
||||
scene->getLightEnvironment()->getDescriptorSet(), Material::getDescriptorSet(), shadowMapping, opaqueCulling});
|
||||
scene->getLightEnvironment()->getDescriptorSet(), Material::getDescriptorSet(), shadowMapping,
|
||||
opaqueCulling});
|
||||
for (const auto& drawCall : materialData.instances) {
|
||||
command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT |
|
||||
Gfx::SE_SHADER_STAGE_FRAGMENT_BIT,
|
||||
@@ -382,8 +433,8 @@ void BasePass::render() {
|
||||
transparentCommand->bindPipeline(pipeline);
|
||||
}
|
||||
transparentCommand->bindDescriptor({viewParamsSet, t.vertexData->getVertexDataSet(), t.vertexData->getInstanceDataSet(),
|
||||
scene->getLightEnvironment()->getDescriptorSet(), Material::getDescriptorSet(), shadowMapping,
|
||||
transparentCulling});
|
||||
scene->getLightEnvironment()->getDescriptorSet(), Material::getDescriptorSet(),
|
||||
shadowMapping, transparentCulling});
|
||||
transparentCommand->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT |
|
||||
Gfx::SE_SHADER_STAGE_FRAGMENT_BIT,
|
||||
0, sizeof(VertexData::DrawCallOffsets), &t.offsets);
|
||||
@@ -536,24 +587,6 @@ void BasePass::createRenderPass() {
|
||||
|
||||
// Debug rendering
|
||||
{
|
||||
debugPipelineLayout = graphics->createPipelineLayout("DebugPassLayout");
|
||||
debugPipelineLayout->addDescriptorLayout(viewParamsLayout);
|
||||
|
||||
ShaderCompilationInfo createInfo = {
|
||||
.name = "DebugVertex",
|
||||
.modules = {"Debug"},
|
||||
.entryPoints =
|
||||
{
|
||||
{"vertexMain", "Debug"},
|
||||
{"fragmentMain", "Debug"},
|
||||
},
|
||||
.rootSignature = debugPipelineLayout,
|
||||
};
|
||||
graphics->beginShaderCompilation(createInfo);
|
||||
debugVertexShader = graphics->createVertexShader({0});
|
||||
debugFragmentShader = graphics->createFragmentShader({1});
|
||||
debugPipelineLayout->create();
|
||||
|
||||
VertexInputStateCreateInfo inputCreate = {
|
||||
.bindings =
|
||||
{
|
||||
@@ -605,27 +638,6 @@ void BasePass::createRenderPass() {
|
||||
}
|
||||
// Skybox
|
||||
{
|
||||
skyboxDataLayout = graphics->createDescriptorLayout("pSkyboxData");
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.name = "transformMatrix", .uniformLength = sizeof(Matrix4)});
|
||||
skyboxDataLayout->addDescriptorBinding(Gfx::DescriptorBinding{.name = "fogBlend", .uniformLength = sizeof(Vector4)});
|
||||
skyboxDataLayout->create();
|
||||
textureLayout = graphics->createDescriptorLayout("pSkyboxTextures");
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = SKYBOXDAY_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
.access = Gfx::SE_DESCRIPTOR_ACCESS_SAMPLE_BIT,
|
||||
});
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = SKYBOXNIGHT_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
.access = Gfx::SE_DESCRIPTOR_ACCESS_SAMPLE_BIT,
|
||||
});
|
||||
textureLayout->addDescriptorBinding(Gfx::DescriptorBinding{
|
||||
.name = SKYBOXSAMPLER_NAME,
|
||||
.descriptorType = Gfx::SE_DESCRIPTOR_TYPE_SAMPLER,
|
||||
});
|
||||
textureLayout->create();
|
||||
|
||||
skyboxSampler = graphics->createSampler({
|
||||
.magFilter = Gfx::SE_FILTER_LINEAR,
|
||||
.minFilter = Gfx::SE_FILTER_LINEAR,
|
||||
@@ -642,23 +654,6 @@ void BasePass::createRenderPass() {
|
||||
skyboxData.fogColor = skybox.fogColor;
|
||||
skyboxData.blendFactor = skybox.blendFactor;
|
||||
|
||||
pipelineLayout = graphics->createPipelineLayout("SkyboxLayout");
|
||||
pipelineLayout->addDescriptorLayout(viewParamsLayout);
|
||||
pipelineLayout->addDescriptorLayout(skyboxDataLayout);
|
||||
pipelineLayout->addDescriptorLayout(textureLayout);
|
||||
|
||||
ShaderCompilationInfo createInfo = {
|
||||
.name = "SkyboxVertex",
|
||||
.modules = {"Skybox"},
|
||||
.entryPoints = {{"vertexMain", "Skybox"}, {"fragmentMain", "Skybox"}},
|
||||
.rootSignature = pipelineLayout,
|
||||
};
|
||||
graphics->beginShaderCompilation(createInfo);
|
||||
vertexShader = graphics->createVertexShader({0});
|
||||
fragmentShader = graphics->createFragmentShader({1});
|
||||
|
||||
pipelineLayout->create();
|
||||
|
||||
Gfx::LegacyPipelineCreateInfo gfxInfo = {
|
||||
.topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
|
||||
.vertexShader = vertexShader,
|
||||
@@ -673,10 +668,11 @@ void BasePass::createRenderPass() {
|
||||
{
|
||||
.polygonMode = Gfx::SE_POLYGON_MODE_FILL,
|
||||
},
|
||||
.depthStencilState = {
|
||||
.depthTestEnable = true,
|
||||
.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER,
|
||||
},
|
||||
.depthStencilState =
|
||||
{
|
||||
.depthTestEnable = true,
|
||||
.depthCompareOp = Gfx::SE_COMPARE_OP_GREATER,
|
||||
},
|
||||
.colorBlend =
|
||||
{
|
||||
.attachmentCount = 1,
|
||||
|
||||
Reference in new issue
Block a user