![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2011 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /* 00006 * Copyright 2010 Autodesk, Inc. All rights reserved. 00007 * This computer source code and related instructions and comments are the 00008 * unpublished confidential and proprietary information of Autodesk, Inc. and 00009 * are protected under applicable copyright and trade secret law. They may 00010 * not be disclosed to, copied or used by any third party without 00011 * the prior written consent of Autodesk, Inc. 00012 */ 00013 00014 #pragma once 00015 00016 #include <kyruntime/core/service.h> 00017 00018 #include <kypathdata/containers/list.h> 00019 #include <kypathdata/navmesh/navmeshutils.h> 00020 #include <kypathdata/navmesh/navtriangleptr.h> 00021 00022 #include <kyruntime/mesh/navmeshobstaclelocation.h> 00023 00024 namespace Kaim 00025 { 00026 class IVolume; 00027 class NavMeshQueryServerWrapper; 00028 class NavMeshManager; 00029 class Vec3f; 00030 class WorldService; 00031 class Database; 00032 } 00033 00034 namespace BHAVE 00035 { 00036 class DtBhaveSpawnQuery; 00037 00038 00039 00042 00062 class DtBhaveSpawnManager : public Kaim::WorldService 00063 { 00064 public: 00066 enum QueryResult 00067 { 00068 DtBhaveSpawnQueryResult_Done = 0, 00069 DtBhaveSpawnQueryResult_BufferOverflow, 00070 DtBhaveSpawnQueryResult_Working, 00071 DtBhaveSpawnQueryResult_Error, 00072 DtBhaveSpawnQueryResult_dummy_forceenumSize = KYFORCEENUMSIZEINT 00073 }; 00074 00075 00076 public: 00077 KY_DECLARE_WORLDSERVICE(DtBhaveSpawnManager) 00078 00079 00080 public: 00083 DtBhaveSpawnManager(Kaim::World& world); 00084 00086 ~DtBhaveSpawnManager(); 00087 00089 void ReInit(); 00090 00094 void Update() {} 00095 00096 //------------------------------------------------- 00098 //------------------------------------------------- 00107 KyBool IsSpawnPointValid(const Kaim::Vec3f& position, KyFloat32 interEntityMinDistance, const Kaim::ObstacleTypeMask obstaclesToAvoid, const char* databaseName=KY_NULL); 00108 00114 QueryResult GetSpawnPositions(DtBhaveSpawnQuery& query); 00115 00116 protected: 00117 KyBool CollectNavTriangles(DtBhaveSpawnQuery& query); 00118 KyBool CollectVolumeTriangles(Kaim::IVolume* controlVolume, Kaim::IVolume* spawnVolume, KyUInt32 soilTypeFilter); 00119 00120 QueryResult GenerateSpawnPositions(DtBhaveSpawnQuery& query); 00121 QueryResult GenerateSpawnPositions(DtBhaveSpawnQuery& query, const Kaim::Vec3f* trianglePoints, const Kaim::ObstacleTypeMask obstaclesToAvoid); 00122 KyBool AdjustSpawnCandidate(DtBhaveSpawnQuery& query, Kaim::Vec3f& candidate, const Kaim::Vec3f* trianglePoints, const Kaim::ObstacleTypeMask obstaclesToAvoid); 00123 00124 00125 KyBool IntersectsAabbs(Kaim::IVolume* volume0, Kaim::IVolume* volume1); 00126 KyBool IntersectVolumeNavTriangle(Kaim::IVolume* volume, Kaim::NavTrianglePtr navTrianglePtr); 00127 00128 void InsertTrianglePtr(Kaim::NavTrianglePtr navTrianglePtr, Kaim::List<Kaim::NavTrianglePtr>& trianglePtrList); 00129 00130 KyBool GetAabbFromVolume(Kaim::IVolume* volume, Kaim::Vec3f& aabbMin, Kaim::Vec3f& aabbMax); 00131 KyBool CollectVolumeTriangles(Kaim::IVolume* spawnVolume, KyUInt32 soilTypeFilter); 00132 KyBool IntersectVolumeTriangle(Kaim::IVolume* volume, const Kaim::Vec3f* trianglePoints); 00133 KyBool IsInsideVolume(Kaim::IVolume* volume, const Kaim::Vec3f& position); 00134 00135 00136 protected: 00137 Kaim::List<Kaim::NavTrianglePtr> m_tmpTriangleList; 00138 Kaim::List<Kaim::NavTrianglePtr> m_finalTriangleList; 00139 Kaim::NavMeshObstacleLocationList m_tmpObstacleLocations; 00140 Kaim::NavMeshQueryServerWrapper* m_navMeshQueryServer; 00141 const Kaim::NavMeshManager* m_navMeshManager; 00142 }; 00143 00144 } 00145