Intermediate 2D generation result. cells store semantic ids (see Semantic.h), not tile GIDs — convert via Palette when applying to a TileLayer.
更多...
#include <Grid2D.h>
Public 成员函数 | |
| void | resize (int width, int height) |
| Resize. | |
| int | getWidth () const |
| Returns the width. | |
| int | getHeight () const |
| Returns the height. | |
| void | setCell (int x, int y, int semantic) |
| Sets the cell. | |
| int | getCell (int x, int y) const |
| Returns the cell. | |
| void | fill (int semantic) |
| Fill. | |
| void | setDetail (int x, int y, int value) |
Per-cell detail layer (0..255), parallel to cells. Semantics stay in cells (palette/GID compatible); detail carries algorithm-specific extras such as wall-autotile direction masks, floor-pattern variants and decor tile indices. Semantics that have no detail use 0. | |
| int | getDetail (int x, int y) const |
| Returns the detail. | |
| void | setMeta (const std::string &key, const std::string &value) |
| Sets the meta. | |
| std::string | getMeta (const std::string &key, const std::string &defaultValue) const |
| Returns the meta. | |
| const std::unordered_map< std::string, std::string > & | metadata () const |
| Return all metadata key/value pairs in deterministic map order. | |
| void | clearObjects () |
| Clears objects. | |
| void | addObjectAt (const std::string &name, const std::string &type, float x, float y) |
| Script-friendly: name/type + tile coords. | |
| void | addObject (const std::string &name, const std::string &type, float x, float y, float width, float height, int gid) |
| Adds object. | |
| void | addAssetObject (const std::string &name, const std::string &role, const std::string &asset, float x, float y, float width, float height, float rotationDegrees, int flags) |
| Add a placed asset while preserving its semantic role, asset id and orientation. | |
| int | getObjectCount () const |
| Returns the object count. | |
| std::string | getObjectName (int i) const |
| Returns the object name. | |
| std::string | getObjectType (int i) const |
| Returns the object type. | |
| float | getObjectX (int i) const |
| Returns the object x. | |
| float | getObjectY (int i) const |
| Returns the object y. | |
| float | getObjectWidth (int i) const |
| Returns the object width. | |
| float | getObjectHeight (int i) const |
| Returns the object height. | |
| int | getObjectGid (int i) const |
| Returns the object gid. | |
| std::string | getObjectAsset (int i) const |
| Returns the object asset. | |
| float | getObjectRotation (int i) const |
| Returns the object rotation. | |
| int | getObjectFlags (int i) const |
| Returns the object flags. | |
| const std::vector< uint32_t > & | cells () const |
| Cells. | |
| std::vector< uint32_t > & | cells () |
| Cells. | |
| const std::vector< uint8_t > & | detail () const |
| Detail. | |
| std::vector< uint8_t > & | detail () |
| Detail. | |
| const std::vector< GridObject > & | objects () const |
| Objects. | |
详细描述
Intermediate 2D generation result. cells store semantic ids (see Semantic.h), not tile GIDs — convert via Palette when applying to a TileLayer.
成员函数说明
◆ addAssetObject()
| void eve::procgen::Grid2D::addAssetObject | ( | const std::string & | name, |
| const std::string & | role, | ||
| const std::string & | asset, | ||
| float | x, | ||
| float | y, | ||
| float | width, | ||
| float | height, | ||
| float | rotationDegrees, | ||
| int | flags | ||
| ) |
Add a placed asset while preserving its semantic role, asset id and orientation.
在文件 Grid2D.cpp 第 75 行定义.
引用了 addObject(), height, name, rotationDegrees, width, x , 以及 y.
◆ addObject()
| void eve::procgen::Grid2D::addObject | ( | const std::string & | name, |
| const std::string & | type, | ||
| float | x, | ||
| float | y, | ||
| float | width, | ||
| float | height, | ||
| int | gid | ||
| ) |
Adds object.
在文件 Grid2D.cpp 第 62 行定义.
引用了 eve::procgen::GridObject::gid, height, eve::procgen::GridObject::height, name, eve::procgen::GridObject::name, type, eve::procgen::GridObject::type, width, eve::procgen::GridObject::width, x, eve::procgen::GridObject::x, y , 以及 eve::procgen::GridObject::y.
被这些函数引用 addAssetObject() , 以及 addObjectAt().
◆ addObjectAt()
| void eve::procgen::Grid2D::addObjectAt | ( | const std::string & | name, |
| const std::string & | type, | ||
| float | x, | ||
| float | y | ||
| ) |
Script-friendly: name/type + tile coords.
在文件 Grid2D.cpp 第 58 行定义.
引用了 addObject(), name, type, x , 以及 y.
◆ cells() [1/2]
◆ cells() [2/2]
|
inline |
◆ clearObjects()
| void eve::procgen::Grid2D::clearObjects | ( | ) |
◆ detail() [1/2]
◆ detail() [2/2]
|
inline |
◆ fill()
| void eve::procgen::Grid2D::fill | ( | int | semantic | ) |
Fill.
在文件 Grid2D.cpp 第 33 行定义.
引用了 semantic.
被这些函数引用 eve::procgen::urban::generateUrbanGrid() , 以及 eve::housegen::HouseLayout::writeFootprintGrid().
◆ getCell()
| int eve::procgen::Grid2D::getCell | ( | int | x, |
| int | y | ||
| ) | const |
◆ getDetail()
| int eve::procgen::Grid2D::getDetail | ( | int | x, |
| int | y | ||
| ) | const |
Returns the detail.
在文件 Grid2D.cpp 第 42 行定义.
◆ getHeight()
| int eve::procgen::Grid2D::getHeight | ( | ) | const |
Returns the height.
在文件 Grid2D.cpp 第 21 行定义.
被这些函数引用 eve::procgen::gridgraph::findPath() , 以及 eve::procgen::generateRoadNetworkArtifact().
◆ getMeta()
| std::string eve::procgen::Grid2D::getMeta | ( | const std::string & | key, |
| const std::string & | defaultValue | ||
| ) | const |
◆ getObjectAsset()
| std::string eve::procgen::Grid2D::getObjectAsset | ( | int | i | ) | const |
Returns the object asset.
在文件 Grid2D.cpp 第 114 行定义.
◆ getObjectCount()
| int eve::procgen::Grid2D::getObjectCount | ( | ) | const |
Returns the object count.
在文件 Grid2D.cpp 第 84 行定义.
◆ getObjectFlags()
| int eve::procgen::Grid2D::getObjectFlags | ( | int | i | ) | const |
Returns the object flags.
在文件 Grid2D.cpp 第 122 行定义.
◆ getObjectGid()
| int eve::procgen::Grid2D::getObjectGid | ( | int | i | ) | const |
Returns the object gid.
在文件 Grid2D.cpp 第 110 行定义.
◆ getObjectHeight()
| float eve::procgen::Grid2D::getObjectHeight | ( | int | i | ) | const |
Returns the object height.
在文件 Grid2D.cpp 第 106 行定义.
◆ getObjectName()
| std::string eve::procgen::Grid2D::getObjectName | ( | int | i | ) | const |
Returns the object name.
在文件 Grid2D.cpp 第 86 行定义.
◆ getObjectRotation()
| float eve::procgen::Grid2D::getObjectRotation | ( | int | i | ) | const |
Returns the object rotation.
在文件 Grid2D.cpp 第 118 行定义.
◆ getObjectType()
| std::string eve::procgen::Grid2D::getObjectType | ( | int | i | ) | const |
Returns the object type.
在文件 Grid2D.cpp 第 90 行定义.
◆ getObjectWidth()
| float eve::procgen::Grid2D::getObjectWidth | ( | int | i | ) | const |
Returns the object width.
在文件 Grid2D.cpp 第 102 行定义.
◆ getObjectX()
| float eve::procgen::Grid2D::getObjectX | ( | int | i | ) | const |
Returns the object x.
在文件 Grid2D.cpp 第 94 行定义.
◆ getObjectY()
| float eve::procgen::Grid2D::getObjectY | ( | int | i | ) | const |
Returns the object y.
在文件 Grid2D.cpp 第 98 行定义.
◆ getWidth()
| int eve::procgen::Grid2D::getWidth | ( | ) | const |
Returns the width.
在文件 Grid2D.cpp 第 20 行定义.
被这些函数引用 eve::procgen::gridgraph::findPath() , 以及 eve::procgen::generateRoadNetworkArtifact().
◆ metadata()
|
inline |
◆ objects()
|
inline |
◆ resize()
| void eve::procgen::Grid2D::resize | ( | int | width, |
| int | height | ||
| ) |
◆ setCell()
| void eve::procgen::Grid2D::setCell | ( | int | x, |
| int | y, | ||
| int | semantic | ||
| ) |
◆ setDetail()
| void eve::procgen::Grid2D::setDetail | ( | int | x, |
| int | y, | ||
| int | value | ||
| ) |
Per-cell detail layer (0..255), parallel to cells. Semantics stay in cells (palette/GID compatible); detail carries algorithm-specific extras such as wall-autotile direction masks, floor-pattern variants and decor tile indices. Semantics that have no detail use 0.
在文件 Grid2D.cpp 第 37 行定义.
被这些函数引用 eve::procgen::urban::generateUrbanGrid() , 以及 eve::housegen::HouseLayout::writeFootprintGrid().
◆ setMeta()
| void eve::procgen::Grid2D::setMeta | ( | const std::string & | key, |
| const std::string & | value | ||
| ) |
Sets the meta.
在文件 Grid2D.cpp 第 47 行定义.
被这些函数引用 eve::procgen::urban::generateUrbanGrid() , 以及 eve::housegen::HouseLayout::writeFootprintGrid().
该类的文档由以下文件生成:
- src/modules/procgen/Grid2D.h
- src/modules/procgen/Grid2D.cpp