载入中...
搜索中...
未找到
eve::grid 命名空间参考

struct  GridConfig
 

枚举

enum class  GridLayout {
  Rectangle , Hexagon , Isometric , Staggered ,
  IsometricZAsY
}
 
enum class  StaggerAxis { X , Y }
 
enum class  StaggerIndex { Odd , Even }
 
enum class  GridPlane { XY , XZ }
 

函数

float cellPitchX (const GridConfig &cfg)
 
float cellPitchY (const GridConfig &cfg)
 
void cellToWorld (const GridConfig &cfg, int cx, int cy, float &px, float &py)
 
float cellToDepthY (const GridConfig &cfg, int cx, int cy)
 
void worldToCell (const GridConfig &cfg, float px, float py, int &cx, int &cy, int mapW, int mapH)
 
void foreachRotatedFootprint (int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, const std::function< void(int lx, int ly)> &fn)
 
void rotatedFootprintSize (int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, int &outW, int &outH)
 

枚举类型说明

◆ GridLayout

enum class eve::grid::GridLayout
strong
枚举值
Rectangle 
Hexagon 
Isometric 
Staggered 
IsometricZAsY 

在文件 GridConfig.h11 行定义.

◆ GridPlane

enum class eve::grid::GridPlane
strong

放置平面轴: XY —— 网格第二轴映射到世界 Y(2D tilemap / 俯视 2D 场景,默认)。 XZ —— 网格第二轴映射到世界 Z,世界 Y 为垂直高度(3D 场景地面网格)。

枚举值
XY 
XZ 

在文件 GridConfig.h20 行定义.

◆ StaggerAxis

enum class eve::grid::StaggerAxis
strong
枚举值

在文件 GridConfig.h12 行定义.

◆ StaggerIndex

enum class eve::grid::StaggerIndex
strong
枚举值
Odd 
Even 

在文件 GridConfig.h13 行定义.

函数说明

◆ cellPitchX()

float eve::grid::cellPitchX ( const GridConfig cfg)
inline

单元有效间距(含 gap)。

在文件 GridConfig.h43 行定义.

引用了 eve::grid::GridConfig::cellGapX , 以及 eve::grid::GridConfig::cellW.

被这些函数引用 cellToWorld() , 以及 worldToCell().

◆ cellPitchY()

float eve::grid::cellPitchY ( const GridConfig cfg)
inline

在文件 GridConfig.h44 行定义.

引用了 eve::grid::GridConfig::cellGapY , 以及 eve::grid::GridConfig::cellH.

被这些函数引用 cellToWorld() , 以及 worldToCell().

◆ cellToDepthY()

float eve::grid::cellToDepthY ( const GridConfig cfg,
int  cx,
int  cy 
)

2D 排序键(格脚点 Y,与 map::tileToDepthY 语义一致);XZ 平面不使用。

在文件 GridProjection.cpp63 行定义.

引用了 eve::grid::GridConfig::cellH, cellToWorld(), cx, cy , 以及 px.

被这些函数引用 eve::map::tileToDepthY().

◆ cellToWorld()

◆ foreachRotatedFootprint()

void eve::grid::foreachRotatedFootprint ( int  w,
int  h,
const std::vector< uint8_t > &  mask,
int  steps,
bool  hexMode,
const std::function< void(int lx, int ly)> &  fn 
)

旋转后的占地局部格枚举。mask 为行主序 w*h(空 = 实心矩形)。 steps:cardinal 为 90° 步数(0..3);hexMode 为 60° 步数(0..5)。 回调收到归一化局部坐标(旋转后包围盒最小角归零,原点格为锚点)。

在文件 GridProjection.cpp121 行定义.

引用了 c, fn, h, idx, s, w, x, y , 以及 z.

被这些函数引用 eve::building::PlacementSystem::foreachFootprintCell() , 以及 rotatedFootprintSize().

◆ rotatedFootprintSize()

void eve::grid::rotatedFootprintSize ( int  w,
int  h,
const std::vector< uint8_t > &  mask,
int  steps,
bool  hexMode,
int &  outW,
int &  outH 
)

旋转后的占地包围盒尺寸。

在文件 GridProjection.cpp187 行定义.

引用了 foreachRotatedFootprint(), h , 以及 w.

被这些函数引用 eve::building::PlacementSystem::effectiveFootprint().

◆ worldToCell()

void eve::grid::worldToCell ( const GridConfig cfg,
float  px,
float  py,
int &  cx,
int &  cy,
int  mapW = 1,
int  mapH = 1 
)