demo buggy heightmap

This commit is contained in:
h4570
2022-08-01 10:04:21 +02:00
parent 47c323ec9e
commit 34b2956c08
12 changed files with 194 additions and 33 deletions
+12
View File
@@ -24,11 +24,23 @@ typedef void* png_colorp;
namespace Tyra {
struct PngPixel3 {
u8 r, g, b;
};
struct PngPixel4 {
u8 r, g, b, a;
};
class PngLoader : public TextureLoader {
public:
PngLoader();
~PngLoader();
inline TextureBuilderData* load(const std::string& fullpath) {
return load(fullpath.c_str());
}
TextureBuilderData* load(const char* fullpath);
private:
+2 -9
View File
@@ -107,11 +107,7 @@ void PngLoader::handle32bpp(TextureBuilderData* result, png_structp pngPtr,
png_read_image(pngPtr, rowPointers);
struct Pixel {
u8 r, g, b, a;
};
struct Pixel* pixels = (struct Pixel*)result->data;
struct PngPixel4* pixels = (struct PngPixel4*)result->data;
int k = 0;
for (int i = 0; i < result->height; i++) {
@@ -145,10 +141,7 @@ void PngLoader::handle24bpp(TextureBuilderData* result, png_structp pngPtr,
png_read_image(pngPtr, rowPointers);
struct Pixel3 {
u8 r, g, b;
};
struct Pixel3* pixels = (struct Pixel3*)result->data;
struct PngPixel3* pixels = (struct PngPixel3*)result->data;
int k = 0;
for (int i = 0; i < result->height; i++) {