Пример #1
0
void SelectionHandler::createBox(const std::pair<CollObjectHandle, uint64_t>& handles, const Ogre::AxisAlignedBox& aabb, const std::string& material_name)
{
  Ogre::WireBoundingBox* box = 0;
  Ogre::SceneNode* node = 0;

  M_HandleToBox::iterator it = boxes_.find(handles);
  if (it == boxes_.end())
  {
    Ogre::SceneManager* scene_manager = context_->getSceneManager();
    node = scene_manager->getRootSceneNode()->createChildSceneNode();
    box = new Ogre::WireBoundingBox;

    bool inserted = boxes_.insert(std::make_pair(handles, std::make_pair(node, box))).second;
    ROS_ASSERT(inserted);
  }
  else
  {
    node = it->second.first;
    box = it->second.second;
  }

  box->setMaterial(material_name);

  box->setupBoundingBox(aabb);
  node->detachAllObjects();
  node->attachObject(box);
}
Пример #2
0
void ManipulatorObject::_UpdateAABBOfEntity( Ogre::Entity* pEntity )
{
	assert(pEntity);

	Ogre::SceneNode* aabbNode = dynamic_cast<Ogre::SceneNode*>(
		pEntity->getParentSceneNode()->getChild(pEntity->getName()));
	Ogre::WireBoundingBox* pAABB = GetEntityAABBGizmo(pEntity);
	pAABB->setupBoundingBox(pEntity->getWorldBoundingBox(true));
	//避免被裁减
	(const_cast<Ogre::AxisAlignedBox&>(pAABB->getBoundingBox())).setInfinite();
	aabbNode->_updateBounds();
}
Пример #3
0
void GameObject::showColliderBox() {
	auto var = geom->getBoundingBox();

	// Bullet uses half margins for collider
	auto size = var.getSize() / 2;

	btVector3 min(0, 0, 0);
	btVector3 max(0, 0, 0);
	shape->getAabb(tr, min, max);
	Ogre::WireBoundingBox* box = new Ogre::WireBoundingBox();
	Ogre::AxisAlignedBox abb(Ogre::Vector3(-size.x*scale, -size.y*scale, -size.z*scale), Ogre::Vector3(size.x*scale, size.y*scale, size.z*scale));
	box->setupBoundingBox(abb);
	box->setVisible(true);
	box->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY);
	sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(box);
}