9 #ifndef GwNavGen_SingleStageRaster_H
10 #define GwNavGen_SingleStageRaster_H
42 class SingleStageRaster
47 SingleStageRaster(MemoryHeap* heap);
49 KyResult Init(const PixelBox& clippingPixelBox);
51 bool SetupRasterPixelBox(const PixelBox& geometryPixelBox);
55 void PushPixelValue(const PixelPos& pixelPos,
KyFloat32 value);
56 void FlagPixel(const PixelPos& pixelPos);
58 const SingleStagePixel& GetPixel(const PixelPos& pixelPos) const;
59 const SingleStagePixel& GetPixelFromLocalPos(const PixelPos& localPixelPos) const;
61 const PixelBox& GetRasterPixelBox() const;
63 PixelCoord GetFirstLine() const;
64 PixelCoord GetLastLine() const;
65 PixelCoord GetNoLineIdx() const;
67 PixelCoord GetFirstPixelOnLine(PixelCoord py) const;
68 PixelCoord GetLastPixelOnLine(PixelCoord py) const;
69 PixelCoord GetNoPixelIdx() const;
72 bool IsPixelFlaggedFromLocalPos(const PixelPos& localPixelPos) const;
74 void SetNavTagIdx(
KyUInt32 navTagIdx);
81 PixelBox m_clippingPixelBox;
82 PixelBox m_rasterPixelBox;
83 KyArrayTLS<SingleStagePixel> m_pixels;
84 BitArray2d_1024 m_bitArray2d;
91 KY_INLINE SingleStageRaster::SingleStageRaster(MemoryHeap* heap) : m_bitArray2d(heap), m_navTagIdx(
KyUInt32MAXVAL), m_heap(heap) {}
93 KY_INLINE
void SingleStageRaster::PushPixelValue(
const PixelPos& pixelPos,
KyFloat32 value)
95 KY_DEBUG_ASSERTN(m_rasterPixelBox.IsInside(pixelPos),(
"Pixel is outside rasterPixelBox"));
97 PixelPos localPixelPos = pixelPos - m_rasterPixelBox.Min();
98 KyInt32 pixelIdx = m_rasterPixelBox.GetRowMajorIndexFromLocalPos(localPixelPos);
99 m_pixels[pixelIdx].AddValue(value);
100 m_bitArray2d.SetPixel(localPixelPos.x, localPixelPos.y);
103 KY_INLINE
void SingleStageRaster::FlagPixel(
const PixelPos& pixelPos)
105 KY_DEBUG_ASSERTN(m_rasterPixelBox.IsInside(pixelPos),(
"Pixel is outside rasterPixelBox"));
107 PixelPos localPixelPos = pixelPos - m_rasterPixelBox.Min();
108 m_bitArray2d.SetPixel(localPixelPos.x, localPixelPos.y);
111 KY_INLINE
const SingleStagePixel& SingleStageRaster::GetPixel(
const PixelPos& pixelPos)
const
113 return m_pixels[m_rasterPixelBox.GetRowMajorIndex(pixelPos)];
116 KY_INLINE
const SingleStagePixel& SingleStageRaster::GetPixelFromLocalPos(
const PixelPos& localPixelPos)
const
118 return m_pixels[m_rasterPixelBox.GetRowMajorIndexFromLocalPos(localPixelPos)];
121 KY_INLINE
const PixelBox& SingleStageRaster::GetRasterPixelBox()
const {
return m_rasterPixelBox; }
122 KY_INLINE PixelCoord SingleStageRaster::GetFirstLine()
const {
return m_bitArray2d.GetFirstY() + m_rasterPixelBox.Min().y; }
123 KY_INLINE PixelCoord SingleStageRaster::GetLastLine()
const {
return m_bitArray2d.GetLastY() + m_rasterPixelBox.Min().y; }
124 KY_INLINE PixelCoord SingleStageRaster::GetNoLineIdx()
const {
return m_rasterPixelBox.Min().y - 1; }
125 KY_INLINE PixelCoord SingleStageRaster::GetNoPixelIdx()
const {
return m_rasterPixelBox.Min().x - 1; }
126 KY_INLINE PixelCoord SingleStageRaster::GetFirstPixelOnLine(PixelCoord py)
const {
return m_bitArray2d.GetFirstX(py - m_rasterPixelBox.Min().y) + m_rasterPixelBox.Min().x; }
127 KY_INLINE PixelCoord SingleStageRaster::GetLastPixelOnLine(PixelCoord py)
const {
return m_bitArray2d.GetLastX( py - m_rasterPixelBox.Min().y) + m_rasterPixelBox.Min().x; }
130 KY_INLINE
bool SingleStageRaster::IsPixelFlaggedFromLocalPos(
const PixelPos& localPixelPos)
const
132 return m_bitArray2d.GetPixel(localPixelPos.x, localPixelPos.y);
135 KY_INLINE
void SingleStageRaster::SetNavTagIdx(
KyUInt32 navTagIdx) { m_navTagIdx = navTagIdx; }
136 KY_INLINE
KyUInt32 SingleStageRaster::GetNavTagIdx()
const {
return m_navTagIdx; }
138 KY_INLINE
void SingleStageRaster::SetOwnerIdx(
KyUInt32 ownerIdx) { m_ownerIndex = ownerIdx; }
139 KY_INLINE
KyUInt32 SingleStageRaster::GetOwnerIdx()
const {
return m_ownerIndex; }
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43