aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/lodmod/renderer/Mesh.java
blob: 3f8b0fe7e100d42991d1553b6f5a1d076e2cd657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package makamys.lodmod.renderer;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;

import makamys.lodmod.util.Util;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTBase;

public abstract class Mesh {
	
	public ByteBuffer buffer;
	public int quadCount;
	public boolean visible;
	public boolean pendingGPUDelete;
	public int iFirst = -1, iCount = -1;
	public int offset = -1;
	public int pass;
	int x, y, z;
	
	public abstract int getStride();
	public void onVisibilityChanged() {}
	
	public double distSq(double x2, double y2, double z2) {
	    return Util.distSq(x, y, z, x2, y2, z2);
	}
	
	public int bufferSize() {
	    int bufferSize = quadCount * 6 * getStride();
	    if(buffer != null) {
	        assert buffer.limit() == bufferSize;
	    }
	    return bufferSize;
	}
}