40 class SingleStageRaster
45 SingleStageRaster(MemoryHeap* heap);
47 KyResult Init(const PixelBox& clippingPixelBox);
49 bool SetupRasterPixelBox(const PixelBox& geometryPixelBox);
53 void PushPixelValue(const PixelPos& pixelPos,
KyFloat32 value);
54 void FlagPixel(const PixelPos& pixelPos);
56 const SingleStagePixel& GetPixel(const PixelPos& pixelPos) const;
57 const SingleStagePixel& GetPixelFromLocalPos(const PixelPos& localPixelPos) const;
59 const PixelBox& GetRasterPixelBox() const;
61 PixelCoord GetFirstLine() const;
62 PixelCoord GetLastLine() const;
63 PixelCoord GetNoLineIdx() const;
65 PixelCoord GetFirstPixelOnLine(PixelCoord py) const;
66 PixelCoord GetLastPixelOnLine(PixelCoord py) const;
67 PixelCoord GetNoPixelIdx() const;
70 bool IsPixelFlaggedFromLocalPos(const PixelPos& localPixelPos) const;
72 void SetNavTagIdx(
KyUInt32 navTagIdx);
79 PixelBox m_clippingPixelBox;
80 PixelBox m_rasterPixelBox;
81 KyArrayTLS<SingleStagePixel> m_pixels;
82 BitArray2d_1024 m_bitArray2d;
89 KY_INLINE SingleStageRaster::SingleStageRaster(MemoryHeap* heap) : m_bitArray2d(heap), m_navTagIdx(
KyUInt32MAXVAL), m_heap(heap) {}
91 KY_INLINE
void SingleStageRaster::PushPixelValue(
const PixelPos& pixelPos,
KyFloat32 value)
93 KY_DEBUG_ASSERTN(m_rasterPixelBox.DoesContain(pixelPos),(
"Pixel is outside rasterPixelBox"));
95 PixelPos localPixelPos = pixelPos - m_rasterPixelBox.Min();
96 KyInt32 pixelIdx = m_rasterPixelBox.GetRowMajorIndexFromLocalPos(localPixelPos);
97 m_pixels[pixelIdx].AddValue(value);
98 m_bitArray2d.SetPixel(localPixelPos.x, localPixelPos.y);
101 KY_INLINE
void SingleStageRaster::FlagPixel(
const PixelPos& pixelPos)
103 KY_DEBUG_ASSERTN(m_rasterPixelBox.DoesContain(pixelPos),(
"Pixel is outside rasterPixelBox"));
105 PixelPos localPixelPos = pixelPos - m_rasterPixelBox.Min();
106 m_bitArray2d.SetPixel(localPixelPos.x, localPixelPos.y);
109 KY_INLINE
const SingleStagePixel& SingleStageRaster::GetPixel(
const PixelPos& pixelPos)
const
111 return m_pixels[m_rasterPixelBox.GetRowMajorIndex(pixelPos)];
114 KY_INLINE
const SingleStagePixel& SingleStageRaster::GetPixelFromLocalPos(
const PixelPos& localPixelPos)
const
116 return m_pixels[m_rasterPixelBox.GetRowMajorIndexFromLocalPos(localPixelPos)];
119 KY_INLINE
const PixelBox& SingleStageRaster::GetRasterPixelBox()
const {
return m_rasterPixelBox; }
120 KY_INLINE PixelCoord SingleStageRaster::GetFirstLine()
const {
return m_bitArray2d.GetFirstY() + m_rasterPixelBox.Min().y; }
121 KY_INLINE PixelCoord SingleStageRaster::GetLastLine()
const {
return m_bitArray2d.GetLastY() + m_rasterPixelBox.Min().y; }
122 KY_INLINE PixelCoord SingleStageRaster::GetNoLineIdx()
const {
return m_rasterPixelBox.Min().y - 1; }
123 KY_INLINE PixelCoord SingleStageRaster::GetNoPixelIdx()
const {
return m_rasterPixelBox.Min().x - 1; }
124 KY_INLINE PixelCoord SingleStageRaster::GetFirstPixelOnLine(PixelCoord py)
const {
return m_bitArray2d.GetFirstX(py - m_rasterPixelBox.Min().y) + m_rasterPixelBox.Min().x; }
125 KY_INLINE PixelCoord SingleStageRaster::GetLastPixelOnLine(PixelCoord py)
const {
return m_bitArray2d.GetLastX( py - m_rasterPixelBox.Min().y) + m_rasterPixelBox.Min().x; }
128 KY_INLINE
bool SingleStageRaster::IsPixelFlaggedFromLocalPos(
const PixelPos& localPixelPos)
const
130 return m_bitArray2d.GetPixel(localPixelPos.x, localPixelPos.y);
133 KY_INLINE
void SingleStageRaster::SetNavTagIdx(
KyUInt32 navTagIdx) { m_navTagIdx = navTagIdx; }
134 KY_INLINE
KyUInt32 SingleStageRaster::GetNavTagIdx()
const {
return m_navTagIdx; }
136 KY_INLINE
void SingleStageRaster::SetOwnerIdx(
KyUInt32 ownerIdx) { m_ownerIndex = ownerIdx; }
137 KY_INLINE
KyUInt32 SingleStageRaster::GetOwnerIdx()
const {
return m_ownerIndex; }
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68
float KyFloat32
float
Definition: types.h:32