Arrays and array fixes also part of atlas code
parent
6849bea21a
commit
30826695f2
|
@ -1,13 +1,11 @@
|
|||
package com.github.halotroop.litecraft.types.block;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.github.halotroop.litecraft.types.block.Block.Properties;
|
||||
|
||||
public final class Blocks
|
||||
{
|
||||
|
||||
public static List<Block> blocks = new ArrayList<Block>();
|
||||
public static Block[] blocks = new Block[255];//real number is 256 //TODO: get all mods to say how many blocks they have and increace the number by that
|
||||
|
||||
public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false));
|
||||
public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.04f));
|
||||
|
|
|
@ -108,6 +108,20 @@ public class Loader
|
|||
|
||||
public int createBlockAtlas()
|
||||
{
|
||||
int width = 16;
|
||||
int height = 16;
|
||||
//Prepare the atlas texture and gen it
|
||||
int atlasId = GL11.glGenTextures();
|
||||
//Bind it to openGL
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, atlasId);
|
||||
//Apply the settings for the texture
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
//Fill the image with blank image data
|
||||
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width*2, height*2, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
|
||||
|
||||
int maxX = Blocks.blocks.length/2;//if the block list gets too big just increace the 2 by 4 or somthing to account for it
|
||||
|
||||
for(Block block: Blocks.blocks) {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue