gwnavgeneration/raster/trianglerasterizer.h Source File

trianglerasterizer.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 
9 
10 
11 // primary contact: GUAL - secondary contact: NOBODY
12 #ifndef GwNavGen_TriangleRasterizer_H
13 #define GwNavGen_TriangleRasterizer_H
14 
15 
18 
19 
20 namespace Kaim
21 {
22 
23 class Triangle3i;
24 class GeneratorSystem;
25 class RasterPoint;
26 class SingleStageRaster;
27 
28 
29 class TriangleRasterizer
30 {
31  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
32 public:
33  TriangleRasterizer(GeneratorSystem* sys) : m_sys(sys), m_singleStageRaster(KY_NULL){}
34 
35  void Init(KyFloat32 pixelSizeInMeters, KyInt32 intPixelSize, SingleStageRaster* singleStageRaster);
36 
37  void RasterizeTriangle(const Triangle3i& triangle3i, KyUInt32 navTagIdx);
38 
39  KyFloat32 GetRasterPrecision() const { return m_rasterPrecision; }
40 
41 private:
42  void RasterizePoint(const RasterPoint& M);
43  void RasterizeInterior();
44  void WriteLine(Coord min_x, Coord max_x, Coord y);
45  void WriteSinglePixelLine(Coord min_x, Coord max_x, PixelCoord py, Coord y);
46  void WriteDoublePixelLine(Coord min_x, Coord max_x, Coord y);
47  void FlagLineEnds();
48 
49 private:
50  GeneratorSystem* m_sys;
51  KyInt32 m_intPixelSize;
52  KyFloat32 m_rasterPrecision;
53  SingleStageRaster* m_singleStageRaster;
54  RasterTriangle m_triangle;
55  CoordBox m_rasterCoordBox;
56 };
57 
58 
59 }
60 
61 
62 #endif
Box2i CoordBox
A type that represents a bounding box in the integer 2D grid.
Definition: navmeshtypes.h:24
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
#define KY_NULL
Null value.
Definition: types.h:247
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
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43