Search in sources :

Example 26 with Voxel

use of io.xol.chunkstories.api.voxel.Voxel in project chunkstories-core by Hugobros3.

the class VoxelStoneWall method getVoxelRenderer.

@Override
public VoxelModel getVoxelRenderer(CellData info) {
    Voxel vox;
    vox = info.getNeightborVoxel(0);
    boolean connectLeft = (vox.getDefinition().isSolid() && vox.getDefinition().isOpaque()) || vox.equals(this);
    vox = info.getNeightborVoxel(1);
    boolean connectFront = (vox.getDefinition().isSolid() && vox.getDefinition().isOpaque()) || vox.equals(this);
    vox = info.getNeightborVoxel(2);
    boolean connectRight = (vox.getDefinition().isSolid() && vox.getDefinition().isOpaque()) || vox.equals(this);
    vox = info.getNeightborVoxel(3);
    boolean connectBack = (vox.getDefinition().isSolid() && vox.getDefinition().isOpaque()) || vox.equals(this);
    String type = "default";
    if (connectLeft && connectFront && connectRight && connectBack)
        type = "allDir";
    else if (connectLeft && connectFront && connectRight)
        type = "allButBack";
    else if (connectLeft && connectFront && connectBack)
        type = "allButRight";
    else if (connectLeft && connectBack && connectRight)
        type = "allButFront";
    else if (connectBack && connectFront && connectRight)
        type = "allButLeft";
    else if (connectLeft && connectRight)
        type = "allX";
    else if (connectFront && connectBack)
        type = "allZ";
    else if (connectLeft && connectBack)
        type = "leftBack";
    else if (connectRight && connectBack)
        type = "rightBack";
    else if (connectLeft && connectFront)
        type = "leftFront";
    else if (connectRight && connectFront)
        type = "rightFront";
    else if (connectLeft)
        type = "left";
    else if (connectRight)
        type = "right";
    else if (connectFront)
        type = "front";
    else if (connectBack)
        type = "back";
    return store.models().getVoxelModel("stone_wall" + "." + type);
}
Also used : Voxel(io.xol.chunkstories.api.voxel.Voxel)

Aggregations

Voxel (io.xol.chunkstories.api.voxel.Voxel)26 ItemVoxel (io.xol.chunkstories.api.item.ItemVoxel)6 WorldMaster (io.xol.chunkstories.api.world.WorldMaster)5 Entity (io.xol.chunkstories.api.entity.Entity)4 CollisionBox (io.xol.chunkstories.api.physics.CollisionBox)4 CellData (io.xol.chunkstories.api.world.cell.CellData)4 Texture2D (io.xol.chunkstories.api.rendering.textures.Texture2D)3 World (io.xol.chunkstories.api.world.World)3 WorldClient (io.xol.chunkstories.api.world.WorldClient)3 Vector3d (org.joml.Vector3d)3 Vector3dc (org.joml.Vector3dc)3 Location (io.xol.chunkstories.api.Location)2 WorldException (io.xol.chunkstories.api.exceptions.world.WorldException)2 Shader (io.xol.chunkstories.api.rendering.shader.Shader)2 VoxelBakerCubic (io.xol.chunkstories.api.rendering.voxel.VoxelBakerCubic)2 VoxelBakerHighPoly (io.xol.chunkstories.api.rendering.voxel.VoxelBakerHighPoly)2 ChunkRenderable (io.xol.chunkstories.api.rendering.world.chunk.ChunkRenderable)2 DummyCell (io.xol.chunkstories.api.world.cell.DummyCell)2 Chunk (io.xol.chunkstories.api.world.chunk.Chunk)2 Vector3f (org.joml.Vector3f)2