Package com.rvandoosselaer.blocks
Class FacesMeshGenerator
- java.lang.Object
-
- com.rvandoosselaer.blocks.FacesMeshGenerator
-
- All Implemented Interfaces:
ChunkMeshGenerator
public class FacesMeshGenerator extends java.lang.Object implements ChunkMeshGenerator
A chunk mesh generator that creates and combines a quad mesh for each of the visible faces of a block of the same type. In short, the chunk is traversed and all faces that are not visible will not be added to the final mesh. Some extra bookkeeping is done to scan through the neighbours of each block. One geometry is created per type of the block in the chunk. The geometry is attached to the node, and the node is positioned based on the location of the chunk.
-
-
Constructor Summary
Constructors Constructor Description FacesMeshGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createAndSetNodeAndCollisionMesh(Chunk chunk)
Create the node and the collision mesh for the chunk.com.jme3.scene.Mesh
createCollisionMesh(Chunk chunk)
Create the collision mesh for the chunk.com.jme3.scene.Node
createNode(Chunk chunk)
Create the node for the chunk.
-
-
-
Method Detail
-
createNode
public com.jme3.scene.Node createNode(Chunk chunk)
Description copied from interface:ChunkMeshGenerator
Create the node for the chunk.- Specified by:
createNode
in interfaceChunkMeshGenerator
- Parameters:
chunk
- to create the node for- Returns:
- the node holding all chunk geometries
-
createCollisionMesh
public com.jme3.scene.Mesh createCollisionMesh(Chunk chunk)
Description copied from interface:ChunkMeshGenerator
Create the collision mesh for the chunk.- Specified by:
createCollisionMesh
in interfaceChunkMeshGenerator
- Parameters:
chunk
- to create the collision mesh for- Returns:
- the collision mesh of the chunk
-
createAndSetNodeAndCollisionMesh
public void createAndSetNodeAndCollisionMesh(Chunk chunk)
Description copied from interface:ChunkMeshGenerator
Create the node and the collision mesh for the chunk. The node and collision mesh should be set on the chunk. This is a combination of theChunkMeshGenerator.createNode(Chunk)
andChunkMeshGenerator.createCollisionMesh(Chunk)
methods.- Specified by:
createAndSetNodeAndCollisionMesh
in interfaceChunkMeshGenerator
-
-