Merge branch 'voxel-upd' into vixel-upd-2

This commit is contained in:
alexei-zebra 2024-01-05 23:39:54 +03:00 • committed by GitHub
commit d9e1d353d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 498 additions and 286 deletions

View file

@ -302,7 +302,7 @@ void JObject::num(std::string key, float& dst) const {
dst = getNum(key, dst);
}
void JObject::num(std::string key, ubyte& dst) const {
void JObject::num(std::string key, u_char8& dst) const {
dst = getInteger(key, dst);
}

View file

@ -86,7 +86,7 @@ namespace json {
void num(std::string key, uint& dst) const;
void num(std::string key, int64_t& dst) const;
void num(std::string key, uint64_t& dst) const;
void num(std::string key, ubyte& dst) const;
void num(std::string key, u_char8& dst) const;
void num(std::string key, double& dst) const;
JObject* obj(std::string key) const;
JArray* arr(std::string key) const;

View file

@ -16,8 +16,8 @@
#include <png.h>
// returns 0 if all-right, 1 otherwise
int _png_write(const char* filename, uint width, uint height, const ubyte* data, bool alpha) {
uint pixsize = alpha ? 4 : 3;
int _png_write(const char* filename, u_int width, u_int height, const u_char8* data, bool alpha) {
u_int pixsize = alpha ? 4 : 3;
// Open file for writing (binary mode)
FILE* fp = fopen(filename, "wb");
@ -355,5 +355,5 @@ Texture* png::load_texture(std::string filename) {
}
void png::write_image(std::string filename, const ImageData* image) {
_png_write(filename.c_str(), image->getWidth(), image->getHeight(), (const ubyte*)image->getData(), image->getFormat() == ImageFormat::rgba8888);
_png_write(filename.c_str(), image->getWidth(), image->getHeight(), (const u_char8*)image->getData(), image->getFormat() == ImageFormat::rgba8888);
}