当前位置: 首页>>代码示例>>C++>>正文


C++ MovableObject::getMovableType方法代码示例

本文整理汇总了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;
    }
开发者ID:terakuran,项目名称:ogre,代码行数:54,代码来源:OgrePCZSceneQuery.cpp

示例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()); 
	}
}
开发者ID:mfichman,项目名称:warp,代码行数:18,代码来源:SubObject.cpp

示例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;
    }

}
开发者ID:terakuran,项目名称:ogre,代码行数:43,代码来源:OgreOctreeSceneQuery.cpp

示例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;
}
开发者ID:bb123n4,项目名称:OgreBulletDemos,代码行数:39,代码来源:OgreBulletListener.cpp

示例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;
}
开发者ID:AlfredBroda,项目名称:openmw,代码行数:36,代码来源:occlusionquery.cpp

示例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_);
}
开发者ID:mfichman,项目名称:warp,代码行数:77,代码来源:Object.cpp


注:本文中的MovableObject::getMovableType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。