本文整理汇总了C++中MovableObject::getMovableType方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject::getMovableType方法的具体用法?C++ MovableObject::getMovableType怎么用?C++ MovableObject::getMovableType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovableObject
的用法示例。
在下文中一共展示了MovableObject::getMovableType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//---------------------------------------------------------------------
void PCZPlaneBoundedVolumeListSceneQuery::execute(SceneQueryListener* listener)
{
std::set<SceneNode*> checkedSceneNodes;
PlaneBoundedVolumeList::iterator pi, piend;
piend = mVolumes.end();
for (pi = mVolumes.begin(); pi != piend; ++pi)
{
PCZSceneNodeList list;
//find the nodes that intersect the Plane bounded Volume
static_cast<PCZSceneManager*>( mParentSceneMgr ) -> findNodesIn( *pi, list, mStartZone, (PCZSceneNode*)mExcludeNode );
//grab all moveables from the node that intersect...
PCZSceneNodeList::iterator it, itend;
itend = list.end();
for (it = list.begin(); it != itend; ++it)
{
// avoid double-check same scene node
if (!checkedSceneNodes.insert(*it).second)
continue;
SceneNode::ObjectIterator oit = (*it) -> getAttachedObjectIterator();
while( oit.hasMoreElements() )
{
MovableObject * m = oit.getNext();
if( (m->getQueryFlags() & mQueryMask) &&
(m->getTypeFlags() & mQueryTypeMask) &&
m->isInScene() &&
(*pi).intersects( m->getWorldBoundingBox() ) )
{
listener -> queryResult( m );
// deal with attached objects, since they are not directly attached to nodes
if (m->getMovableType() == "Entity")
{
Entity* e = static_cast<Entity*>(m);
Entity::ChildObjectListIterator childIt = e->getAttachedObjectIterator();
while(childIt.hasMoreElements())
{
MovableObject* c = childIt.getNext();
if (c->getQueryFlags() & mQueryMask &&
(*pi).intersects( c->getWorldBoundingBox()))
{
listener->queryResult(c);
}
}
}
}
}
}
}//for
// reset startzone and exclude node
mStartZone = 0;
mExcludeNode = 0;
}
示例2:
/** Destructor */
SubObject::~SubObject() {
// Destroy all attached entities and scene nodes
unsigned short count = node_->numAttachedObjects();
for (unsigned short i = 0; i < count; i++) {
MovableObject* obj = node_->getAttachedObject(0U);
node_->detachObject((unsigned short)0);
node_->getCreator()->destroyMovableObject(obj->getName(), obj->getMovableType());
}
node_->getParentSceneNode()->removeAndDestroyChild(node_->getName());
// Remove from world if the subobject was separated off
if (body_.get()) {
body_->setUserPointer(0);
game_->getWorld()->removeCollisionObject(body_.get());
}
}
示例3: execute
/** Finds any entities that intersect the AAB for the query. */
void OctreeAxisAlignedBoxSceneQuery::execute(SceneQueryListener* listener)
{
std::list< SceneNode * > _list;
//find the nodes that intersect the AAB
static_cast<OctreeSceneManager*>( mParentSceneMgr ) -> findNodesIn( mAABB, _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->getTypeFlags() & mQueryTypeMask) &&
m->isInScene() &&
mAABB.intersects( m->getWorldBoundingBox() ) )
{
listener -> queryResult( m );
// deal with attached objects, since they are not directly attached to nodes
if (m->getMovableType() == "Entity")
{
Entity* e = static_cast<Entity*>(m);
Entity::ChildObjectListIterator childIt = e->getAttachedObjectIterator();
while(childIt.hasMoreElements())
{
MovableObject* c = childIt.getNext();
if (c->getQueryFlags() & mQueryMask)
{
listener->queryResult(c);
}
}
}
}
}
++it;
}
}
示例4: getBodyUnderCursorUsingOgre
// -------------------------------------------------------------------------
OgreBulletDynamics::RigidBody* OgreBulletListener::getBodyUnderCursorUsingOgre(Ogre::Vector3 &intersectionPoint, Ray &rayTo)
{
rayTo = mCamera->getCameraToViewportRay (mInputListener->getAbsMouseX(), mInputListener->getAbsMouseY());
mRayQuery->setRay (rayTo);
const RaySceneQueryResult& result = mRayQuery->execute();
if (!result.empty())
{
RaySceneQueryResult::const_iterator i = result.begin();
mRayQuery->setSortByDistance (true, 1);//only one hit
while((i != result.end()))
{
SceneNode *node = i->movable->getParentSceneNode() ;
#if (OGRE_VERSION >= ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0)
intersectionPoint = node->_getDerivedPosition ();
#else
intersectionPoint = node->getWorldPosition ();
#endif
const unsigned short num = node->numAttachedObjects();
MovableObject* movable;
for (unsigned short cur = 0;cur < num; cur++)
{
movable = node->getAttachedObject(cur);
if (movable->getMovableType() == OgreBulletCollisions::Object::mMovableType)
{
OgreBulletCollisions::Object *object = static_cast <OgreBulletCollisions::Object *>(movable);
OgreBulletDynamics::RigidBody *body = static_cast <OgreBulletDynamics::RigidBody *>(object);
setDebugText ("Hit :" + body->getName());
return body;
}
}
++i;
}
}// if results.
return 0;
}
示例5: isPotentialOccluder
bool OcclusionQuery::isPotentialOccluder(Ogre::SceneNode* node)
{
bool result = false;
for (unsigned int i=0; i < node->numAttachedObjects(); ++i)
{
MovableObject* ob = node->getAttachedObject(i);
std::string type = ob->getMovableType();
if (type == "Entity")
{
Entity* ent = static_cast<Entity*>(ob);
for (unsigned int j=0; j < ent->getNumSubEntities(); ++j)
{
// if any sub entity has a material with depth write off,
// consider the object as not an occluder
MaterialPtr mat = ent->getSubEntity(j)->getMaterial();
Material::TechniqueIterator techIt = mat->getTechniqueIterator();
while (techIt.hasMoreElements())
{
Technique* tech = techIt.getNext();
Technique::PassIterator passIt = tech->getPassIterator();
while (passIt.hasMoreElements())
{
Pass* pass = passIt.getNext();
if (pass->getDepthWriteEnabled() == false)
return false;
else
result = true;
}
}
}
}
}
return result;
}
示例6: check
Object::~Object() {
// Notify projectiles that the object is toast
clearAllTrackers();
//cout << "Collecting " << name_ << endl;
// Un-track
if (target_) target_->removeTracker(this);
// Clean up physics
game_->getWorld()->removeCollisionObject(body_.get());
// Destroy all subobjects
subObjects_.clear();
// Destroy objects attached to the scene node
while (node_->numAttachedObjects() > 0) {
MovableObject* obj = node_->getAttachedObject(0U);
node_->detachObject((unsigned short)0U);
node_->getCreator()->destroyMovableObject(obj->getName(), obj->getMovableType());
}
// Destroy all attached entities and scene nodes
SceneNode::ChildNodeIterator i = node_->getChildIterator();
while (i.hasMoreElements()) {
SceneNode* node = static_cast<SceneNode*>(i.getNext());
MovableObject* obj = node->getAttachedObject(0U);
node->detachObject((unsigned short)0U);
node->getCreator()->destroyMovableObject(obj->getName(), obj->getMovableType());
}
node_->removeAndDestroyAllChildren();
node_->getParentSceneNode()->removeAndDestroyChild(node_->getName());
// Clean up scripting
lua_State* env = game_->getScriptState();
StackCheck check(env);
lua_getref(env, table_);
lua_pushnil(env);
lua_setfield(env, -2, "__thiscpp");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "addEntity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setEntity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "addParticleSystem");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setParticleSystem");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "set");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "explode");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "destroy");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "target");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setPosition");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getPosition");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setVelocity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getVelocity");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setOrientation");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getOrientation");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "createMissile");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "getTarget");
lua_pushcclosure(env, &Object::luaWarningDestroyed, 0);
lua_setfield(env, -2, "setTarget");
lua_unref(env, table_);
}