In my voxel engine (XNA 4.0) I'm use a vertex buffer for the entire chunk and update it after the set block, changing block metadata or light level. This is not too frequent operation compared with the time of mesh rebuild. But now I want animate some blocks, for example, make door opening or lever switching smooth.
If I remember right, in Minecraft all draw on the fly using OpenGL (correct if wrong), but in my case this is not an option.
I'm know what is a bone animation and how it works, and I think that I can make something like this for animatable block X:
- rebuild chunk mesh without animated part of block X;
- create entity looking like removed animated part and animate it;
- remove entity and rebuild chunk mesh with that part in another static position.
I'm not shure this is a correct way. Any better ideas?
Also, how to make a block with animated textures? Do I need to use for this purpose a separate shader or I can somehow a correct texture coordinates of vertices in existed meshe?