9 #ifndef Navigation_MakeNavFloorStitchQuery_H
10 #define Navigation_MakeNavFloorStitchQuery_H
21 class DynamicTriangulation;
22 class DynamicNavFloor;
23 class NavFloorStitcherData;
31 RUNTIMESTITCH_PROCESSING,
39 class MakeNavFloorStitchQuery :
public ITimeSlicedQuery
43 static QueryType GetStaticType() {
return TypeMakeNavFloorStitchQuery; }
44 virtual QueryType GetType()
const {
return TypeMakeNavFloorStitchQuery; }
46 MakeNavFloorStitchQuery();
47 virtual ~MakeNavFloorStitchQuery();
52 void BindToDatabase(Database* database);
55 virtual void Advance(WorkingMemory* workingMemory);
56 virtual void ReleaseWorkingMemoryOnCancelDuringProcess(WorkingMemory* workingMemory =
KY_NULL);
62 static void FillEdgeExtremities(
const NavFloorBlob* navFloorBlob,
NavHalfEdgeIdx halfEdgeIdx, Vec2i& start, Vec2i& end);
65 void ProcessNavFloor();
67 class NewCutAlongStaticEdge
70 NewCutAlongStaticEdge() {}
71 NewCutAlongStaticEdge(
const Vec2i& pos,
KyFloat32 alt) : m_pos(pos), m_altitude(alt) {}
72 bool operator==(
const NewCutAlongStaticEdge& other)
const {
return m_pos == other.m_pos; }
73 bool operator!=(
const NewCutAlongStaticEdge& other)
const {
return m_pos != other.m_pos; }
80 class RunTimeStitchCutSorter
83 RunTimeStitchCutSorter(
const Vec2i& stitch1To1EndVertex,
KyInt32 currentEdgeDir) :
84 m_stitch1To1EndVertex(stitch1To1EndVertex), m_coordIdx(currentEdgeDir) {}
86 bool operator() (
const NewCutAlongStaticEdge& cut1,
const NewCutAlongStaticEdge& cut2)
const
88 KY_ASSERT(cut1.m_pos[m_coordIdx] != m_stitch1To1EndVertex[m_coordIdx]);
89 KY_ASSERT(cut2.m_pos[m_coordIdx] != m_stitch1To1EndVertex[m_coordIdx]);
90 const KyInt32 diff1 = cut1.m_pos[m_coordIdx] - m_stitch1To1EndVertex[m_coordIdx];
91 const KyInt32 diff2 = cut2.m_pos[m_coordIdx] - m_stitch1To1EndVertex[m_coordIdx];
92 const KyInt32 squareDist1 = diff1*diff1;
93 const KyInt32 squareDist2 = diff2*diff2;
94 return squareDist1 < squareDist2;
97 Vec2i m_stitch1To1EndVertex;
102 void ComputeAndInsertAllCuts(NavFloorStitcherData& currentData,
KyUInt32 stitch1To1EdgeIdx,
const Vec2i& stitch1To1EndVertex,
103 NavFloorStitcherData& neighborData,
KyUInt32 neighborStitch1To1EdgeIdx, KyArray<NewCutAlongStaticEdge>& newCuts, DynamicTriangulation& dynTri);
104 void InsertexVertexInTriangulationOnEdge(DynamicTriangulation& dynTri,
KyUInt32 halfEdgeIdx, NewCutAlongStaticEdge& newCut);
105 void BuildDynamicTriangulationFromStaticNavFloorBlob(
const NavFloorBlob* floorBlob, DynamicTriangulation& dynTri);
106 void BuildDynamicNavFloorFromDynamicTriangulation(
const NavFloorBlob* floorBlob,
const NavFloor1To1StitchDataBlob& floor1To1StitchDataBlob,
107 const DynamicTriangulation& dynTri, DynamicNavFloor& dynaFloor);
109 void SetFinish(WorkingMemory* workingMemory);
110 void ReleaseWorkingMemory() {}
116 KyArray<Ptr<BlobHandler<NavFloorBlob> > > m_resultNavfloorHandlers;
120 KyArray<KyUInt16> m_navHalfEdgeToTriangulationEdge;
121 bool m_dynamicTriangulationFromFloorIsBuilt;
124 KY_INLINE
void MakeNavFloorStitchQuery::SetFinish(WorkingMemory* )
126 m_processStatus = QueryDone;
127 ReleaseWorkingMemory();
138 #endif //Navigation_MakeNavFloorStitchQuery_H
Indicates that insufficient working memory caused the query to stop.
Definition: makenavfloorstitchquery.h:33
KyUInt32 NavHalfEdgeIdx
An index that uniquely identifies a single edge of a triangle within the set of edges owned by a NavF...
Definition: navmeshtypes.h:87
Indicates the query was successfully processed.
Definition: makenavfloorstitchquery.h:36
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
#define KY_NULL
Null value.
Definition: types.h:247
Indicates the query has not yet been initialized.
Definition: makenavfloorstitchquery.h:28
MakeNavFloorStitchQueryResult
Enumerates the possible results of a MakeNavFloorStitchQuery.
Definition: makenavfloorstitchquery.h:26
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
Indicates an unknown error occurred during the query processing.
Definition: makenavfloorstitchquery.h:34
KyUInt32 NavFloorIdx
An index that uniquely identifies a single NavFloor within the set of NavFloors owned by a NavCell...
Definition: navmeshtypes.h:115
Definition: gamekitcrowddispersion.h:20
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Indicates the query has not yet been launched.
Definition: makenavfloorstitchquery.h:29
Indicates that the query has not yet been launched.
Definition: iquery.h:347
void Initialize()
Should be called by the derived class before trying to perform the query or to push it in a QueryQueu...
Definition: iquery.h:404
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43