gwnavgeneration/raster/trianglerasterizer.h Source File

trianglerasterizer.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
12 
13 
16 
17 
18 namespace Kaim
19 {
20 
21 class Triangle3i;
22 class GeneratorSystem;
23 class RasterPoint;
24 class SingleStageRaster;
25 
26 
27 class TriangleRasterizer
28 {
29  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
30 public:
31  TriangleRasterizer(GeneratorSystem* sys) : m_sys(sys), m_singleStageRaster(nullptr){}
32 
33  void Init(KyFloat32 pixelSizeInMeters, KyInt32 intPixelSize, SingleStageRaster* singleStageRaster);
34 
35  void RasterizeTriangle(const Triangle3i& triangle3i, KyUInt32 navTagIdx);
36 
37  KyFloat32 GetRasterPrecision() const { return m_rasterPrecision; }
38 
39 private:
40  void RasterizePoint(const RasterPoint& M);
41  void RasterizeInterior();
42  void WriteLine(Coord min_x, Coord max_x, Coord y);
43  void WriteSinglePixelLine(Coord min_x, Coord max_x, PixelCoord py, Coord y);
44  void WriteDoublePixelLine(Coord min_x, Coord max_x, Coord y);
45  void FlagLineEnds();
46 
47 private:
48  GeneratorSystem* m_sys;
49  KyInt32 m_intPixelSize;
50  KyFloat32 m_rasterPrecision;
51  SingleStageRaster* m_singleStageRaster;
52  RasterTriangle m_triangle;
53  CoordBox m_rasterCoordBox;
54 };
55 
56 
57 }
58 
59 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Box2i CoordBox
A type that represents a bounding box in the integer 2D grid.
Definition: navmeshtypes.h:21
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
float KyFloat32
float
Definition: types.h:32