本文整理汇总了C++中MovableObject类的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject类的具体用法?C++ MovableObject怎么用?C++ MovableObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MovableObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//---------------------------------------------------------------------
void DefaultAxisAlignedBoxSceneQuery::execute(SceneQueryListener* listener)
{
// Iterate over all movable types
Root::MovableObjectFactoryIterator factIt =
Root::getSingleton().getMovableObjectFactoryIterator();
while(factIt.hasMoreElements())
{
SceneManager::MovableObjectIterator objItA =
mParentSceneMgr->getMovableObjectIterator(
factIt.getNext()->getType());
while (objItA.hasMoreElements())
{
MovableObject* a = objItA.getNext();
// skip whole group if type doesn't match
if (!(a->getTypeFlags() & mQueryTypeMask))
break;
if ((a->getQueryFlags() & mQueryMask) &&
a->isInScene() &&
mAABB.intersects(a->getWorldBoundingBox()))
{
if (!listener->queryResult(a)) return;
}
}
}
}
示例2: while
//---------------------------------------------------------------------
void PagingLandScapeOctreePlaneBoundedVolumeListSceneQuery::execute( SceneQueryListener* listener )
{
PlaneBoundedVolumeList::iterator pi, piend;
piend = mVolumes.end( );
for ( pi = mVolumes.begin( ); pi != piend; ++pi )
{
std::list < SceneNode* > list;
//find the nodes that intersect the AAB
static_cast< PagingLandScapeOctreeSceneManager* >( mParentSceneMgr )->findNodesIn( *pi, list, 0 );
//grab all moveables from the node that intersect...
std::list < SceneNode* >::iterator it = list.begin( );
while ( it != list.end( ) )
{
SceneNode::ObjectIterator oit = ( *it )->getAttachedObjectIterator( );
while ( oit.hasMoreElements( ) )
{
MovableObject* m = oit.getNext( );
if ( ( m->getQueryFlags( ) & mQueryMask ) && m->isInScene( ) && ( *pi ).intersects( m->getWorldBoundingBox( ) ) )
{
listener->queryResult( m );
}
}
++it;
}
}
}
示例3: detachObject
MovableObject* SceneNode::detachObject(unsigned short index)
{
MovableObject* ret;
if (index < sceneObjects_.size())
{
ObjectMap::iterator i = sceneObjects_.begin();
// Increment (must do this one at a time)
while (index--)++i;
ret = i->second;
sceneObjects_.erase(i);
ret->notifyAttached((SceneNode*)0);
// Make sure bounds get updated (must go right to the top)
notifyUpdate( BoundsChangedBit );
return ret;
}
else
{
SML_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Object index out of bounds.");
}
return 0;
}
示例4: detachObject
//-----------------------------------------------------------------------
MovableObject* SceneNode::detachObject(unsigned short index)
{
MovableObject* ret;
if (index < mObjectsByName.size())
{
ObjectMap::iterator i = mObjectsByName.begin();
// Increment (must do this one at a time)
while (index--)++i;
ret = i->second;
mObjectsByName.erase(i);
ret->_notifyAttached((SceneNode*)0);
// Make sure bounds get updated (must go right to the top)
needUpdate();
return ret;
}
else
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Object index out of bounds.", "SceneNode::getAttchedEntity");
}
}
示例5: while
//---------------------------------------------------------------------
void PagingLandScapeOctreeRaySceneQuery::execute( RaySceneQueryListener* listener )
{
std::list < SceneNode* > list;
//find the nodes that intersect the AAB
static_cast< PagingLandScapeOctreeSceneManager* >( mParentSceneMgr )->findNodesIn( mRay, list, 0 );
//grab all movables from the node that intersect...
std::list < SceneNode* >::iterator it = list.begin( );
while ( it != list.end( ) )
{
SceneNode::ObjectIterator oit = ( *it )->getAttachedObjectIterator( );
while ( oit.hasMoreElements( ) )
{
MovableObject* m = oit.getNext( );
if ( ( m->getQueryFlags( ) & mQueryMask ) && m->isInScene( ) )
{
std::pair< bool, Real > result = mRay.intersects( m->getWorldBoundingBox( ) );
if ( result.first )
{
listener->queryResult( m, result.second );
}
}
}
++it;
}
}
示例6: float
Ogre::String ObjectControl::mousePressed(QPoint lastPos,float w,float h)
{
using namespace Ogre;
float RatioX = float(lastPos.x())/w;
float RatioY = float(lastPos.y())/h;
MovableObject* nodeM = getNode(RatioX,RatioY);
if( nodeM != NULL )
{
String name = nodeM->getParentSceneNode()->getName();
if ( name == "move_widget_x" )
{
Vector3 objPos = Vector3(node->_getWorldAABB().getCenter());
planeXNode->setPosition(objPos);
planeYNode->setPosition(objPos);
planeZNode->setPosition(objPos);
currntOperation=MoveX;
}
else if ( name == "move_widget_y" )
{
Vector3 objPos = Vector3(node->_getWorldAABB().getCenter());
planeXNode->setPosition(objPos);
planeYNode->setPosition(objPos);
planeZNode->setPosition(objPos);
currntOperation=MoveY;
}
else if ( name == "move_widget_z" )
{
Vector3 objPos = Vector3(node->_getWorldAABB().getCenter());
planeXNode->setPosition(objPos);
planeYNode->setPosition(objPos);
planeZNode->setPosition(objPos);
currntOperation=MoveZ;
}
else if ( name == "rotate_widget_x" ) currntOperation = RotateX;
else if ( name == "rotate_widget_y" ) currntOperation = RotateY;
else if ( name == "rotate_widget_z" ) currntOperation = RotateZ;
else if ( name == "scale_widget_x" ) currntOperation = ScaleX;
else if ( name == "scale_widget_y" ) currntOperation = ScaleY;
else if ( name == "scale_widget_z" ) currntOperation = ScaleZ;
else if ( name == "scale_widget_xyz" ) currntOperation = ScaleXYZ;
else
{
if (currentMode==Move_Mode ) selectObjectForEdit(name.c_str(),"move_widget" );
else if (currentMode==Rotate_Mode) selectObjectForEdit(name.c_str(),"rotate_widget");
else if (currentMode==Scale_Mode ) selectObjectForEdit(name.c_str(),"scale_widget" );
}
return name;
}
else
{
reset();
return "";
}
}
示例7: createInstanceImpl
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
MovableObject* MovableObjectFactory::createInstance(
const String& name, SceneManager* manager,
const NameValuePairList* params)
{
MovableObject* m = createInstanceImpl(name, params);
m->_notifyCreator(this);
m->_notifyManager(manager);
return m;
}
示例8: _applyCollision
//-------------------------------------------------------------------------
void World::_applyCollision(void)
{
// Collision detection
IntersectionSceneQueryResult& results = mIntersectionQuery->execute();
// Movables to Movables
SceneQueryMovableIntersectionList::iterator it, itend;
itend = results.movables2movables.end();
for (it = results.movables2movables.begin(); it != itend; ++it)
{
/* debugging
MovableObject *mo1, *mo2;
mo1 = it->first;
mo2 = it->second;
*/
// Get user defined objects (generic in OGRE)
UserDefinedObject *uo1, *uo2;
uo1 = it->first->getUserObject();
uo2 = it->second->getUserObject();
// Only perform collision if we have UserDefinedObject links
if (uo1 && uo2)
{
// Cast to ApplicationObject
ApplicationObject *ao1, *ao2;
ao1 = static_cast<ApplicationObject*>(uo1);
ao2 = static_cast<ApplicationObject*>(uo2);
// Do detailed collision test
ao1->testCollide(ao2);
}
}
// Movables to World
SceneQueryMovableWorldFragmentIntersectionList::iterator wit, witend;
witend = results.movables2world.end();
for (wit = results.movables2world.begin(); wit != witend; ++wit)
{
MovableObject *mo = wit->first;
SceneQuery::WorldFragment *wf = wit->second;
// Get user defined objects (generic in OGRE)
UserDefinedObject *uo = mo->getUserObject();
// Only perform collision if we have UserDefinedObject link
if (uo)
{
// Cast to ApplicationObject
ApplicationObject *ao = static_cast<ApplicationObject*>(uo);
// Do detailed collision test
ao->testCollide(wf);
}
}
}
示例9: getParentOrientation
//-----------------------------------------------------------------------
void SceneNode::updateFromParent()
{
if ( hasParent() )
{
// Set level
//level_ = getParent()->getLevel() + 1;
derivedOrientation_ = getParentOrientation() * orientation_;
/*if ( queryFlag( SceneNode::OrientationInheritedBit ) ) {
// Combine orientation with that of parent
derivedOrientation_ = getParentOrientation() * orientation_;
} else {
// No inheritance
derivedOrientation_ = orientation_;
}*/
//derivedScale_ = parentScale * scale_;
derivedScale_ = getParentScale();
// Update scale
/*if ( queryFlag( SceneNode::ScaleInheritedBit ) ) {
// Scale own position by parent scale, NB just combine
// as equivalent axes, no shearing
//derivedScale_ = parentScale * scale_;
derivedScale_ = getParentScale();
} else {
// No inheritance
derivedScale_ = scale_;
}*/
// Change position vector based on parent's orientation & scale
//derivedPosition_ = parentOrientation * (parentScale_ * position_);
derivedPosition_ = getParentOrientation() * position_;
// Add altered position vector to parents
derivedPosition_ += getParentPosition();
} else {
level_ = 0;
// Root node, no parent
derivedOrientation_ = orientation_;
derivedPosition_ = position_;
derivedScale_ = scale_;
}
validWorldTransform_ = true;
// Notify objects that it has been moved
ObjectMap::const_iterator i;
for (i = sceneObjects_.begin(); i != sceneObjects_.end(); ++i)
{
MovableObject* object = i->second;
object->notifyMoved();
}
}
示例10: detachAllObjects
//-----------------------------------------------------------------------
void SceneNode::detachAllObjects(void)
{
ObjectMap::iterator itr;
for ( itr = mObjectsByName.begin(); itr != mObjectsByName.end(); ++itr )
{
MovableObject* ret = itr->second;
ret->_notifyAttached((SceneNode*)0);
}
mObjectsByName.clear();
// Make sure bounds get updated (must go right to the top)
needUpdate();
}
示例11: updateFromParentImpl
//-----------------------------------------------------------------------
void SceneNode::updateFromParentImpl(void) const
{
Node::updateFromParentImpl();
// Notify objects that it has been moved
ObjectMap::const_iterator i;
for (i = mObjectsByName.begin(); i != mObjectsByName.end(); ++i)
{
MovableObject* object = i->second;
object->_notifyMoved();
}
}
示例12: detachObject
void SceneNode::detachObject( MovableObject & object )
{
auto it = std::find_if( m_objects.begin(), m_objects.end(), [&object]( std::reference_wrapper< MovableObject > obj )
{
return obj.get().getName() == object.getName();
} );
if ( it != m_objects.end() )
{
m_objects.erase( it );
object.attachTo( nullptr );
}
}
示例13: detachAllObjects
void SceneNode::detachAllObjects(void)
{
ObjectMap::iterator itr;
MovableObject* ret;
for ( itr = sceneObjects_.begin(); itr != sceneObjects_.end(); itr++ )
{
ret = itr->second;
ret->notifyAttached((SceneNode*)0);
}
sceneObjects_.clear();
// Make sure bounds get updated (must go right to the top)
notifyUpdate( BoundsChangedBit );
}
示例14:
//-----------------------------------------------------------------------
SceneNode::~SceneNode()
{
// Detach all objects, do this manually to avoid needUpdate() call
// which can fail because of deleted items
ObjectMap::iterator itr;
for ( itr = mObjectsByName.begin(); itr != mObjectsByName.end(); ++itr )
{
MovableObject* ret = itr->second;
ret->_notifyAttached((SceneNode*)0);
}
mObjectsByName.clear();
OGRE_DELETE mWireBoundingBox;
}
示例15: SML_EXCEPT
MovableObject* SceneNode::detachObject(const std::string& name)
{
ObjectMap::iterator it = sceneObjects_.find(name);
if (it == sceneObjects_.end())
{
SML_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Object " + name + " is not attached to this node.");
}
MovableObject* ret = it->second;
sceneObjects_.erase(it);
ret->notifyAttached((SceneNode*)0);
// Make sure bounds get updated (must go right to the top)
notifyUpdate( BoundsChangedBit );
return ret;
}