Core/Collision: Models with flag MOD_M2
Mostly trees, among some other objects should not be taken into account for LoS checks, this check does not apply to gameobjects (yet)
This commit is contained in:
parent
24b2e50158
commit
4d3c02379c
@ -313,7 +313,7 @@ namespace VMAP
|
||||
#endif
|
||||
if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
|
||||
{
|
||||
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
|
||||
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags);
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "StaticMapTree::InitMap(): loading %s", spawn.name.c_str());
|
||||
if (model)
|
||||
{
|
||||
@ -383,7 +383,7 @@ namespace VMAP
|
||||
if (result)
|
||||
{
|
||||
// acquire model instance
|
||||
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
|
||||
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags);
|
||||
if (!model)
|
||||
{ ERROR_LOG("StaticMapTree::LoadMapTile() could not acquire WorldModel pointer for '%s'!", spawn.name.c_str()); }
|
||||
|
||||
|
@ -251,7 +251,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename)
|
||||
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename, uint32 flags/* Only used when creating the model */)
|
||||
{
|
||||
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
|
||||
if (model == iLoadedModelFiles.end())
|
||||
@ -264,6 +264,7 @@ namespace VMAP
|
||||
return NULL;
|
||||
}
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "VMapManager2: loading file '%s%s'.", basepath.c_str(), filename.c_str());
|
||||
worldmodel->Flags = flags;
|
||||
model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
|
||||
model->second.setModel(worldmodel);
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ namespace VMAP
|
||||
* @param filename
|
||||
* @return WorldModel
|
||||
*/
|
||||
WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename);
|
||||
WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename, uint32 flags = 0);
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
|
@ -29,6 +29,11 @@
|
||||
using G3D::Vector3;
|
||||
using G3D::Ray;
|
||||
|
||||
enum ModelFlags
|
||||
{
|
||||
MOD_M2 = 1
|
||||
};
|
||||
|
||||
template<> struct BoundsTrait<VMAP::GroupModel>
|
||||
{
|
||||
static void getBounds(const VMAP::GroupModel& obj, G3D::AABox& out) { out = obj.GetBound(); }
|
||||
@ -433,6 +438,9 @@ namespace VMAP
|
||||
|
||||
bool WorldModel::IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const
|
||||
{
|
||||
// M2 models are not taken into account for LoS calculation
|
||||
if (Flags & MOD_M2)
|
||||
return false;
|
||||
// small M2 workaround, maybe better make separate class with virtual intersection funcs
|
||||
// in any case, there's no need to use a bound tree if we only have one submodel
|
||||
if (groupModels.size() == 1)
|
||||
|
@ -356,6 +356,7 @@ namespace VMAP
|
||||
* @return bool
|
||||
*/
|
||||
bool readFile(const std::string& filename);
|
||||
uint32 Flags;
|
||||
protected:
|
||||
uint32 RootWMOID; /**< TODO */
|
||||
std::vector<GroupModel> groupModels; /**< TODO */
|
||||
|
Loading…
x
Reference in New Issue
Block a user