import org.spout.vanilla.world.lighting.VanillaLighting;
public class LightBufferEffect implements BufferEffect {
@Override
public void post(ChunkSnapshotModel chunkModel, BufferContainer container) {
TFloatArrayList vertexBuffer = (TFloatArrayList) container.getBuffers().get(0);
/*
* Use a shader light (2) and skylight (4)
*
* WE NEED TO USE 2 BECAUSE WE DON'T USE COLOR
* OPENGL 2 NEED TO USE LAYOUT IN THE ORDER
* WE CAN'T USE 3 IF 2 ISN'T USED
*
* One float per vertice
* file://Vanilla/shaders/terrain.120.vert
* file://Vanilla/shaders/terrain.330.vert
*/
TFloatArrayList lightBuffer = (TFloatArrayList) container.getBuffers().get(1);
TFloatArrayList skylightBuffer = (TFloatArrayList) container.getBuffers().get(4);
if (lightBuffer == null) {
lightBuffer = new TFloatArrayList(vertexBuffer.size() / 4);
container.setBuffers(1, lightBuffer);
}
if (skylightBuffer == null) {
skylightBuffer = new TFloatArrayList(vertexBuffer.size() / 4);
container.setBuffers(4, skylightBuffer);
}
for (int i = 0; i < vertexBuffer.size(); ) {
float x = vertexBuffer.get(i++);