More water changes

This commit is contained in:
Dynamitos
2024-08-26 22:35:33 +02:00
parent ab721ec953
commit e3b06dfb22
9 changed files with 69 additions and 18 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ void TextureLoader::importAsset(TextureImportArgs args) {
PTextureAsset ref = asset;
asset->setStatus(Asset::Status::Loading);
AssetRegistry::get().registerTexture(std::move(asset));
import(args, ref);
getThreadPool().runAsync([=](){import(args, ref);});
}
PTextureAsset TextureLoader::getPlaceholderTexture() { return placeholderAsset; }
@@ -111,7 +111,7 @@ void TextureLoader::import(TextureImportArgs args, PTextureAsset textureAsset) {
ktxBasisParams basisParams = {
.structSize = sizeof(ktxBasisParams),
.uastc = true,
.threadCount = std::thread::hardware_concurrency(),
.threadCount = 1,
.uastcFlags = KTX_PACK_UASTC_LEVEL_DEFAULT,
.uastcRDO = true,
};
@@ -146,6 +146,6 @@ void TextureLoader::import(TextureImportArgs args, PTextureAsset textureAsset) {
textureAsset->setTexture(std::move(serialized));
AssetRegistry::saveAsset(textureAsset, TextureAsset::IDENTIFIER, textureAsset->getFolderPath(), textureAsset->getName());
textureAsset->setStatus(Asset::Status::Ready);
}
+5 -3
View File
@@ -64,9 +64,10 @@ int main() {
.filePath = sourcePath / "import/textures/skyboxsun5deg_tn.jpg",
.type = TextureImportType::TEXTURE_CUBEMAP,
});
//AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "import/models/sheepsbody.fbx",
//});
AssetImporter::importMesh(MeshImportArgs{
.filePath = sourcePath / "import/models/ship.glb",
.importPath = "ship",
});
// AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.glb",
// .importPath = "Whitechapel",
@@ -75,6 +76,7 @@ int main() {
// .filePath = sourcePath / "import/models/city-suburbs/source/city-suburbs.obj",
// .importPath = "suburbs",
// });
vd->commitMeshes();
WindowCreateInfo mainWindowInfo = {
.width = 1920,
@@ -444,7 +444,7 @@ Gfx::ORenderCommand WaterRenderer::render(Gfx::PDescriptorSet viewParamsSet) {
waterCommand->setViewport(viewport);
waterCommand->bindPipeline(waterPipeline);
waterCommand->bindDescriptor({viewParamsSet, materialSet});
waterCommand->drawMesh(waterTiles->getNumElements(), 1, 1);
waterCommand->drawMesh(waterTiles->getNumElements(), 4, 1);
return waterCommand;
}
@@ -471,7 +471,7 @@ void WaterRenderer::setViewport(Gfx::PViewport _viewport, Gfx::PRenderPass rende
.blendAttachments =
{
Gfx::ColorBlendState::BlendAttachment{
.blendEnable = true,
.blendEnable = false,
},
},
},
@@ -98,7 +98,7 @@ class WaterRenderer {
Gfx::OSampler linearRepeatSampler;
struct MaterialParams {
Vector sunDirection = Vector(-1.29f, -1.0f, 4.86f);
Vector sunDirection = Vector(-5, 0.6186, 5);
float displacementDepthAttenuation = 1;
float foamSubtract0 = 0.04f;
@@ -116,7 +116,7 @@ class WaterRenderer {
float normalDepthAttenuation = 1;
float roughness = 0.075f;
Vector sunIrradiance = Vector(1.0f, 0.694f, 0.32f);
Vector sunIrradiance = Vector(0.9921, 0.9058, 0.5450);
float foamRoughnessModifier = 0;
Vector scatterColor = Vector(0.016f, 0.0735f, 0.16f);