F16 tex fix
This commit is contained in:
parent
95ad5625a9
commit
09475ed28f
2 changed files with 7 additions and 6 deletions
|
|
@ -65,7 +65,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
else if (extension == ".png") {
|
||||
// Load PNG as TextureAsset
|
||||
auto texture = TextureAsset<Vector<_Float16, 4, 0>>::LoadPNG(inputPath);
|
||||
auto texture = TextureAsset<Vector<_Float16, 4, 4>>::LoadPNG<_Float16>(inputPath);
|
||||
texture.Save(outputPath);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ export namespace Crafter {
|
|||
return tex;
|
||||
}
|
||||
|
||||
template <typename TT>
|
||||
static TextureAsset<T> LoadPNG(fs::path path) {
|
||||
TextureAsset<T> tex;
|
||||
|
||||
|
|
@ -79,12 +80,12 @@ export namespace Crafter {
|
|||
|
||||
tex.opaque = OpaqueType::FullyOpaque;
|
||||
|
||||
if constexpr(std::same_as<T, _Float16> || std::same_as<T, float> || std::same_as<T, double>) {
|
||||
if constexpr(std::same_as<TT, _Float16> || std::same_as<TT, float> || std::same_as<TT, double>) {
|
||||
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++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue