本文整理汇总了C++中ogre::AxisAlignedBox::transform方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::transform方法的具体用法?C++ AxisAlignedBox::transform怎么用?C++ AxisAlignedBox::transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::AxisAlignedBox
的用法示例。
在下文中一共展示了AxisAlignedBox::transform方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MergeBounds
void MergeBounds(Ogre::SceneNode* node, Ogre::SceneNode* rootNode,
const Ogre::Matrix4& parentTransform, Ogre::AxisAlignedBox& aabb)
{
// Get this nodes current transform
Ogre::Matrix4 currentTransform = parentTransform;
if (node != rootNode)
{
Ogre::Matrix4 localTransform(node->getOrientation());
localTransform.setTrans(node->getPosition());
currentTransform = currentTransform * localTransform;
}
// Merge this nodes objects
Ogre::SceneNode::ObjectIterator object = node->getAttachedObjectIterator();
while (object.hasMoreElements())
{
Ogre::AxisAlignedBox localAABB = object.getNext()->getBoundingBox();
localAABB.transform(currentTransform);
aabb.merge(localAABB);
}
// Iterate through all children and call this function on them
Ogre::SceneNode::ChildNodeIterator child = node->getChildIterator();
while (child.hasMoreElements())
{
MergeBounds(static_cast<Ogre::SceneNode*>(child.getNext()), rootNode, currentTransform, aabb);
}
}
示例2: _calculateExtents
void InputGeometry::_calculateExtents()
{
Ogre::Entity* ent = _sourceMeshes[0];
Ogre::AxisAlignedBox sourceMeshBB = ent->getBoundingBox();
Ogre::Matrix4 transform;
transform = _referenceNode->_getFullTransform().inverse() * ent->getParentSceneNode()->_getFullTransform();
sourceMeshBB.transform(transform);
Ogre::Vector3 min = sourceMeshBB.getMinimum();
Ogre::Vector3 max = sourceMeshBB.getMaximum();
for(auto itr = _sourceMeshes.begin(); itr != _sourceMeshes.end(); ++itr)
{
Ogre::Entity* tmpEnt = *itr;
transform = _referenceNode->_getFullTransform().inverse() * tmpEnt->getParentSceneNode()->_getFullTransform();
sourceMeshBB = ent->getBoundingBox();
sourceMeshBB.transform(transform);
Ogre::Vector3 min2 = sourceMeshBB.getMinimum();
if(min2.x < min.x)
min.x = min2.x;
if(min2.y < min.y)
min.y = min2.y;
if(min2.z < min.z)
min.z = min2.z;
Ogre::Vector3 max2 = sourceMeshBB.getMaximum();
if(max2.x > max.x)
max.x = max2.x;
if(max2.y > max.y)
max.y = max2.y;
if(max2.z > max.z)
max.z = max2.z;
}
if(!_boundMin)
{
_boundMin = new float[3];
}
if(!_boundMax)
{
_boundMax = new float[3];
}
Utility::vector3_toFloatPtr(min,_boundMin);
Utility::vector3_toFloatPtr(max,_boundMax);
}
示例3: injectMouseMoved
bool Panel::injectMouseMoved(const Ogre::Ray& ray)
{
Ogre::Matrix4 transform;
transform.makeTransform(mNode->getPosition(), mNode->getScale(), mNode->getOrientation());
Ogre::AxisAlignedBox aabb = mScreenRenderable->getBoundingBox();
aabb.transform(transform);
pair<bool, Ogre::Real> result = Ogre::Math::intersects(ray, aabb);
if (result.first == false)
{
unOverAllElements();
return false;
}
Ogre::Vector3 a,b,c,d;
Ogre::Vector2 halfSize = (mSize/100) * 0.5f;
a = transform * Ogre::Vector3(-halfSize.x,-halfSize.y,0);
b = transform * Ogre::Vector3( halfSize.x,-halfSize.y,0);
c = transform * Ogre::Vector3(-halfSize.x, halfSize.y,0);
d = transform * Ogre::Vector3( halfSize.x, halfSize.y,0);
result = Ogre::Math::intersects(ray, c, b, a);
if (result.first == false)
result = Ogre::Math::intersects(ray, c, d, b);
if (result.first == false)
{
unOverAllElements();
return false;
}
if (result.second > mDistanceFromPanelToInteractWith)
{
unOverAllElements();
return false;
}
Ogre::Vector3 hitPos = (ray.getOrigin() + (ray.getDirection() * result.second));
Ogre::Vector3 localPos = transform.inverse() * hitPos;
localPos.x += halfSize.x;
localPos.y -= halfSize.y;
localPos.x *= 100;
localPos.y *= 100;
// Cursor clip
localPos.x = Ogre::Math::Clamp<Ogre::Real>(localPos.x, 0, mSize.x - 10);
localPos.y = Ogre::Math::Clamp<Ogre::Real>(-localPos.y, 0, mSize.y - 18);
mInternalMousePos = Ogre::Vector2(localPos.x, localPos.y);
mMousePointer->position(mInternalMousePos);
// Let's actualize the "over" for each elements
for (size_t i=0; i < mPanelElements.size(); i++)
mPanelElements[i]->isOver(mInternalMousePos);
return true;
}
示例4: canSee
bool DefaultCameraManager::canSee(RenderedObject* obj)
{
Ogre::AxisAlignedBox aabb = obj->getEntity()->getBoundingBox();
Ogre::Matrix4 mat4 = Ogre::Matrix4::IDENTITY;
mat4.setTrans(obj->getPosition());
aabb.transform(mat4);
return mCamera->isVisible(aabb);
//Ogre::AxisAlignedBox aabb = obj->
//if(mCamera->isVisible(
}
示例5: check
Button* check(const Ogre::Ray& ray, bool& isOver)
{
isOver = false;
Ogre::Matrix4 transform;
transform.makeTransform(mNode->getPosition(), mNode->getScale(), mNode->getOrientation());
Ogre::AxisAlignedBox aabb = mScreen->getBoundingBox();
aabb.transform(transform);
std::pair<bool, Ogre::Real> result = Ogre::Math::intersects(ray, aabb);
if (result.first == false)
return 0;
Ogre::Vector3 a,b,c,d;
Ogre::Vector2 halfSize = mSize * 0.5f;
a = transform * Ogre::Vector3(-halfSize.x,-halfSize.y,0);
b = transform * Ogre::Vector3( halfSize.x,-halfSize.y,0);
c = transform * Ogre::Vector3(-halfSize.x, halfSize.y,0);
d = transform * Ogre::Vector3( halfSize.x, halfSize.y,0);
result = Ogre::Math::intersects(ray, c, b, a);
if (result.first == false)
result = Ogre::Math::intersects(ray, c, d, b);
if (result.first == false)
return 0;
if (result.second > 6.0f)
return 0;
isOver = true;
Ogre::Vector3 hitPos = ( ray.getOrigin() + (ray.getDirection() * result.second) );
Ogre::Vector3 localPos = transform.inverse() * hitPos;
localPos.x += halfSize.x;
localPos.y -= halfSize.y;
localPos.x *= 100;
localPos.y *= 100;
// Cursor clip
localPos.x = Ogre::Math::Clamp<Ogre::Real>(localPos.x, 0, (mSize.x * 100) - 10);
localPos.y = Ogre::Math::Clamp<Ogre::Real>(-localPos.y, 0, (mSize.y * 100) - 18);
mMousePointer->position(localPos.x, localPos.y);
for (size_t i=0;i < mButtons.size();i++)
{
if (mButtons[i]->isOver(mMousePointer->position()))
return mButtons[i];
}
return 0;
}
示例6: GetBoundingBox
Ogre::AxisAlignedBox AACamera::GetBoundingBox(bool transformed) const
{
Ogre::AxisAlignedBox box = Box;
if (!transformed)
return box;
Ogre::Matrix4 transforms;
//Node->getWorldTransforms(&transforms);
transforms.makeTransform(Node->getPosition(),Node->getScale(),Node->getOrientation());
box.transform(transforms);
return box;
}
示例7: _convertOgreEntities
void InputGeometry::_convertOgreEntities(const Ogre::AxisAlignedBox& tileBounds)
{
std::vector<Ogre::Entity*> selectedEntities;
Ogre::AxisAlignedBox boundingBox;
Ogre::Matrix4 transform;
for(auto itr = _sourceMeshes.begin(); itr != _sourceMeshes.end(); ++itr)
{
transform = _referenceNode->_getFullTransform().inverse() * (*itr)->getParentSceneNode()->_getFullTransform();
boundingBox = (*itr)->getBoundingBox();
boundingBox.transform(transform);
if(boundingBox.intersects(tileBounds))
{
selectedEntities.push_back(*itr);
}
}
_sourceMeshes.clear();
_sourceMeshes = selectedEntities;
_convertOgreEntities();
}