Skip to content

Instantly share code, notes, and snippets.

@mackthehobbit
Last active August 29, 2015 14:26
Show Gist options
  • Save mackthehobbit/2251c037043031c9bdd3 to your computer and use it in GitHub Desktop.
Save mackthehobbit/2251c037043031c9bdd3 to your computer and use it in GitHub Desktop.
#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 texture;
int size;
char *someArray;
int arraySize;
// 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->size = 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?
arraySize = size * size * 1024;
// arraySize *bytes* are allocated
someArray = new char[arraySize];
// and cleared
memset(array, 0, arraySize);
}
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