Fixing more stuff so i can import the car as well

This commit is contained in:
Dynamitos
2024-05-01 19:39:57 +02:00
parent dfcfc2bb1e
commit 247d6a54fb
5 changed files with 19 additions and 2 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ void taskMain(
{
uint m = mesh.meshletOffset + i;
MeshletDescription meshlet = pScene.meshletInfos[m];
//if(meshlet.bounding.insideFrustum(localToView, viewFrustum))
if(meshlet.bounding.insideFrustum(localToView, viewFrustum))
{
uint index;
InterlockedAdd(head, 1, index);
+11
View File
@@ -110,6 +110,9 @@ void MeshLoader::loadMaterials(const aiScene* scene, const Map<std::string, PTex
std::string materialName = fmt::format("M{0}{1}{2}", baseName, material->GetName().C_Str(), i);
materialName.erase(std::remove(materialName.begin(), materialName.end(), '.'), materialName.end()); // dots break adding the .asset extension later
materialName.erase(std::remove(materialName.begin(), materialName.end(), '-'), materialName.end()); // dots break adding the .asset extension later
materialName.erase(std::remove(materialName.begin(), materialName.end(), ' '), materialName.end()); // dots break adding the .asset extension later
materialName.erase(std::remove(materialName.begin(), materialName.end(), '('), materialName.end()); // dots break adding the .asset extension later
materialName.erase(std::remove(materialName.begin(), materialName.end(), ')'), materialName.end()); // dots break adding the .asset extension later
Gfx::ODescriptorLayout materialLayout = graphics->createDescriptorLayout("pMaterial");
Array<OShaderExpression> expressions;
Array<std::string> parameters;
@@ -161,6 +164,14 @@ void MeshLoader::loadMaterials(const aiScene* scene, const Map<std::string, PTex
});
texture = AssetRegistry::findTexture(importPath, texFilename.stem().string());
}
else if (std::filesystem::exists(meshDirectory / texFilename))
{
AssetImporter::importTexture(TextureImportArgs{
.filePath = meshDirectory / texFilename,
.importPath = importPath,
});
texture = AssetRegistry::findTexture(importPath, texFilename.stem().string());
}
else
{
std::cout << "couldnt find " << texPath.C_Str() << std::endl;
+4
View File
@@ -62,6 +62,10 @@ int main() {
.filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.fbx",
.importPath = "Whitechapel"
});
AssetImporter::importMesh(MeshImportArgs{
.filePath = sourcePath / "import/models/Volvo S90/Volvo S90.fbx",
.importPath = "Volvo",
});
WindowCreateInfo mainWindowInfo;
mainWindowInfo.title = "SeeleEngine";
mainWindowInfo.width = 1920;
+1 -1
View File
@@ -17,7 +17,7 @@ static Map<Vulkan::Buffer*, PendingBuffer> pendingBuffers;
Buffer::Buffer(PGraphics graphics, uint64 size, VkBufferUsageFlags usage, Gfx::QueueType& queueType, bool dynamic,
std::string name)
: graphics(graphics), currentBuffer(0), size(size), owner(queueType), usage(usage), name(name) {
: graphics(graphics), currentBuffer(0), size(size), owner(queueType), usage(usage | VK_BUFFER_USAGE_TRANSFER_DST_BIT), name(name) {
createBuffer();
}
@@ -321,6 +321,7 @@ PipelineLayout::PipelineLayout(PGraphics graphics, const std::string& name, Gfx:
PipelineLayout::~PipelineLayout() {}
std::mutex layoutLock;
Map<uint32, VkPipelineLayout> cachedLayouts;
void PipelineLayout::create() {
@@ -357,6 +358,7 @@ void PipelineLayout::create() {
layoutHash = CRC::Calculate(createInfo.pSetLayouts, sizeof(VkDescriptorSetLayout) * createInfo.setLayoutCount,
CRC::CRC_32(), layoutHash);
std::unique_lock l(layoutLock);
if (cachedLayouts.contains(layoutHash)) {
layoutHandle = cachedLayouts[layoutHash];
return;