Starting framework for static mesh rendering

This commit is contained in:
Dynamitos
2024-05-08 10:51:59 +02:00
parent af7d624d06
commit 46a2713729
31 changed files with 645 additions and 320 deletions
+3 -1
View File
@@ -69,6 +69,7 @@ void MeshLoader::loadTextures(const aiScene* scene, const std::filesystem::path&
texPath = (meshDirectory / texPath).replace_extension("png");
if (tex->mHeight == 0)
{
std::cout << "Dumping texture " << texPath << std::endl;
// already compressed, just dump it to the disk
std::ofstream file(texPath, std::ios::binary);
file.write((const char*)tex->pcData, tex->mWidth);
@@ -76,6 +77,7 @@ void MeshLoader::loadTextures(const aiScene* scene, const std::filesystem::path&
}
else
{
std::cout << "Writing extracted png " << texPath << std::endl;
// recompress data so that the TextureLoader can read it
unsigned char* texData = new unsigned char[tex->mWidth * tex->mHeight * 4];
convertAssimpARGB(texData, tex->pcData, tex->mWidth * tex->mHeight);
@@ -412,8 +414,8 @@ void MeshLoader::loadMaterials(const aiScene* scene, const Array<PTextureAsset>&
case aiShadingMode_Toon:
brdf.profile = "CelShading";
break;
case aiShadingMode_CookTorrance:
default:
case aiShadingMode_CookTorrance:
brdf.profile = "CookTorrance";
brdf.variables["roughness"] = outputRoughness;
brdf.variables["metallic"] = outputMetallic;
+6 -1
View File
@@ -61,7 +61,12 @@ void TextureLoader::import(TextureImportArgs args, PTextureAsset textureAsset)
auto ktxFile = args.filePath;
ktxFile.replace_extension("ktx");
std::stringstream ss;
ss << "toktx --encode etc1s " << ktxFile << " " << args.filePath;
ss << "toktx --encode etc1s ";
if (args.type == TextureImportType::TEXTURE_NORMAL)
{
ss << "--normal_mode ";
}
ss << ktxFile << " " << args.filePath;
system(ss.str().c_str());
args.filePath = ktxFile;
}
+1 -4
View File
@@ -58,15 +58,12 @@ int main() {
AssetImporter::importMesh(MeshImportArgs{
.filePath = sourcePath / "import/models/cube.fbx",
});
//AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "import/models/Arissa.fbx",
// });
AssetImporter::importMesh(MeshImportArgs{
.filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.glb",
.importPath = "Whitechapel"
});
//AssetImporter::importMesh(MeshImportArgs{
// .filePath = sourcePath / "import/models/Volvo S90/Volvo S90.fbx",
// .filePath = sourcePath / "import/models/Volvo S90/Volvo S90.blend",
// .importPath = "Volvo",
// });
WindowCreateInfo mainWindowInfo;