9 #ifndef GwNavGen_DynamicRasterCell_H
10 #define GwNavGen_DynamicRasterCell_H
25 class GeneratorSystem;
26 class SingleStagePixel;
30 enum DynamicRasterCellMergeStatus
32 DynamicRasterCellMergeStatus_MergeEnabled,
33 DynamicRasterCellMergeStatus_MergeDisabled
36 class DynamicRasterCell
43 const GeneratorParameters& config, const CellDesc& cellDesc, const KyArrayPOD<const InputCellBlob*>* inputCells,
44 const KyArrayTLS_POD<const NavTag*>* navTagArray,
46 const PixelBox* modifiedPixelBox =
KY_NULL
48 : m_navTagArray(navTagArray)
49 , m_dynamicColumns(GeneratorMemory::TlsHeap())
50 , m_finalColumns(GeneratorMemory::TlsHeap())
51 , m_finalNavTagIdxColumns(GeneratorMemory::TlsHeap())
52 , m_areAllInputCellsOverlapping(true)
54 KyFloat32 rasterPrecision = config.m_normalizedParameters.m_normalizedRasterPrecision;
55 if (modifiedRasterPrecision != 0.0f)
56 rasterPrecision = modifiedRasterPrecision;
58 const PixelBox* pixelBox = &cellDesc.m_enlargedPixelBox;
59 if (modifiedPixelBox !=
KY_NULL)
60 pixelBox = modifiedPixelBox;
62 Setup(config, cellDesc, inputCells, rasterPrecision, *pixelBox);
65 void Setup(
const GeneratorParameters& config,
const CellDesc& cellDesc,
66 const KyArrayPOD<const InputCellBlob*>* inputCells,
KyFloat32 rasterPrecision,
const PixelBox& pixelBox);
75 void PushPixelToLocal(
const PixelPos& localPixelPos,
const SingleStagePixel& pixel,
KyUInt32 navTagIdx);
86 void EndColumns(DynamicRasterCellMergeStatus mergeStatus);
89 const BoxOfArrays<KyFloat32>::Column& GetFinalColumnFromLocal(
const PixelPos& localPixelPos)
const;
92 const BoxOfArrays<KyFloat32>::Column& GetFinalColumn(
const PixelPos& pixelPos)
const;
95 const BoxOfArrays<KyUInt32>::Column& GetFinalNavTagColumnFromLocal(
const PixelPos& localPixelPos)
const;
98 const BoxOfArrays<KyUInt32>::Column& GetFinalNavTagIndicesColumn(
const PixelPos& pixelPos)
const;
101 KyResult WriteIntermediateRasterFile(GeneratorSystem* system)
const;
103 bool IsEmpty()
const {
return m_isEmpty; }
104 bool AreAllInputCellsOverlapping()
const {
return m_inputCells->GetCount() == 1 || m_areAllInputCellsOverlapping; }
105 bool HasMultipleNavTags()
const {
return m_hasMultipleNavTags; }
107 void SetHasMultipleNavTags(
bool hasMultipleNavTags) { m_hasMultipleNavTags = hasMultipleNavTags; }
109 const PixelBox& GetPixelBox()
const {
return m_pixelBox; }
110 const CellDesc& GetCellDesc()
const {
return m_cellDesc; }
112 const BoxOfArrays<KyFloat32>& GetFinalColumns()
const {
return m_finalColumns; }
113 BoxOfArrays<KyFloat32>& GetFinalColumns() {
return m_finalColumns; }
115 const BoxOfArrays<KyUInt32>& GetFinalColorColumns()
const {
return m_finalNavTagIdxColumns; }
116 BoxOfArrays<KyUInt32>& GetFinalColorColumns() {
return m_finalNavTagIdxColumns; }
119 KyResult Copy(
const DynamicRasterCell& from);
121 KyInt32 GetPixelSize()
const {
return IntCoordSystem::IntPixelSize(); }
122 KyFloat32 GetRasterPrecision()
const {
return m_rasterPrecision; }
124 const KyArrayTLS_POD<const NavTag*>& GetNavTagArray()
const {
return *m_navTagArray; }
126 void ComputeUniqueTagVolumes(KyArray<RasterCellTagVolume>& rasterVolumes);
127 void MakeFinalColumns(DynamicRasterCellMergeStatus mergeStatus);
128 void ReleaseDynamicColumns();
132 GeneratorParameters m_config;
135 const KyArrayPOD<const InputCellBlob*>* m_inputCells;
136 const KyArrayTLS_POD<const NavTag*>* m_navTagArray;
139 DynamicRasterColumnPool m_dynamicColumns;
142 BoxOfArrays<KyFloat32> m_finalColumns;
145 BoxOfArrays<KyUInt32> m_finalNavTagIdxColumns;
148 bool m_hasMultipleNavTags;
149 bool m_areAllInputCellsOverlapping;
151 friend class DynamicRasterCellBlobBuilder;
158 inline void DynamicRasterCell::PushPixelToLocal(
const PixelPos& localPixelPos,
const SingleStagePixel& pixel,
KyUInt32 navTagIdx)
160 KyInt32 idx = m_pixelBox.GetRowMajorIndexFromLocalPos(localPixelPos);
161 PushPixel(idx, pixel, navTagIdx);
164 inline void DynamicRasterCell::PushPixel(
const PixelPos& pixelPos,
const SingleStagePixel& pixel,
KyUInt32 navTagIdx,
KyUInt32 ownerIdx)
166 KyInt32 idx = m_pixelBox.GetRowMajorIndex(pixelPos);
167 PushPixel(idx, pixel, navTagIdx, ownerIdx);
170 inline const BoxOfArrays<KyFloat32>::Column& DynamicRasterCell::GetFinalColumnFromLocal(
const PixelPos& localPixelPos)
const
172 return m_finalColumns.GetColumn(localPixelPos.x, localPixelPos.y);
175 inline const BoxOfArrays<KyFloat32>::Column& DynamicRasterCell::GetFinalColumn(
const PixelPos& pixelPos)
const
177 KyInt32 idx = m_pixelBox.GetRowMajorIndex(pixelPos);
178 return m_finalColumns.GetColumn(idx);
181 inline const BoxOfArrays<KyUInt32>::Column& DynamicRasterCell::GetFinalNavTagColumnFromLocal(
const PixelPos& localPixelPos)
const
183 return m_finalNavTagIdxColumns.GetColumn(localPixelPos.x, localPixelPos.y);
186 inline const BoxOfArrays<KyUInt32>::Column& DynamicRasterCell::GetFinalNavTagIndicesColumn(
const PixelPos& pixelPos)
const
188 KyInt32 idx = m_pixelBox.GetRowMajorIndex(pixelPos);
189 return m_finalNavTagIdxColumns.GetColumn(idx);
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
#define KY_NULL
Null value.
Definition: types.h:247
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
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