Interface Shape

All Known Implementing Classes:
Cube, Cylinder, Pole, Pyramid, RoundedCube, Slab, Square, SquareCuboid, Stairs, StairsInnerCorner, StairsOuterCorner, Wedge

public interface Shape
The interface describing the shape of a Block element. The add(Vec3i, Chunk, ChunkMesh) method is called for each block in the chunk when the mesh is constructed using the ChunkMeshGenerator.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final Direction[]
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
    static final com.jme3.math.Quaternion
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(com.simsilica.mathd.Vec3i location, Chunk chunk, ChunkMesh chunkMesh)
    Adds the shape at the location in the chunk to the chunk mesh.
    static com.jme3.math.Vector3f
    createVertex(com.jme3.math.Vector3f vertex, com.simsilica.mathd.Vec3i blockLocation, float blockScale)
    A helper method that offsets a vertex based on the location of the block in the chunk and the block scale.
    static Direction
    getFaceDirection(Direction faceDirection, Direction shapeDirection)
    Calculates the new direction of a face, based on the rotation of the shape.
    static com.jme3.math.Quaternion
    A helper method to calculate the rotation of the shape from the given direction.
    static Direction
    getYawFaceDirection(Direction faceDirection, Direction shapeDirection)
    Calculates the new yaw direction (rotation around the y-axis) of a face, based on the yaw rotation of the shape.
    static com.jme3.math.Quaternion
    A helper method to calculate the yaw rotation (rotation around the y-axis) of the shape for the given direction.
  • Field Details

    • ROTATION_DOWN

      static final com.jme3.math.Quaternion ROTATION_DOWN
    • ROTATION_EAST

      static final com.jme3.math.Quaternion ROTATION_EAST
    • ROTATION_WEST

      static final com.jme3.math.Quaternion ROTATION_WEST
    • ROTATION_NORTH

      static final com.jme3.math.Quaternion ROTATION_NORTH
    • ROTATION_SOUTH

      static final com.jme3.math.Quaternion ROTATION_SOUTH
    • ROTATION_UP

      static final com.jme3.math.Quaternion ROTATION_UP
    • YAW_NORTH

      static final com.jme3.math.Quaternion YAW_NORTH
    • YAW_EAST

      static final com.jme3.math.Quaternion YAW_EAST
    • YAW_WEST

      static final com.jme3.math.Quaternion YAW_WEST
    • YAW_UP

      static final com.jme3.math.Quaternion YAW_UP
    • DIRECTIONS_SIZE

      static final int DIRECTIONS_SIZE
    • FACES_DIR

      static final Direction[] FACES_DIR
  • Method Details

    • add

      void add(com.simsilica.mathd.Vec3i location, Chunk chunk, ChunkMesh chunkMesh)
      Adds the shape at the location in the chunk to the chunk mesh.
      Parameters:
      location - of the shape in the chunk
      chunk - of the shape
      chunkMesh - to add the shape to
    • createVertex

      static com.jme3.math.Vector3f createVertex(com.jme3.math.Vector3f vertex, com.simsilica.mathd.Vec3i blockLocation, float blockScale)
      A helper method that offsets a vertex based on the location of the block in the chunk and the block scale.
      Parameters:
      vertex -
      blockLocation -
      blockScale -
      Returns:
      the same vertex with an offset
    • getRotationFromDirection

      static com.jme3.math.Quaternion getRotationFromDirection(Direction direction)
      A helper method to calculate the rotation of the shape from the given direction. Depending on the direction, the rotation is done around a different axis. This has the effect of 'pushing' a shape over to the direction. This should be used for shapes that don't have a fixed upward position. The default direction is UP. All rotation calculations are relative to the UP direction.
      Parameters:
      direction - the shape is facing
      Returns:
      the rotation to face the direction
    • getYawFromDirection

      static com.jme3.math.Quaternion getYawFromDirection(Direction direction)
      A helper method to calculate the yaw rotation (rotation around the y-axis) of the shape for the given direction. This should be used for shapes that have a fixed upwards position. The default direction is SOUTH. All rotation calculations are relative to the SOUTH direction.
      Parameters:
      direction - the shape is facing
      Returns:
      the rotation to face the direction
    • getFaceDirection

      static Direction getFaceDirection(Direction faceDirection, Direction shapeDirection)
      Calculates the new direction of a face, based on the rotation of the shape. eg. The north face of a shape that is rotated, is not facing north anymore.
      Parameters:
      faceDirection - the original direction of the face
      shapeDirection - the direction of the shape
      Returns:
      the new direction of the face based on the direction of the shape
    • getYawFaceDirection

      static Direction getYawFaceDirection(Direction faceDirection, Direction shapeDirection)
      Calculates the new yaw direction (rotation around the y-axis) of a face, based on the yaw rotation of the shape. This should be used for shapes that have a fixed upwards position.
      Parameters:
      faceDirection - the original direction of the face
      shapeDirection - the direction of the shape
      Returns:
      the new direction of the face based on the direction of the shape