image generation
This commit is contained in:
parent
ebfa801560
commit
35deec52ae
|
@ -61,6 +61,7 @@ var sprite = {
|
||||||
this._p = p;
|
this._p = p;
|
||||||
this.del_anim?.();
|
this.del_anim?.();
|
||||||
this.texture = game.texture(p);
|
this.texture = game.texture(p);
|
||||||
|
|
||||||
this.diffuse = this.texture;
|
this.diffuse = this.texture;
|
||||||
this.rect = [0,0,1,1];
|
this.rect = [0,0,1,1];
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,6 @@ double grad (int hash, double x, double y, double z)
|
||||||
void texture_save(texture *tex, const char *file)
|
void texture_save(texture *tex, const char *file)
|
||||||
{
|
{
|
||||||
char *ext = strrchr(file, '.');
|
char *ext = strrchr(file, '.');
|
||||||
printf("SAVING TO %s with ext %s\n", file, ext);
|
|
||||||
if (!strcmp(ext, ".png"))
|
if (!strcmp(ext, ".png"))
|
||||||
stbi_write_png(file, tex->width, tex->height, 4, tex->data, 4*tex->width);
|
stbi_write_png(file, tex->width, tex->height, 4, tex->data, 4*tex->width);
|
||||||
else if (!strcmp(ext, ".bmp"))
|
else if (!strcmp(ext, ".bmp"))
|
||||||
|
|
Loading…
Reference in a new issue