New textures
This commit is contained in:
@ -17,7 +17,11 @@ std::map<std::string, std::string> TextureTool::getOptionalFlags() {
|
||||
{ "wrapY", "clamp" },
|
||||
{ "filterMin", "linear" },
|
||||
{ "filterMax", "linear" },
|
||||
{ "scale", "" }
|
||||
{ "scale", "" },
|
||||
{ "scaleWrapX", "clamp" },
|
||||
{ "scaleWrapY", "clamp" },
|
||||
{ "scaleFilterX", "nearest" },
|
||||
{ "scaleFilterY", "nearest" }
|
||||
};
|
||||
}
|
||||
|
||||
@ -45,11 +49,22 @@ int32_t TextureTool::start() {
|
||||
size_t len = STBI_rgb_alpha * w * h;
|
||||
uint8_t *dataImage = (uint8_t*)malloc(sizeof(uint8_t) * len);
|
||||
|
||||
float_t scale = 1;
|
||||
if(!flags["scale"].empty()) {
|
||||
float_t scale = std::stof(flags["scale"]);
|
||||
stbir_resize_uint8(imageRaw, w, h, 0, dataImage, w * scale, h * scale, 0, STBI_rgb_alpha);
|
||||
scale = std::stof(flags["scale"]);
|
||||
}
|
||||
|
||||
if(scale != 1) {
|
||||
stbir_resize_uint8_generic(
|
||||
imageRaw, w, h, 0,
|
||||
dataImage, w * scale, h * scale, 0,
|
||||
STBI_rgb_alpha, -1, 0,
|
||||
STBIR_EDGE_CLAMP, STBIR_FILTER_TRIANGLE, STBIR_COLORSPACE_LINEAR,
|
||||
NULL
|
||||
);
|
||||
w = w * scale;
|
||||
h = h * scale;
|
||||
printf("Changing size to %ix%i\n", w, h);
|
||||
} else {
|
||||
memcpy(dataImage, imageRaw, len);
|
||||
}
|
||||
|
Reference in New Issue
Block a user