Package com.rvandoosselaer.blocks
Class FacesMeshGenerator
java.lang.Object
com.rvandoosselaer.blocks.FacesMeshGenerator
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate the node and the collision mesh for the chunk.com.jme3.scene.MeshcreateCollisionMesh(Chunk chunk) Create the collision mesh for the chunk.com.jme3.scene.NodecreateNode(Chunk chunk) Create the node for the chunk.
-
Constructor Details
-
FacesMeshGenerator
public FacesMeshGenerator()
-
-
Method Details
-
createNode
Description copied from interface:ChunkMeshGeneratorCreate the node for the chunk.- Specified by:
createNodein interfaceChunkMeshGenerator- Parameters:
chunk- to create the node for- Returns:
- the node holding all chunk geometries
-
createCollisionMesh
Description copied from interface:ChunkMeshGeneratorCreate the collision mesh for the chunk.- Specified by:
createCollisionMeshin interfaceChunkMeshGenerator- Parameters:
chunk- to create the collision mesh for- Returns:
- the collision mesh of the chunk
-
createAndSetNodeAndCollisionMesh
Description copied from interface:ChunkMeshGeneratorCreate 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:
createAndSetNodeAndCollisionMeshin interfaceChunkMeshGenerator
-