载入中...
搜索中...
未找到
eve::hd2d::TileMap3D类 参考

Extrudes a 2D tile layer into a 3D terrain mesh (HD-2D ground). 更多...

#include <Hd2d.h>

Public 成员函数

 TileMap3D ()=default
 Tile map 3 d.
 
 TileMap3D (const TileMap3D &)=delete
 
TileMap3D & operator= (const TileMap3D &)=delete
 
void setSideDepth (float depth)
 Downward side-wall depth in world units (default 6).
 
float getSideDepth () const
 Returns the side depth.
 
void setHeightScale (float scale)
 World units per unit of tile "height" metadata (default 1).
 
float getHeightScale () const
 Returns the height scale.
 
void setWallUV (float u0, float v0, float u1, float v1)
 UV sub-rectangle of the atlas used for extruded side walls.
 
void setTint (float r, float g, float b, float a=1.f)
 Tint multiplier applied to the whole terrain.
 
graphics::Mesh * buildMesh (graphics::Graphics *gfx, map::TileLayer *layer)
 Build and upload the terrain mesh from a tile layer.
 
graphics::Renderable3D * buildRenderable (graphics::Graphics *gfx, map::TileLayer *layer)
 Build a scene-ready Renderable3D carrying the extruded terrain. The returned entity is already registered in the ECS and will draw once a Camera3D is active; caller sets its position/rotation/scale.
 
int getTileCount () const
 Number of box tiles baked by the last build.
 

详细描述

Extrudes a 2D tile layer into a 3D terrain mesh (HD-2D ground).

Coordinates map the layer's tileToWorld() top-left origin onto world X/Z; the footprint extends by tileW × tileH in positive X/Z. The top face of every non-empty tile is textured with the tile's atlas region from the layer's tileset; the side walls sample a configurable wall region of the same atlas (default: a small region at the atlas origin). Per-tile elevation is read from the tile's "height" custom data (0 when absent); each tile spans from elevation down to elevation - sideDepth. Zero depth emits only the top face. Tiled diagonal/horizontal/vertical flags transform the top UVs.

在文件 Hd2d.h 第 58 行定义.

构造及析构函数说明

◆ TileMap3D() [1/2]

eve::hd2d::TileMap3D::TileMap3D ( )
default

Tile map 3 d.

◆ TileMap3D() [2/2]

eve::hd2d::TileMap3D::TileMap3D ( const TileMap3D &  )
delete

成员函数说明

◆ buildMesh()

graphics::Mesh * eve::hd2d::TileMap3D::buildMesh ( graphics::Graphics *  gfx,
map::TileLayer *  layer 
)

Build and upload the terrain mesh from a tile layer.

参数
gfxActive Graphics (owns the returned mesh).
layerNon-null TileLayer; its tileset must be bound.
返回
Uploaded mesh (owner = gfx). Empty tiles produce a null mesh.

在文件 TileMap3D.cpp 第 81 行定义.

引用了 cx, f, idx, layer, n, eve::graphics::Graphics::newMeshFromArrays(), p, pos, s, t, eve::map::tileGid(), tileH, tileW, top, u, uv, v, wx , 以及 wz.

被这些函数引用 buildRenderable().

◆ buildRenderable()

graphics::Renderable3D * eve::hd2d::TileMap3D::buildRenderable ( graphics::Graphics *  gfx,
map::TileLayer *  layer 
)

Build a scene-ready Renderable3D carrying the extruded terrain. The returned entity is already registered in the ECS and will draw once a Camera3D is active; caller sets its position/rotation/scale.

在文件 TileMap3D.cpp 第 183 行定义.

引用了 buildMesh(), layer , 以及 mesh.

◆ getHeightScale()

float eve::hd2d::TileMap3D::getHeightScale ( ) const

Returns the height scale.

在文件 TileMap3D.cpp 第 67 行定义.

◆ getSideDepth()

float eve::hd2d::TileMap3D::getSideDepth ( ) const

Returns the side depth.

在文件 TileMap3D.cpp 第 62 行定义.

◆ getTileCount()

int eve::hd2d::TileMap3D::getTileCount ( ) const
inline

Number of box tiles baked by the last build.

在文件 Hd2d.h 第 94 行定义.

◆ operator=()

TileMap3D & eve::hd2d::TileMap3D::operator= ( const TileMap3D &  )
delete

◆ setHeightScale()

void eve::hd2d::TileMap3D::setHeightScale ( float  scale)

World units per unit of tile "height" metadata (default 1).

在文件 TileMap3D.cpp 第 63 行定义.

引用了 scale.

◆ setSideDepth()

void eve::hd2d::TileMap3D::setSideDepth ( float  depth)

Downward side-wall depth in world units (default 6).

在文件 TileMap3D.cpp 第 58 行定义.

引用了 depth.

◆ setTint()

void eve::hd2d::TileMap3D::setTint ( float  r,
float  g,
float  b,
float  a = 1.f 
)

Tint multiplier applied to the whole terrain.

在文件 TileMap3D.cpp 第 74 行定义.

引用了 a, b, g , 以及 r.

◆ setWallUV()

void eve::hd2d::TileMap3D::setWallUV ( float  u0,
float  v0,
float  u1,
float  v1 
)

UV sub-rectangle of the atlas used for extruded side walls.

在文件 TileMap3D.cpp 第 68 行定义.


该类的文档由以下文件生成: