diff --git a/implementations/main.cpp b/implementations/main.cpp index ff86818..01788ce 100644 --- a/implementations/main.cpp +++ b/implementations/main.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) { } else if (extension == ".png") { // Load PNG as TextureAsset - auto texture = TextureAsset>::LoadPNG(inputPath); + auto texture = TextureAsset>::LoadPNG<_Float16>(inputPath); texture.Save(outputPath); } else { diff --git a/interfaces/Crafter.Asset-Texture.cppm b/interfaces/Crafter.Asset-Texture.cppm index aa9137d..292c242 100644 --- a/interfaces/Crafter.Asset-Texture.cppm +++ b/interfaces/Crafter.Asset-Texture.cppm @@ -62,6 +62,7 @@ export namespace Crafter { return tex; } + template static TextureAsset LoadPNG(fs::path path) { TextureAsset tex; @@ -79,12 +80,12 @@ export namespace Crafter { tex.opaque = OpaqueType::FullyOpaque; - if constexpr(std::same_as || std::same_as || std::same_as) { + if constexpr(std::same_as || std::same_as || std::same_as) { for(std::uint32_t i = 0; i < sizeX*sizeY; i++) { - tex.pixels[i].r = (((T)data[i*4])/255); - tex.pixels[i].g = (((T)data[i*4+1])/255); - tex.pixels[i].b = (((T)data[i*4+2])/255); - tex.pixels[i].a = (((T)data[i*4+3])/255); + tex.pixels[i].r = TT(data[i*4])/255; + tex.pixels[i].g = TT(data[i*4+1])/255; + tex.pixels[i].b = TT(data[i*4+2])/255; + tex.pixels[i].a = TT(data[i*4+3])/255; } for(std::uint32_t i = 0; i < tex.sizeX* tex.sizeY; i++) {