本文整理汇总了C++中PortalLayout::getAppearanceTemplatesSize方法的典型用法代码示例。如果您正苦于以下问题:C++ PortalLayout::getAppearanceTemplatesSize方法的具体用法?C++ PortalLayout::getAppearanceTemplatesSize怎么用?C++ PortalLayout::getAppearanceTemplatesSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PortalLayout
的用法示例。
在下文中一共展示了PortalLayout::getAppearanceTemplatesSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkLineOfSightWorldToCell
bool CollisionManager::checkLineOfSightWorldToCell(const Vector3& rayOrigin, const Vector3& rayEnd, float distance, CellObject* cellObject) {
ManagedReference<SceneObject*> building = cellObject->getParent();
if (building == NULL)
return true;
SharedObjectTemplate* objectTemplate = building->getObjectTemplate();
PortalLayout* portalLayout = objectTemplate->getPortalLayout();
if (portalLayout == NULL)
return true;
Ray ray = convertToModelSpace(rayOrigin, rayEnd, building);
if (cellObject->getCellNumber() >= portalLayout->getAppearanceTemplatesSize())
return true;
MeshAppearanceTemplate* app = portalLayout->getMeshAppearanceTemplate(cellObject->getCellNumber());
AABBTree* aabbTree = app->getAABBTree();
if (aabbTree == NULL)
return true;
float intersectionDistance;
Triangle* triangle = NULL;
if (aabbTree->intersects(ray, distance, intersectionDistance, triangle, true))
return false;
return true;
}
示例2: checkLineOfSightInBuilding
bool CollisionManager::checkLineOfSightInBuilding(SceneObject* object1, SceneObject* object2, SceneObject* building) {
SharedObjectTemplate* objectTemplate = building->getObjectTemplate();
PortalLayout* portalLayout = objectTemplate->getPortalLayout();
if (portalLayout == NULL)
return true;
//we are in model space... in cells
Vector3 rayOrigin = object1->getPosition();
rayOrigin.set(rayOrigin.getX(), rayOrigin.getY(), rayOrigin.getZ() + 1.f);
Vector3 rayEnd = object2->getPosition();
rayEnd.set(rayEnd.getX(), rayEnd.getY(), rayEnd.getZ() + 1.f);
Vector3 direction(Vector3(rayEnd - rayOrigin));
direction.normalize();
float distance = rayEnd.distanceTo(rayOrigin);
float intersectionDistance;
Ray ray(rayOrigin, direction);
Triangle* triangle = NULL;
// we check interior cells
for (int i = 1; i < portalLayout->getAppearanceTemplatesSize(); ++i) {
MeshAppearanceTemplate* app = portalLayout->getMeshAppearanceTemplate(i);
AABBTree* aabbTree = app->getAABBTree();
if (aabbTree == NULL)
continue;
if (aabbTree->intersects(ray, distance, intersectionDistance, triangle, true))
return false;
}
return true;
}