use of org.asassecreations.engine.texture.TextureProperties in project Voxel_Game by ASasseCreations.
the class GameState method init.
public void init() {
MouseSystem.disable();
PlayerSave.load(player);
inventory.load();
final int chunkX = (int) Mathf.floor(player.position.x / Chunk.H_SIZE);
final int chunkZ = (int) Mathf.floor(player.position.z / Chunk.H_SIZE);
final Chunk chunk = new Chunk(chunkX, chunkZ);
Chunk.CHUNKS.add(chunk);
SunRenderer.init();
if (UserSettings.RENDER_HAND)
HandRenderer.init();
if (UserSettings.RENDER_CLOUDS)
CloudRenderer.init();
ChunkRenderer.init();
final TextureProperties properties = new TextureProperties();
properties.af = false;
properties.afLevel = 0;
properties.lodBias = 0f;
properties.magFilter = GL_NEAREST;
properties.maxLevel = -1;
properties.minFilter = GL11.GL_LINEAR_MIPMAP_NEAREST;
properties.mipmaps = true;
properties.sEdge = GL_CLAMP;
properties.tEdge = GL_CLAMP;
GameStateGuis.init(properties);
SUN_TEXTURE = TextureLoader.getTexture("/textures/sun.png", properties);
ChunkGeneratorQueue.start();
ChunkOccludeQueue.start();
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
@SuppressWarnings("unused") final int i2 = HandModel.MODEL.id;
AMBIENT = TextureLoader.getImage("/textures/ambient.png");
Chunk.VIEW_DISTANCE = UserSettings.RENDER_DISTANCE;
Debugger.init();
}
use of org.asassecreations.engine.texture.TextureProperties in project Voxel_Game by ASasseCreations.
the class CloudRenderer method init.
public static final void init() {
properties = new TextureProperties();
properties.af = false;
properties.afLevel = 0;
properties.lodBias = -.3f;
properties.magFilter = GL_NEAREST;
properties.maxLevel = -1;
properties.minFilter = GL_NEAREST_MIPMAP_LINEAR;
properties.mipmaps = true;
properties.sEdge = GL_REPEAT;
properties.tEdge = GL_REPEAT;
shader = new CloudShader();
texture = TextureLoader.getTexture("/textures/clouds.png", properties);
final float[] positions = new float[] { -1, 0, 1, 1, 0, 1, -1, 0, -1, -1, 0, -1, 1, 0, 1, 1, 0, -1 };
final float[] normals = new float[] { 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0 };
final float[] textureCoords = new float[] { 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0 };
ModelLoader.appendData(positions, 3);
ModelLoader.appendData(textureCoords, 2);
ModelLoader.appendData(normals, 3);
model = ModelLoader.loadToVAO(0);
}
use of org.asassecreations.engine.texture.TextureProperties in project Voxel_Game by ASasseCreations.
the class AssetLoader method createAtlas.
public static final AtlasResult createAtlas() throws URISyntaxException, IOException {
int textureSize = 0;
for (final BufferedImage image : RawAtlasTile.MODIFIED_IMAGE.values()) if (image.getHeight() > textureSize)
textureSize = image.getHeight();
final int rows = getTextureAtlasSize();
final int imageSize = rows * textureSize;
final BufferedImage image = new BufferedImage(imageSize, imageSize, BufferedImage.TYPE_INT_ARGB);
{
final int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
for (int i = 0; i < pixels.length; i++) pixels[i] = 0x00000000;
}
final List<String> keys = new ArrayList<>(RawAtlasTile.MODIFIED_IMAGE.keySet());
final List<BufferedImage> images = new ArrayList<>(RawAtlasTile.MODIFIED_IMAGE.values());
final Map<String, BlockTexture> textures = new HashMap<>();
final Graphics g = image.getGraphics();
for (int y = 0; y < rows; y++) for (int x = 0; x < rows; x++) {
if (x + y * rows >= images.size())
continue;
g.drawImage(images.get(x + y * rows), x * textureSize, y * textureSize, textureSize, textureSize, null);
textures.put(keys.get(x + y * rows), new BlockTexture(x, y));
}
g.dispose();
final AtlasResult result = new AtlasResult();
final TextureProperties properties = new TextureProperties();
properties.maxLevel = (int) (Math.log(textureSize) / Math.log(2));
properties.minFilter = GL11.GL_NEAREST_MIPMAP_LINEAR;
properties.magFilter = GL11.GL_NEAREST;
properties.mipmaps = true;
result.image = TextureLoader.getTexture(image, properties);
result.textures = textures;
return result;
}
Aggregations