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


C++ SceneManager::createEntity方法代码示例

本文整理汇总了C++中ogre::SceneManager::createEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneManager::createEntity方法的具体用法?C++ SceneManager::createEntity怎么用?C++ SceneManager::createEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::SceneManager的用法示例。


在下文中一共展示了SceneManager::createEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createBackGround

/*
 * Create a fake Plane for Drag and Drop
 */   
void MyFrameListener::createBackGround() {
  Ogre::SceneManager* mSceneMgr = Ogre::Root::getSingleton().
                                  getSceneManager("mainSM");
  Ogre::Plane *mPlane = new Ogre::Plane(Ogre::Vector3::UNIT_Z, -2);

  Ogre::MeshManager::getSingleton().createPlane("backPlane",
                                                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                                                *mPlane,800, 800, 20, 20, true, 1, 5, 5
                                                , Ogre::Vector3::UNIT_Y);
  Ogre::Entity* plane = mSceneMgr->createEntity("backPlane");
  plane->setQueryFlags(PLANE_DRAG_DROP);
  plane->setMaterialName("sheet");
  Ogre::Root::getSingleton().
      getSceneManager("mainSM")->getRootSceneNode()->
      attachObject(plane);
}
开发者ID:flush,项目名称:CEDV-2015,代码行数:19,代码来源:MyFrameListener.cpp

示例2: mDebugNode

EntityWorldPickListenerVisualizer::EntityWorldPickListenerVisualizer(EntityWorldPickListener& pickListener, Ogre::SceneManager& sceneManager) :
		mEntity(0), mDebugNode(0)
{
	mDebugNode = sceneManager.getRootSceneNode()->createChildSceneNode();
	try {
		mEntity = sceneManager.createEntity("pickerDebugObject", "common/primitives/model/sphere.mesh");
		//start out with a normal material
		mEntity->setMaterialName("BasePointMarkerMaterial");
		mEntity->setRenderingDistance(300);
		mEntity->setQueryFlags(MousePicker::CM_NONPICKABLE);
		mDebugNode->attachObject(mEntity);
	} catch (const std::exception& ex) {
		S_LOG_WARNING("Error when creating picking visualizer." << ex);
	}

	pickListener.EventPickedEntity.connect(sigc::mem_fun(*this, &EntityWorldPickListenerVisualizer::picker_EventPickedEntity));
}
开发者ID:Chimangoo,项目名称:ember,代码行数:17,代码来源:EntityWorldPickListener.cpp

示例3: createOgreWheel

OgreWheel* OgreWheel::createOgreWheel(Ogre::SceneNode* parNode, Ogre::Vector3 pos)
{
	if (parNode)
	{
		OgreWheel* wheel = new OgreWheel();
		wheel->mParNode = parNode;
		wheel->mNode = wheel->mParNode->createChildSceneNode("Wheel" + Ogre::StringConverter::toString(++mWheelCount));
		Ogre::SceneManager* smgr = wheel->mParNode->getCreator();

		Ogre::Entity* eBody = smgr->createEntity("eBodyWheel" + Ogre::StringConverter::toString(mWheelCount), OGRE_WHEEL_FILE);
		wheel->mNode->attachObject(eBody);

		wheel->mNode->setPosition(pos/0.0006);
		return wheel;
	}
	return NULL;
}
开发者ID:landys,项目名称:cute-car,代码行数:17,代码来源:OgreAllVehicle.cpp

示例4: createEntity

	//-----------------------------------------------------------------------
	void SceneDecoratorExtern::createEntity(void)
	{
		if (!mEntity)
		{
			Ogre::SceneManager* sceneManager = mParentTechnique->getParentSystem()->getSceneManager();
			if (sceneManager)
			{
				std::stringstream ss;
				ss << this;
				mEntityName = mMeshName + ss.str();
				mEntity = sceneManager->createEntity(mEntityName, mMeshName);
				if (mMaterialNameSet)
				{
					mEntity->setMaterialName(mMaterialName);
				}
			}
		}
	}
开发者ID:fusion44,项目名称:particleuniverse,代码行数:19,代码来源:ParticleUniverseSceneDecoratorExtern.cpp

示例5:

CollisionModel3D *EditorFrameHandler::GetCollisionModel(const char *modelname)
{	
	CollisionModel3D *hashres=NULL, *CollisionModel = NULL;
	bool bres = CollisionModels.Find(modelname, &hashres);

    if (!bres)
    {
        CollisionModel = newCollisionModel3D(false);

        size_t vertex_count,index_count;
        Ogre::Vector3* vertices;
        unsigned long* indices;

        Ogre::SceneManager *SceneMgr = CommonDeclarations::GetSceneManager();

        Ogre::Entity *entity = SceneMgr->createEntity("tmpcollis", modelname);

		Collidable::getMeshInformation(entity->getMesh().getPointer(),vertex_count,vertices,index_count,indices,Ogre::Vector3(0,0,0),Ogre::Quaternion::IDENTITY,Ogre::Vector3(1,1,1));

        SceneMgr->destroyEntity(entity);

        size_t index;
        int numTris = (int)index_count / 3;
        CollisionModel->setTriangleNumber(numTris);
        for (unsigned i=0;i<index_count;i+=3)
        {
            index = indices[i];
            CollisionModel->addTriangle(vertices[indices[i+0]].x,vertices[indices[i+0]].y,vertices[indices[i+0]].z,
                vertices[indices[i+1]].x,vertices[indices[i+1]].y,vertices[indices[i+1]].z,
                vertices[indices[i+2]].x,vertices[indices[i+2]].y,vertices[indices[i+2]].z);
        }
        CollisionModel->finalize();

        delete[] vertices;
        delete[] indices;

		CollisionModels.Insert(modelname,CollisionModel);

    } else
    {
        CollisionModel = hashres;
    }
	return CollisionModel;
}
开发者ID:beorc,项目名称:flare_star,代码行数:44,代码来源:EditorFrameHandler.cpp

示例6: CWorldEntity

CObject::CObject(const std::string &id, CWorldEntity *pParent, CMap *pMap, EObjectTypes eObjectType, Ogre::SceneNode *pSceneNode)
  : CWorldEntity(id, pParent, pMap),
    m_ObjectTypeData(OBJECT_TYPE_ID_MAP.toData(eObjectType)) {

  setType(eObjectType);

  if (pSceneNode) {
    m_pSceneNode = pSceneNode;
  }
  else {
    m_pSceneNode = pParent->getSceneNode()->createChildSceneNode(id);
  }
  
  Ogre::SceneManager *pSceneManager = m_pSceneNode->getCreator();

  Ogre::Entity *pEntity(nullptr);

  // create entity
  if (m_ObjectTypeData.bPermanetStatic) {
    m_pMap->addStaticEntity(m_ObjectTypeData.sMeshName + ".mesh", m_pSceneNode->getPosition(), m_pSceneNode->getOrientation());
    setCurAndMaxHP(HP_INFINITY);
  }
  else {
    pEntity = pSceneManager->createEntity(id + "ent", m_ObjectTypeData.sMeshName + ".mesh", "World");
    pEntity->setMaterialName(m_ObjectTypeData.sMaterialName);
    m_pSceneNode->attachObject(pEntity);
    pEntity->setCastShadows(false);
  }

  createPhysics();

  switch (m_uiType) {
  case OBJECT_GREEN_RUPEE:
  case OBJECT_BLUE_RUPEE:
  case OBJECT_RED_RUPEE:
    makePickable();
    break;

  default:
    break;
  }

}
开发者ID:ChWick,项目名称:Zelda,代码行数:43,代码来源:Object.cpp

示例7: updatePositions

void GraphicsImpl::updatePositions()
{
	{
		boost::mutex::scoped_lock lock(modifyNodesMutex);

		while (!nodesToAdd.empty()) {
			addNode(nodesToAdd.back());
			nodesToAdd.pop_back();
		}

		while (!nodesToRemove.empty()) {
			removeNode(nodesToRemove.back());
			nodesToRemove.pop_back();
		}

		while (!terrainToCreate.empty()) {
			Terrain terrain = terrainToCreate.back();

			Ogre::Entity* ent;
			Ogre::SceneNode* node;
			Dout << "Creating terrain with specification: " + terrain.specification;
			ent = sceneMgr->createEntity(ObjectRegistry::Instance().getNameForID(terrain.node.ID) + boost::lexical_cast<std::string>(terrain.node.ID), terrain.specification);

			node = sceneMgr->getRootSceneNode()->createChildSceneNode();
			node->attachObject(ent);
			node->setPosition(terrain.node.pos);
			ent->setMaterialName("Simple/BeachStones");
			node->setOrientation(terrain.node.orient);
			node->setScale(terrain.scale);
			nodes[terrain.node.ID] = node;

			terrainToCreate.pop_back();

		}
	}

	if (!frontWorld->nodes.empty()) {
		for (std::vector< OgreNewt::Node* >::iterator iter = frontWorld->nodes.begin(); iter != frontWorld->nodes.end(); ++iter) {
			nodes[(*iter)->ID]->setOrientation((*iter)->orient);
			nodes[(*iter)->ID]->setPosition((*iter)->pos);
		}
	}
}
开发者ID:Mononofu,项目名称:OTE,代码行数:43,代码来源:graphics.cpp

示例8: ReadEntity

void FvXMLAnimationModelSerializerImpl::ReadEntity( 
	FvXMLSectionPtr spSection, Ogre::SceneNode* pkNode, FvAnimationModel* pkDest )
{
	Ogre::SceneManager *pkSceneManager = Ogre::Root::getSingleton().
		_getCurrentSceneManager();
	FV_ASSERT(pkSceneManager);

	FvString kMeshIdentifier = spSection->ReadString("identifier");
	FvString kMeshFile = spSection->ReadString("mesh");

	Ogre::Entity *pkEntity = pkSceneManager->createEntity(
		pkNode->getName() + "_" + kMeshIdentifier,kMeshFile);
	FV_ASSERT(pkEntity);
	pkEntity->setCastShadows(pkDest->m_bCastShadows);
	pkNode->attachObject(pkEntity);
	
	pkDest->m_akNodes[pkDest->m_u32CurrentLodLevel].m_kEntityList.push_back(pkEntity);
	pkEntity->setRenderQueueGroup(RENDER_QUEUE_MAX);
	AnimationStateSet *pkAnimations = pkEntity->getAllAnimationStates();
	if(pkAnimations)
	{
		AnimationStateIterator kIt = pkAnimations->getAnimationStateIterator();
		while (kIt.hasMoreElements())
		{
			AnimationState *pkAnim= kIt.getNext();
			if(pkDest->GetAnimation(pkAnim->getAnimationName()) == NULL)
				pkDest->m_kModelAnimations.insert(std::make_pair(pkAnim->getAnimationName(),pkAnim));
		}
	}

	std::vector<FvXMLSectionPtr> kSubentities;
	spSection->OpenSections("subentities/subentity",kSubentities);
	std::vector<FvXMLSectionPtr>::iterator kSubIt = kSubentities.begin();
	for(; kSubIt != kSubentities.end(); ++kSubIt)
	{
		int iIndex = (*kSubIt)->ReadInt("index",-1);
		FvString kMaterialName = (*kSubIt)->ReadString("materialName");
		Ogre::SubEntity *pkSubEntity = pkEntity->getSubEntity(iIndex);
		if(pkSubEntity && !kMaterialName.empty())
			pkSubEntity->setMaterialName(kMaterialName);
	}
}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:42,代码来源:FvAnimationModelSerializer.cpp

示例9: OgreContainer

//!
//! Create new scene.
//! \return True if the scene was successfully created, otherwise False.
//!
bool Model2SceneNode::createEntity(QString name, QString fileName)
{
    // destroy the entity through its scene manager
    Ogre::SceneManager *sceneManager = OgreManager::getSceneManager();
    // create a new OGRE entity for each vertex
    m_entity = sceneManager->createEntity(name.toStdString(), fileName.toStdString());
    if (m_entity) {
        // set cumulative blend mode instead of Ogre::ANIMBLEND_AVERAGE which is default
        if (m_entity->hasSkeleton()) {
            Ogre::Skeleton *skeleton = m_entity->getSkeleton();
            skeleton->setBlendMode(Ogre::ANIMBLEND_CUMULATIVE);
        }
    }

    // create a container for the entity
    m_entityContainer = new OgreContainer(m_entity);
    m_entity->setUserAny(Ogre::Any(m_entityContainer));

	return true;
}
开发者ID:banduladh,项目名称:levelfour,代码行数:24,代码来源:Model2SceneNode.cpp

示例10: modifyMesh

    //-----------------------------------------------------------------------
	void MeshParticleVisualData::modifyMesh(const String &meshName)
	{
		// destroy old entity
		assert(mEntity);

		Ogre::SceneNode* parent = mEntity->getParentSceneNode();
		assert(parent);
		Ogre::SceneManager* creator = parent->getCreator();
		assert(creator);

		parent->detachObject(mEntity->getName());
		creator->destroyMovableObject(mEntity);

		mEntity = NULL;

		// create new entity
		mEntity = creator->createEntity( mSceneNode->getName(), meshName );
		assert (mEntity);

		mSceneNode->attachObject(mEntity);
	}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:22,代码来源:OgreMeshParticleVisualData.cpp

示例11: createBlock

Entity Factory::createBlock(entityx::ptr<entityx::EntityManager> entityMgr, int x, int y, int z, std::string material)
{
    Entity block = entityMgr->create();
    Ogre::SceneManager* sceneMgr = RenderManager::getPtr()->getSceneManager();
    Ogre::Entity* wall = sceneMgr->createEntity("Cube.mesh");
    wall->setMaterialName(material);
    Ogre::SceneNode* wallNode = sceneMgr->getRootSceneNode()->createChildSceneNode();

    wallNode->attachObject(wall);

    block.assign<Position>(x,y,z);
    wallNode->setPosition(x,y,z);
    block.assign<Orientation>(wallNode->getOrientation());
    block.assign<Renderable>(wallNode);
    block.assign<Name>("Block");
    if(material == "Wall"){
        block.assign<Destroyable>(200);
    }

    return block;
}
开发者ID:whztt07,项目名称:BattleCity2014,代码行数:21,代码来源:Factory.cpp

示例12: createProjectile

entityx::Entity Factory::createProjectile(entityx::ptr<EntityManager> where, Ogre::Vector3 pos, Ogre::Quaternion ori, Ogre::Real velocity, std::string materialName)
{
    Ogre::Entity *projMesh;
    Ogre::SceneManager *sceneMgr = RenderManager::getPtr()->getSceneManager();

    projMesh = sceneMgr->createEntity("ProjectileMesh.mesh");
    projMesh->setMaterialName(materialName);

    Entity proj = where->create();

    Ogre::SceneNode *projNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
    projNode->attachObject(projMesh);

    Ogre::Light *light = sceneMgr->createLight();
    if(materialName == "RedLaser")
        light->setDiffuseColour(Ogre::ColourValue(.8, .2, .2));
    else
        light->setDiffuseColour(Ogre::ColourValue(.2, .2, .8));

    light->setType(Ogre::Light::LT_POINT);
    projNode->attachObject(light);



    projNode->setPosition(pos);
    projNode->setOrientation(ori);

    //projNode->translate(0, 0, -2, Ogre::SceneNode::TS_LOCAL);

    proj.assign<Position>(projNode->getPosition());
    proj.assign<Orientation>(ori);

    proj.assign<Velocity>(0, 0, velocity);
    proj.component<Velocity>()->direction.z = -1;
    proj.assign<Renderable>(projNode);
    proj.assign<AngularVelocity>(0, 0, 10);
    proj.assign<Name>("proiettile");
    proj.assign<LightComponent>(light);
    return proj;
}
开发者ID:whztt07,项目名称:BattleCity2014,代码行数:40,代码来源:Factory.cpp

示例13: _onEnd

    void SoundEditAction::_onEnd(const Point& pt, bool canceled)
    {
        if (!canceled)
        {
            Ogre::Vector3 normal;
            if (mSceneManipulator->getTerrainIntersects(pt, mCreatePos, &normal, true) && mSoundMovingEntity && mSoundNode)
            {
                // Permanent it to final scene
                mSceneManipulator->_fireUIChanged(static_cast<void*>(&mCreatePos), UIC_SOUNDEDIT);

                Ogre::SceneManager* sceneManager = mSceneManipulator->getSceneManager();

                Ogre::Entity* entity = sceneManager->createEntity("SoundEntity" + Ogre::StringConverter::toString(mNextNameIndex++), "axes.mesh");

                mSoundNode->createChildSceneNode()->attachObject(entity);

                entity->getParentSceneNode()->setPosition(mCreatePos);
                entity->getParentSceneNode()->setScale(10,10,10);
                mSoundEntities.push_back(entity);
            }
        }
    }
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:22,代码来源:SoundEditAction.cpp

示例14: fallInertia

LagomPlayerBase::LagomPlayerBase(GameState* state) : 
	LagomUnitImp<LagomPlayerBase>(*state,Vector3(0.0f, getIntFactory().GroundOffset, 0.0f)),
	_selectedActorFactory(_actorFactories.end()),
	_constructionObject(nullptr),
	_hoverConstructing(false),
	_draggingConstruction(false),
	_buildCooldown(0.0f),
	_buildCooldownMax(1.0f),
	_factoryHighlightRemaining(0.0f)
{

	Ogre::SceneManager* manager = state->GetSceneManager();
	_sceneNode = manager->createSceneNode(getIntFactory().Name);
	_mainEntity = manager->createEntity(getIntFactory().Name,getIntFactory().Mesh);
    _mainEntity->setMaterialName(getIntFactory().Material);
	_materialInstance = _mainEntity->getSubEntity(0);
    _sceneNode->attachObject(_mainEntity);
    _sceneNode->setPosition(_location);
	_sceneNode->setScale(GetFactory()->MeshScale);

	_btCollisionShape = new (alignedMalloc<btCylinderShape>()) btCylinderShape(btVector3(getIntFactory().CollisionRange,getIntFactory().GroundOffset,getIntFactory().CollisionRange));
	_btDefaultMotionState = new (alignedMalloc<btDefaultMotionState>())
		btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0.0f,getIntFactory().GroundOffset,0.0f)));

	btScalar mass = 0.0f;
    btVector3 fallInertia(0,0,0);
    _btCollisionShape->calculateLocalInertia(mass,fallInertia);

	btRigidBody::btRigidBodyConstructionInfo rigidBodyCI(mass,_btDefaultMotionState,_btCollisionShape,fallInertia);

	_btRigidBody = new (alignedMalloc<btRigidBody>()) btRigidBody(rigidBodyCI);
	assert((int)_btRigidBody % 16 == 0);
	_btRigidBody->setActivationState(DISABLE_DEACTIVATION);
	_health = getIntFactory().Health;

	RestrictConstruction();

	RegisterInput();
}
开发者ID:jaschmid,项目名称:Lagom,代码行数:39,代码来源:lagom_player_base.cpp

示例15: createObject

void PlayerObject::createObject(Ogre::SceneManager &sceneMgr, Ogre::Camera *camera) {
    objectNode = sceneMgr.getRootSceneNode()->createChildSceneNode("PlayerNode");
    objectEntity = sceneMgr.createEntity("Player", "ninja.mesh");
    objectEntity->setCastShadows(true);

    objectNode->scale(0.025f, 0.025f, 0.025f);
    objectNode->attachObject(objectEntity);
    objectNode->setPosition(position);

    mDirection = Ogre::Vector3::ZERO;
    mWalkSpeed = 6.0f;
    mAnimationState = objectEntity->getAnimationState("Idle2");
    mAnimationState->setLoop(true);
    mAnimationState->setEnabled(true);
    this->camera = camera;

    dying = false;
    dead = false;
    attacking = false;
    updateGraveyard = true;
    walkTo = position;
    lastHealthTick = 0.0f;
} // createObject
开发者ID:mattschwartz,项目名称:rogre,代码行数:23,代码来源:PlayerObject.cpp


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