Dynamic field-of-view / fog-of-war facade. Phase A: 2D shadowcast + multi-revealer + explored memory. Phase B: raycast/permissive, heightmap, volume, dirty-skip, CPU masks. Phase C: hex topology FOV, rectangle-based FOV, perception/stealth detection helpers, GPU mask Texture upload. 更多...
#include <Fov.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| Fov () | |
| Fov (TileLayer *layer) | |
| Fov (int width, int height) | |
| Fov (int width, int height, int depth) | |
| ~Fov () | |
| Fov (Fov &&) noexcept | |
| Fov & | operator= (Fov &&) noexcept |
| Fov (const Fov &)=delete | |
| Fov & | operator= (const Fov &)=delete |
| void | bindLayer (TileLayer *layer) |
| void | setSize (int width, int height) |
| void | setVolumeSize (int width, int height, int depth) |
| int | getWidth () const |
| int | getHeight () const |
| int | getDepth () const |
| void | setMode (const std::string &name) |
| "grid2d" (default) | "heightmap" | "volume" | |
| std::string | getMode () const |
| void | setAlgorithm (const std::string &name) |
| "shadowcast" | "raycast" | "permissive" | "rectangle" | |
| std::string | getAlgorithm () const |
| void | setRadiusMetric (const std::string &name) |
| "euclidean" | "chebyshev" | "manhattan" — ignored when topology is hex (cube distance). | |
| std::string | getRadiusMetric () const |
| void | setTopology (const std::string &name) |
| "ortho" (default) | "hex" | "auto" (hex if bound layer is hex/staggered). | |
| std::string | getTopology () const |
| void | setCornerPeek (bool enable) |
| bool | getCornerPeek () const |
| void | blockOpaqueGid (int gid) |
| void | unblockOpaqueGid (int gid) |
| void | clearOpaqueGids () |
| void | setBlockEmpty (bool enable) |
| bool | getBlockEmpty () const |
| void | setOpaque (int x, int y, bool opaque) |
| bool | isOpaque (int x, int y) const |
| void | setOpaque3 (int x, int y, int z, bool opaque) |
| bool | isOpaque3 (int x, int y, int z) const |
| void | syncFromLayer () |
| void | setElevation (int x, int y, float elev) |
| float | getElevation (int x, int y) const |
| void | setCliffBlock (float delta) |
| float | getCliffBlock () const |
| void | setEyeOffset (float offset) |
| float | getEyeOffset () const |
| void | setVerticalRange (int range) |
| int | getVerticalRange () const |
| int | addRevealer (int x, int y, int radius) |
| int | addRevealer3 (int x, int y, int z, int radius) |
| void | removeRevealer (int id) |
| void | clearRevealers () |
| void | setRevealerPosition (int id, int x, int y) |
| void | setRevealerPosition3 (int id, int x, int y, int z) |
| void | setRevealerRadius (int id, int radius) |
| void | setRevealerFacing (int id, float facingDeg, float halfAngleDeg) |
| void | clearRevealerFacing (int id) |
| void | setRevealerEnabled (int id, bool enabled) |
| int | getRevealerCount () const |
| void | setRevealerPerception (int id, float perception) |
| Soft RPG hooks (no hard dependency on rpg module). effectiveRadius = radius + floor(perception * perceptionRadiusScale) canDetect: cell visible AND perception + detectionMargin >= targetStealth | |
| float | getRevealerPerception (int id) const |
| void | setPerceptionRadiusScale (float scale) |
| float | getPerceptionRadiusScale () const |
| void | setDetectionMargin (float margin) |
| float | getDetectionMargin () const |
| int | getEffectiveRadius (int id) const |
| bool | canDetect (int revealerId, int x, int y, float targetStealth) const |
| bool | canDetect3 (int revealerId, int x, int y, int z, float targetStealth) const |
| void | markDirty () |
| bool | isDirty () const |
| void | compute () |
| bool | isVisible (int x, int y) const |
| bool | isExplored (int x, int y) const |
| bool | isVisible3 (int x, int y, int z) const |
| bool | isExplored3 (int x, int y, int z) const |
| std::string | getState (int x, int y) const |
| std::string | getState3 (int x, int y, int z) const |
| void | clearMemory () |
| void | resetVisibleOnly () |
| float | getMaskValue (int x, int y) const |
| int | getMaskByte (int x, int y) const |
| float | getMaskValue3 (int x, int y, int z) const |
| int | getMaskByte3 (int x, int y, int z) const |
| bool | fillMaskR8 (std::vector< uint8_t > &out) const |
| bool | fillMaskR8Slice (std::vector< uint8_t > &out, int sliceZ) const |
| graphics::Texture * | buildMaskTexture (graphics::Graphics *gfx) const |
| Upload current 2D / slice mask as RGBA8 Texture (R=G=B=A=mask byte). Caller owns the returned Texture*. Null gfx / empty grid → nullptr. | |
| graphics::Texture * | buildMaskTextureSlice (graphics::Graphics *gfx, int sliceZ) const |
详细描述
Dynamic field-of-view / fog-of-war facade. Phase A: 2D shadowcast + multi-revealer + explored memory. Phase B: raycast/permissive, heightmap, volume, dirty-skip, CPU masks. Phase C: hex topology FOV, rectangle-based FOV, perception/stealth detection helpers, GPU mask Texture upload.
构造及析构函数说明
◆ Fov() [1/6]
◆ Fov() [2/6]
|
explicit |
引用了 bindLayer() , 以及 layer.
◆ Fov() [3/6]
|
explicit |
◆ Fov() [4/6]
| eve::map::Fov::Fov | ( | int | width, |
| int | height, | ||
| int | depth | ||
| ) |
◆ ~Fov()
|
default |
◆ Fov() [5/6]
|
defaultnoexcept |
◆ Fov() [6/6]
|
delete |
成员函数说明
◆ addRevealer()
| int eve::map::Fov::addRevealer | ( | int | x, |
| int | y, | ||
| int | radius | ||
| ) |
引用了 addRevealer3(), x , 以及 y.
◆ addRevealer3()
| int eve::map::Fov::addRevealer3 | ( | int | x, |
| int | y, | ||
| int | z, | ||
| int | radius | ||
| ) |
◆ bindLayer()
| void eve::map::Fov::bindLayer | ( | TileLayer * | layer | ) |
◆ blockOpaqueGid()
◆ buildMaskTexture()
| graphics::Texture * eve::map::Fov::buildMaskTexture | ( | graphics::Graphics * | gfx | ) | const |
Upload current 2D / slice mask as RGBA8 Texture (R=G=B=A=mask byte). Caller owns the returned Texture*. Null gfx / empty grid → nullptr.
◆ buildMaskTextureSlice()
| graphics::Texture * eve::map::Fov::buildMaskTextureSlice | ( | graphics::Graphics * | gfx, |
| int | sliceZ | ||
| ) | const |
引用了 fillMaskR8Slice(), eve::graphics::Graphics::newTexture() , 以及 v.
被这些函数引用 buildMaskTexture().
◆ canDetect()
| bool eve::map::Fov::canDetect | ( | int | revealerId, |
| int | x, | ||
| int | y, | ||
| float | targetStealth | ||
| ) | const |
引用了 canDetect3(), isVisible(), x , 以及 y.
◆ canDetect3()
| bool eve::map::Fov::canDetect3 | ( | int | revealerId, |
| int | x, | ||
| int | y, | ||
| int | z, | ||
| float | targetStealth | ||
| ) | const |
◆ clearMemory()
◆ clearOpaqueGids()
◆ clearRevealerFacing()
◆ clearRevealers()
◆ compute()
◆ fillMaskR8()
| bool eve::map::Fov::fillMaskR8 | ( | std::vector< uint8_t > & | out | ) | const |
引用了 fillMaskR8Slice().
◆ fillMaskR8Slice()
| bool eve::map::Fov::fillMaskR8Slice | ( | std::vector< uint8_t > & | out, |
| int | sliceZ | ||
| ) | const |
◆ getAlgorithm()
◆ getBlockEmpty()
◆ getCliffBlock()
◆ getCornerPeek()
◆ getDepth()
◆ getDetectionMargin()
◆ getEffectiveRadius()
◆ getElevation()
◆ getEyeOffset()
◆ getHeight()
◆ getMaskByte()
| int eve::map::Fov::getMaskByte | ( | int | x, |
| int | y | ||
| ) | const |
引用了 getMaskByte3(), x , 以及 y.
◆ getMaskByte3()
| int eve::map::Fov::getMaskByte3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
◆ getMaskValue()
| float eve::map::Fov::getMaskValue | ( | int | x, |
| int | y | ||
| ) | const |
引用了 getMaskValue3(), x , 以及 y.
◆ getMaskValue3()
| float eve::map::Fov::getMaskValue3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
◆ getMode()
◆ getPerceptionRadiusScale()
◆ getRadiusMetric()
◆ getRevealerCount()
◆ getRevealerPerception()
◆ getState()
| std::string eve::map::Fov::getState | ( | int | x, |
| int | y | ||
| ) | const |
引用了 getState3(), x , 以及 y.
◆ getState3()
| std::string eve::map::Fov::getState3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
◆ getTopology()
◆ getVerticalRange()
◆ getWidth()
◆ isDirty()
◆ isExplored()
| bool eve::map::Fov::isExplored | ( | int | x, |
| int | y | ||
| ) | const |
◆ isExplored3()
| bool eve::map::Fov::isExplored3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
◆ isOpaque()
| bool eve::map::Fov::isOpaque | ( | int | x, |
| int | y | ||
| ) | const |
◆ isOpaque3()
| bool eve::map::Fov::isOpaque3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
◆ isVisible()
| bool eve::map::Fov::isVisible | ( | int | x, |
| int | y | ||
| ) | const |
◆ isVisible3()
| bool eve::map::Fov::isVisible3 | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) | const |
◆ markDirty()
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ removeRevealer()
◆ resetVisibleOnly()
◆ setAlgorithm()
| void eve::map::Fov::setAlgorithm | ( | const std::string & | name | ) |
◆ setBlockEmpty()
◆ setCliffBlock()
◆ setCornerPeek()
◆ setDetectionMargin()
◆ setElevation()
◆ setEyeOffset()
◆ setMode()
| void eve::map::Fov::setMode | ( | const std::string & | name | ) |
◆ setOpaque()
| void eve::map::Fov::setOpaque | ( | int | x, |
| int | y, | ||
| bool | opaque | ||
| ) |
◆ setOpaque3()
| void eve::map::Fov::setOpaque3 | ( | int | x, |
| int | y, | ||
| int | z, | ||
| bool | opaque | ||
| ) |
◆ setPerceptionRadiusScale()
◆ setRadiusMetric()
| void eve::map::Fov::setRadiusMetric | ( | const std::string & | name | ) |
◆ setRevealerEnabled()
| void eve::map::Fov::setRevealerEnabled | ( | int | id, |
| bool | enabled | ||
| ) |
◆ setRevealerFacing()
| void eve::map::Fov::setRevealerFacing | ( | int | id, |
| float | facingDeg, | ||
| float | halfAngleDeg | ||
| ) |
◆ setRevealerPerception()
| void eve::map::Fov::setRevealerPerception | ( | int | id, |
| float | perception | ||
| ) |
◆ setRevealerPosition()
| void eve::map::Fov::setRevealerPosition | ( | int | id, |
| int | x, | ||
| int | y | ||
| ) |
引用了 setRevealerPosition3(), x , 以及 y.
◆ setRevealerPosition3()
| void eve::map::Fov::setRevealerPosition3 | ( | int | id, |
| int | x, | ||
| int | y, | ||
| int | z | ||
| ) |
◆ setRevealerRadius()
◆ setSize()
| void eve::map::Fov::setSize | ( | int | width, |
| int | height | ||
| ) |
◆ setTopology()
| void eve::map::Fov::setTopology | ( | const std::string & | name | ) |
◆ setVerticalRange()
◆ setVolumeSize()
| void eve::map::Fov::setVolumeSize | ( | int | width, |
| int | height, | ||
| int | depth | ||
| ) |
◆ syncFromLayer()
◆ unblockOpaqueGid()
该类的文档由以下文件生成: