-
-
Save byteandahalf/07b23aa80c7474775e83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "TextureUVCoordinateSet.h" | |
class TickingTexture { | |
public: | |
// this is the complete struct | |
// void** vtable; | |
// this seems like it determines the area of the atlas to be animated | |
TextureUVCoordinateSet atlasTemplate; | |
int framecount; // number of frames in the animation | |
unsigned char *pixels; // All pixels in the image, 4 uchars for each (RGBA) | |
int pixelCount; | |
// disassembled this constructor for street cred | |
TickingTexture(TextureUVCoordinateSet &texture, int size) { | |
// I'm calling it 'size' for now - it's passed as 1 for WaterTexture and LavaTexture, 2 for WaterSideTexture, and 36 for FireTexture | |
// seems like the number of frames or something similar, but the fire image has 32 frames and not 36. | |
this->framecount = size; | |
// 1024 could be the size in bytes of one 16x16 image, as 16*16*4 (for RGBA) = 1024 | |
// but why is the size parameter squared? | |
pixelCount = size * size * 1024; | |
// arraySize *bytes* are allocated | |
pixels = new char[pixelCount]; | |
// and cleared | |
memset(pixels, 0, pixelCount); | |
} | |
virtual ~TickingTexture(); | |
virtual void tick() = 0; | |
virtual void bindTextures(Textures* textures); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment