15 int a_GridX,
int a_GridZ,
16 int a_OriginX,
int a_OriginZ,
20 Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
21 m_Pieces(
std::move(a_Pieces)),
22 m_HeightGen(a_HeightGen)
34 for (cPlacedPieces::iterator itr =
m_Pieces.begin(), end =
m_Pieces.end(); itr != end; ++itr)
36 const cPrefab & Prefab =
static_cast<const cPrefab &
>((*itr)->GetPiece());
41 Prefab.
Draw(a_Chunk, itr->get());
53 int BlockX = FirstConnector.
m_Pos.
x;
54 int BlockZ = FirstConnector.
m_Pos.
z;
std::vector< cPlacedPiecePtr > cPlacedPieces
static void AbsoluteToRelative(int &a_X, int &a_Y, int &a_Z, int &a_ChunkX, int &a_ChunkZ)
Converts absolute block coords into relative (chunk + block) coords:
HEIGHTTYPE HeightMap[Width *Width]
The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the hig...
static HEIGHTTYPE GetHeight(const HeightMap &a_HeightMap, int a_X, int a_Z)
The interface that is used to query terrain height from the shape generator.
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap &a_HeightMap)=0
Retrieves the heightmap for the specified chunk.
Represents a single structure that occupies the grid point.
Vector3i m_Pos
Position relative to the piece.
Represents a single piece that has been placed to specific coords in the world.
void MoveToGroundBy(int a_OffsetY)
Moves the placed piece Y-wise by the specified offset.
cPiece::cConnector GetRotatedConnector(size_t a_Index) const
Returns the connector at the specified index, rotated in the actual placement.
bool ShouldMoveToGround(void) const
Returns whether the prefab should be moved Y-wise to ground before drawing, rather than staying at th...
void Draw(cChunkDesc &a_Dest, const cPlacedPiece *a_Placement) const
Draws the prefab into the specified chunk, according to the placement stored in the PlacedPiece.
void PlacePieceOnGround(cPlacedPiece &a_Piece)
Adjusts the Y coord of the given piece so that the piece is on the ground.
virtual void DrawIntoChunk(cChunkDesc &a_Chunk) override
Draws self into the specified chunk.
cPlacedPieces m_Pieces
The pieces placed by the generator.
cPrefabStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, cPlacedPieces &&a_Pieces, cTerrainHeightGen &a_HeightGen)
cTerrainHeightGen & m_HeightGen
The height generator used when adjusting pieces onto the ground.