VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
bhaveSpawnManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2011 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /*
6 * Copyright 2010 Autodesk, Inc. All rights reserved.
7 * This computer source code and related instructions and comments are the
8 * unpublished confidential and proprietary information of Autodesk, Inc. and
9 * are protected under applicable copyright and trade secret law. They may
10 * not be disclosed to, copied or used by any third party without
11 * the prior written consent of Autodesk, Inc.
12 */
13 
14 #pragma once
15 
16 #include <kyruntime/core/service.h>
17 
18 #include <kypathdata/containers/list.h>
19 #include <kypathdata/navmesh/navmeshutils.h>
20 #include <kypathdata/navmesh/navtriangleptr.h>
21 
22 #include <kyruntime/mesh/navmeshobstaclelocation.h>
23 
25 namespace Kaim
26 {
27  class IVolume;
28  class NavMeshQueryServerWrapper;
29  class NavMeshManager;
30  class Vec3f;
31  class WorldService;
32  class Database;
33 }
34 
35 namespace BHAVE
36 {
37  class DtBhaveSpawnQuery;
38 
39 
40 
43 
63 class DT_DLL_bhaveSim DtBhaveSpawnManager : public Kaim::WorldService
64 {
65 public:
68  {
69  DtBhaveSpawnQueryResult_Done = 0,
73  DtBhaveSpawnQueryResult_dummy_forceenumSize = KYFORCEENUMSIZEINT
74  };
75 
76 
77 public:
78  KY_DECLARE_WORLDSERVICE(DtBhaveSpawnManager)
79 
80 
81 public:
84  DtBhaveSpawnManager(Kaim::World& world);
85 
88 
90  void ReInit();
91 
95  void Update() {}
96 
97  //-------------------------------------------------
99  //-------------------------------------------------
108  KyBool IsSpawnPointValid(const Kaim::Vec3f& position, KyFloat32 interEntityMinDistance, const Kaim::ObstacleTypeMask obstaclesToAvoid, const char* databaseName=KY_NULL);
109 
115  QueryResult GetSpawnPositions(DtBhaveSpawnQuery& query);
116 
117 protected:
118  KyBool CollectNavTriangles(DtBhaveSpawnQuery& query);
119  KyBool CollectVolumeTriangles(Kaim::IVolume* controlVolume, Kaim::IVolume* spawnVolume, KyUInt32 soilTypeFilter);
120 
121  QueryResult GenerateSpawnPositions(DtBhaveSpawnQuery& query);
122  QueryResult GenerateSpawnPositions(DtBhaveSpawnQuery& query, const Kaim::Vec3f* trianglePoints, const Kaim::ObstacleTypeMask obstaclesToAvoid);
123  KyBool AdjustSpawnCandidate(DtBhaveSpawnQuery& query, Kaim::Vec3f& candidate, const Kaim::Vec3f* trianglePoints, const Kaim::ObstacleTypeMask obstaclesToAvoid);
124 
125 
126  KyBool IntersectsAabbs(Kaim::IVolume* volume0, Kaim::IVolume* volume1);
127  KyBool IntersectVolumeNavTriangle(Kaim::IVolume* volume, Kaim::NavTrianglePtr navTrianglePtr);
128 
129  void InsertTrianglePtr(Kaim::NavTrianglePtr navTrianglePtr, Kaim::PoolList<Kaim::NavTrianglePtr>& trianglePtrList);
130 
131  KyBool GetAabbFromVolume(Kaim::IVolume* volume, Kaim::Vec3f& aabbMin, Kaim::Vec3f& aabbMax);
132  KyBool CollectVolumeTriangles(Kaim::IVolume* spawnVolume, KyUInt32 soilTypeFilter);
133  KyBool IntersectVolumeTriangle(Kaim::IVolume* volume, const Kaim::Vec3f* trianglePoints);
134  KyBool IsInsideVolume(Kaim::IVolume* volume, const Kaim::Vec3f& position);
135 
136 
137 protected:
138  Kaim::PoolList<Kaim::NavTrianglePtr> m_tmpTriangleList;
139  Kaim::PoolList<Kaim::NavTrianglePtr> m_finalTriangleList;
140  Kaim::NavMeshObstacleLocationList m_tmpObstacleLocations;
141  Kaim::NavMeshQueryServerWrapper* m_navMeshQueryServer;
142  const Kaim::NavMeshManager* m_navMeshManager;
143 };
144 
145 }
146 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)