mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-12 14:01:59 -04:00

The block doesn't need to be known for rendering, all the info is in the texture now. This is another step towards arbitrary models #134
26 lines
550 B
GLSL
26 lines
550 B
GLSL
#version 430
|
|
|
|
layout (local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
struct AnimationData {
|
|
uint frames;
|
|
uint time;
|
|
};
|
|
|
|
layout(std430, binding = 0) buffer _animation
|
|
{
|
|
AnimationData animation[];
|
|
};
|
|
layout(std430, binding = 1) buffer _animatedTexture
|
|
{
|
|
float animatedTexture[];
|
|
};
|
|
|
|
uniform uint time;
|
|
uniform uint size;
|
|
|
|
void main() {
|
|
uint textureIndex = gl_GlobalInvocationID.x;
|
|
if(textureIndex >= size) return;
|
|
animatedTexture[textureIndex] = textureIndex + time / animation[textureIndex].time % animation[textureIndex].frames;
|
|
} |