示例#1
0
DAVA::AABBox3 EntityGroup::GetCommonBbox() const
{
	DAVA::AABBox3 ret;

	for(size_t i = 0; i <entities.size(); ++i)
	{
		ret.AddAABBox(GetBbox(i));
	}

	return ret;
}
DAVA::AABBox3 SceneSelectionSystem::CalcAABox(DAVA::Entity *entity) const
{
	DAVA::AABBox3 ret;

	if(NULL != entity)
	{
		// we will get selection bbox from collision system
		ret = collisionSystem->GetBoundingBox(entity);

		if(ret.IsEmpty())
		{
			for (DAVA::int32 i = 0; i < entity->GetChildrenCount(); i++)
			{
				ret.AddAABBox(collisionSystem->GetBoundingBox(entity->GetChild(i)));
			}
		}
	}

	return ret;
}
示例#3
0
DAVA::Vector3 EntityGroup::GetCommonZeroPos() const
{
	DAVA::Vector3 ret;

	if(entities.size() == 1)
	{
		ret = GetZeroPos(0);
	}
	else if(entities.size() > 0)
	{
		DAVA::AABBox3 tmp;

		for(size_t i = 0; i < entities.size(); ++i)
		{
			tmp.AddPoint(entities[i].entity->GetWorldTransform().GetTranslationVector());
		}

		ret = tmp.GetCenter();
	}

	return ret;
}
示例#4
0
DAVA::AABBox3 SceneSelectionSystem::GetSelectionAABox(DAVA::Entity *entity, const DAVA::Matrix4 &transform) const
{
	DAVA::AABBox3 ret = DAVA::AABBox3(DAVA::Vector3(0, 0, 0), 0);

	if(NULL != entity)
	{
		// we will get selection bbox from collision system 
		DAVA::AABBox3 entityBox = collisionSystem->GetBoundingBox(entity);

		// add childs boxes into entity box
		for (DAVA::int32 i = 0; i < entity->GetChildrenCount(); i++)
		{
			DAVA::Entity *childEntity = entity->GetChild(i);
			DAVA::AABBox3 childBox = GetSelectionAABox(childEntity, childEntity->GetLocalTransform());

			if(entityBox.IsEmpty())
			{
				entityBox = childBox;
			}
			else
			{
				if(!childBox.IsEmpty())
				{
					entityBox.AddAABBox(childBox);
				}
			}
		}

		// we should return box with specified transformation
		if(!entityBox.IsEmpty())
		{
			entityBox.GetTransformedBox(transform, ret);
		}
	}

	return ret;
}