Ejemplo n.º 1
0
void CubeWorld::displaySimpleWorld (void)
{
	Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BoxColor", "General", true );
	Ogre::Technique* tech = mat->getTechnique(0);
	Ogre::Pass* pass = tech->getPass(0);
	Ogre::TextureUnitState* tex = pass->createTextureUnitState();
	tex->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, Ogre::ColourValue(0, 0.5, 0));

	Ogre::ManualObject* testBox  = createCubeMesh("TestBox1", "BoxColor");
        Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	Ogre::MeshPtr Mesh = testBox->convertToMesh("TestBox2");
	Ogre::StaticGeometry* pGeom = new Ogre::StaticGeometry (mSceneMgr, "Boxes");

	Ogre::Entity* pEnt = mSceneMgr->createEntity("TestBox2");

	pGeom->setRegionDimensions(Ogre::Vector3(300, 300, 300));

	for (int z = 0; z < WORLD_SIZE; ++z)
	{
		for (int y = 0; y < WORLD_SIZE; ++y)
		{
			for (int x = 0; x < WORLD_SIZE; ++x)
			{
				if (GetBlock(x,y,z)) pGeom->addEntity(pEnt, Ogre::Vector3(x,y,z));
			}
		}
	}

	pGeom->build ();
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------
void
System::bakeStaticGeometries(size_t maxMemoryUsage)
{
    clearStaticGeometries();

    // HACK

    Ogre::StaticGeometry* sg = mSceneManager->createStaticGeometry("Fairy/StaticGeometry/0");
    mStaticGeometries.push_back(sg);
    sg->setRegionDimensions(Ogre::Vector3(2000, 2000, 2000));

    const SceneInfo::Objects& objects = mSceneInfo->getObjects();
    for (SceneInfo::Objects::const_iterator it = objects.begin(); it != objects.end(); ++it)
    {
        const ObjectPtr& object = *it;
        EntityList entities;
        object->queryBakableEntities(entities);
        if (!entities.empty())
        {
            object->bakeStaticGeometry(sg, entities);
        }
    }

    sg->build();
}
Ejemplo n.º 3
0
void GameState::generateEnvironment()
{
	
	Ogre::StaticGeometry *sg = mSceneMgr->createStaticGeometry("Asteroids");
	const int size = 7000;
    const int amount = 5;
	sg->setRegionDimensions(Ogre::Vector3(size, size, size));
	//sg->setOrigin(Ogre::Vector3(-size/2, 0, -size/2));
	sg->setOrigin(Vector3(-size/2, -size/2, -size/2) + Vector3(0, 0, 0)); // this will center the staticgeometry around the point in 3D space
	for (int x = -size/2; x < size/2; x += (size/amount))
	{
		for (int y = -size/2; y < size/2; y += (size/amount))
		{
			for (int z = -size/2; z < size/2; z += (size/amount))
			{
					Ogre::Real r = size / (float)amount / 2;
					Ogre::Vector3 pos(x + Ogre::Math::RangeRandom(-r, r), y + Ogre::Math::RangeRandom(-r, r), z + Ogre::Math::RangeRandom(-r, r));
					Ogre::Vector3 scale(Ogre::Math::RangeRandom(0.7, 20), Ogre::Math::RangeRandom(0.7, 20), Ogre::Math::RangeRandom(0.7, 20));
					Ogre::Quaternion orientation;
					orientation.FromAngleAxis(Ogre::Degree(Ogre::Math::RangeRandom(0, 359)), Ogre::Vector3::UNIT_Y);
					MyEntity * ent = new MyEntity("asteroid1.mesh", mSceneMgr, mWorld, pos);
					ent->transform(orientation, Ogre::Vector3::ZERO);
					//ent->setScale(scale);
					sg->addEntity(ent->getEntity(), pos, orientation/*, scale*/);
			}
		}
	}
	sg->build();

	

}
Ejemplo n.º 4
0
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0, 0, 0));
    //mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
 
	//Create cube
	    //Create a basic green color texture 
 
	Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BoxColor", "General", true );
	Ogre::Technique* tech = mat->getTechnique(0);
	Ogre::Pass* pass = tech->getPass(0);
	Ogre::TextureUnitState* tex = pass->createTextureUnitState();
 
	tex->setTextureName("grassTexture.png");
	//tex->setNumMipmaps(4);
	tex->setTextureAnisotropy(1);
	tex->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_POINT);

	    //Create the one box and the supporting class objects
	Ogre::ManualObject* testBox  = createCubeMesh("TestBox1", "BoxColor");	
    Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	Ogre::MeshPtr Mesh = testBox->convertToMesh("TestBox2");
	Ogre::StaticGeometry* pGeom = new Ogre::StaticGeometry (mSceneMgr, "Boxes");
	Ogre::Entity* pEnt = mSceneMgr->createEntity("TestBox2");
	
	//testBox->triangle
	pGeom->setRegionDimensions(Ogre::Vector3(300, 300, 300));
 
	World::Instance();
	 
	pGeom->build ();
 
        mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
	Ogre::Light* l = mSceneMgr->createLight("MainLight");
        l->setPosition(20,80,50);
	//Create Cube

 /*   Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja", "ninja.mesh");
    entNinja->setCastShadows(true);
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);*/
 
 
    Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");
    directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
    directionalLight->setDiffuseColour(Ogre::ColourValue(.25, .25, 0));
    directionalLight->setSpecularColour(Ogre::ColourValue(.25, .25, 0));
 
    directionalLight->setDirection(Ogre::Vector3( 0, -1, 1 )); 
 
 
}
Ejemplo n.º 5
0
/// @brief  Loads the graphics for the supplied arena.
/// @param  aid The ArenaID of the arena to load.
void SceneSetup::loadArenaGraphics (ArenaID aid)
{
    // Load the main arena mesh
    Ogre::Entity* arenaEntity;
    if (aid == COLOSSEUM_ARENA)
        arenaEntity = GameCore::mSceneMgr->createEntity("Arena", "arena1.mesh");
    else if (aid == FOREST_ARENA)
        arenaEntity = GameCore::mSceneMgr->createEntity("Arena", "arena2.mesh");
    else
        arenaEntity = GameCore::mSceneMgr->createEntity("Arena", "arena3.mesh");
#if SHADOW_METHOD == 2
    arenaEntity->setCastShadows(false);
#else
    arenaEntity->setCastShadows(true);
#endif
    arenaNode->attachObject(arenaEntity);


    // Load the props
    if (aid == COLOSSEUM_ARENA)
    {
        Ogre::SceneNode* propsNode = GameCore::mSceneMgr->getRootSceneNode()->createChildSceneNode("PropsNode");
        GameCore::mPhysicsCore->auto_scale_scenenode(propsNode);
        Ogre::Entity* propsEntity = GameCore::mSceneMgr->createEntity("PropsEntity", "arena1_props.mesh");
#if SHADOW_METHOD == 1
        propsEntity->setCastShadows(false);
#else
        propsEntity->setCastShadows(true);
#endif
        propsNode->attachObject(propsEntity);
    }
    else if (aid == FOREST_ARENA)
    {
        unsigned int i;
        int treeType;
        Ogre::Real radius, theta;
        std::string entityName, nodeName, fileName;
        Ogre::Vector3 treePosition;
        Ogre::Vector3 treeScale(MESH_SCALING_CONSTANT, MESH_SCALING_CONSTANT, MESH_SCALING_CONSTANT);
        Ogre::Entity* lowPolyTrees[5];
        Ogre::Entity* superLowPolyTrees[5];

        // Load the trees arrays with entities.
        for (i = 1; i <= 5; i++)
        {
            entityName = "LPTreeEntity" + boost::lexical_cast<std::string>(i);
            fileName   = "birch"        + boost::lexical_cast<std::string>(i) + "_lp.mesh";
            lowPolyTrees[i-1] = GameCore::mSceneMgr->createEntity(entityName, fileName);
            lowPolyTrees[i-1]->setCastShadows(false);
        
            entityName = "SLPTreeEntity" + boost::lexical_cast<std::string>(i);
            fileName   = "birch"         + boost::lexical_cast<std::string>(i) + "_slp.mesh";
            superLowPolyTrees[i-1] = GameCore::mSceneMgr->createEntity(entityName, fileName);
            superLowPolyTrees[i-1]->setCastShadows(false);
        }

        // Load the static geometry - fun on the bun
        int size = 184.5 * 2;
        Ogre::StaticGeometry* sg = GameCore::mSceneMgr->createStaticGeometry("Trees");
        sg->setRegionDimensions(Ogre::Vector3(size, 100, size));
        sg->setOrigin(Ogre::Vector3(-size/2, 0, -size/2));

        // Notes: 134.2m < r < 184.2m
        // rand() returns a value which is at least 32767.
        // First 15m are good trees, subsequent 35m are crap trees.

        // Place 50 higher detail trees close to the viewer.
        for (i = 0; i < FOREST_ARENA_HQ_TREE_COUNT + FOREST_ARENA_LQ_TREE_COUNT; i++)
        {
            if (i < FOREST_ARENA_HQ_TREE_COUNT)
                radius = (1345 + (rand() % (FOREST_ARENA_LQ_TREE_CUTOFF * 10))) / 10.0f;
            else
                radius = (1345 + (FOREST_ARENA_LQ_TREE_CUTOFF * 10) + (rand() % (1845 - 1345 - (FOREST_ARENA_LQ_TREE_CUTOFF*10)))) / 10.0f;
            theta = ((rand() % 32767) / 32767.0f) * 6.28318531f;
            treeType = rand() % 5;

            treePosition.x = radius * cos(theta);
            treePosition.z = radius * sin(theta);
            treePosition.y = 1.6f;
        
            if (i < FOREST_ARENA_HQ_TREE_COUNT)
                sg->addEntity(superLowPolyTrees[treeType], treePosition, Ogre::Quaternion::IDENTITY, treeScale);
            else
                sg->addEntity(lowPolyTrees[treeType],      treePosition, Ogre::Quaternion::IDENTITY, treeScale);
        }

        sg->build();

        // Unload the trees arrays.
        for (i = 1; i <= 5; i++)
        {
            entityName = "LPTreeEntity" + boost::lexical_cast<std::string>(i);
            GameCore::mSceneMgr->destroyEntity(entityName);
        
            entityName = "SLPTreeEntity" + boost::lexical_cast<std::string>(i);
            GameCore::mSceneMgr->destroyEntity(entityName);
        }
    }
    else
    {
        Ogre::SceneNode* propsNode = GameCore::mSceneMgr->getRootSceneNode()->createChildSceneNode("PropsNode");
        GameCore::mPhysicsCore->auto_scale_scenenode(propsNode);
        Ogre::Entity* propsEntity = GameCore::mSceneMgr->createEntity("PropsEntity", "arena3_props.mesh");
#if SHADOW_METHOD == 1
        propsEntity->setCastShadows(false);
#else
        propsEntity->setCastShadows(true);
#endif
        propsNode->attachObject(propsEntity);
    }

#ifdef COLLISION_DOMAIN_CLIENT
    //GameCore::mClientGraphics->mGameCam->setTarget( arenaNode );
    GameCore::mClientGraphics->mGameCam->setTransform( btVector3( 0, 10, 80 ) );
#endif
}
Ejemplo n.º 6
0
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
{
    Ogre::SceneNode* insert = ptr.getRefData().getBaseNode();
    assert(insert);

    Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL;
    NifOgre::EntityList entities = NifOgre::NIFLoader::createEntities(insert, NULL, mesh);
    for(size_t i = 0;i < entities.mEntities.size();i++)
    {
        const Ogre::AxisAlignedBox &tmp = entities.mEntities[i]->getBoundingBox();
        bounds.merge(Ogre::AxisAlignedBox(insert->_getDerivedPosition() + tmp.getMinimum(),
                                          insert->_getDerivedPosition() + tmp.getMaximum())
        );
    }
    Ogre::Vector3 extents = bounds.getSize();
    extents *= insert->getScale();
    float size = std::max(std::max(extents.x, extents.y), extents.z);

    bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Viewing distance");

    // do not fade out doors. that will cause holes and look stupid
    if (ptr.getTypeName().find("Door") != std::string::npos)
        small = false;

    if (mBounds.find(ptr.getCell()) == mBounds.end())
        mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
    mBounds[ptr.getCell()].merge(bounds);

    bool transparent = false;
    for(size_t i = 0;i < entities.mEntities.size();i++)
    {
        Ogre::Entity *ent = entities.mEntities[i];
        for (unsigned int i=0; i<ent->getNumSubEntities(); ++i)
        {
            Ogre::MaterialPtr mat = ent->getSubEntity(i)->getMaterial();
            Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator();
            while (techIt.hasMoreElements())
            {
                Ogre::Technique* tech = techIt.getNext();
                Ogre::Technique::PassIterator passIt = tech->getPassIterator();
                while (passIt.hasMoreElements())
                {
                    Ogre::Pass* pass = passIt.getNext();

                    if (pass->getDepthWriteEnabled() == false)
                        transparent = true;
                }
            }
        }
    }

    if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") || transparent)
    {
        for(size_t i = 0;i < entities.mEntities.size();i++)
        {
            Ogre::Entity *ent = entities.mEntities[i];

            ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0);
            ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc);
            ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
        }
    }
    else
    {
        Ogre::StaticGeometry* sg = 0;

        if (small)
        {
            if( mStaticGeometrySmall.find(ptr.getCell()) == mStaticGeometrySmall.end())
            {
                uniqueID = uniqueID +1;
                sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
                mStaticGeometrySmall[ptr.getCell()] = sg;

                sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance"));
            }
            else
                sg = mStaticGeometrySmall[ptr.getCell()];
        }
        else
        {
            if( mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end())
            {

                uniqueID = uniqueID +1;
                sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
                mStaticGeometry[ptr.getCell()] = sg;
            }
            else
                sg = mStaticGeometry[ptr.getCell()];
        }

        // This specifies the size of a single batch region.
        // If it is set too high:
        //  - there will be problems choosing the correct lights
        //  - the culling will be more inefficient
        // If it is set too low:
        //  - there will be too many batches.
        sg->setRegionDimensions(Ogre::Vector3(2500,2500,2500));

        sg->setVisibilityFlags(small ? RV_StaticsSmall : RV_Statics);

        sg->setCastShadows(true);

        sg->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);

        for(size_t i = 0;i < entities.mEntities.size();i++)
        {
            Ogre::Entity *ent = entities.mEntities[i];
            insert->detachObject(ent);
            sg->addEntity(ent,insert->_getDerivedPosition(),insert->_getDerivedOrientation(),insert->_getDerivedScale());

            mRenderer.getScene()->destroyEntity(ent);
        }
    }
}
Ejemplo n.º 7
0
bool LevelGeometryLoader::processStaticGeometries(TiXmlElement *XMLRoot)
{
	ASSERT(XMLRoot);

	TiXmlElement *pElement, *auxPElem;

	// Process nodes (?)
	pElement = XMLRoot->FirstChildElement("staticGeometries");
	if(!pElement){
		debug("Error: Invalid .scene processStaticGeometries\n" );
		return false;
	}

	mStaticGeometry.clear();

	Ogre::StaticGeometry	*sgeo = 0;
	Ogre::Vector3			origin;
	Ogre::Vector3			dimension;
	bool					visible;
	Ogre::String			name;
	bool					castShadow;

	// parse the staticGeometries
	pElement = pElement->FirstChildElement("staticGeometry");
	while(pElement)
	{
		// Parse a StaticGeometry
		visible = Ogre::DotSceneLoader::getAttribBool(pElement, "visible");
		name = Ogre::DotSceneLoader::getAttrib(pElement, "name");
		castShadow = Ogre::DotSceneLoader::getAttribBool(pElement, "castShadows");

		try {
			sgeo = Common::GlobalObjects::sceneManager->createStaticGeometry(name);
			debug("StaticGeometry %s created\n", name.c_str());
		} catch(...) {
			debug("Error: Invalid name to StaticGeometry\n" );
			return false;
		}

		mStaticGeometry.push_back(sgeo);

		sgeo->setCastShadows(castShadow);
		sgeo->setVisible(visible);

		// get the origin
		auxPElem = pElement->FirstChildElement("origin");
		if(auxPElem) {
			sgeo->setOrigin(Ogre::DotSceneLoader::parseVector3(auxPElem));
		}

		// get the dimensions
		auxPElem = pElement->FirstChildElement("dimensions");
		if(auxPElem) {
			sgeo->setRegionDimensions(Ogre::DotSceneLoader::parseVector3(auxPElem));
		}

		// iterate over the entity list
		auxPElem = pElement;
		auxPElem = auxPElem->FirstChildElement("entities");
		if(!auxPElem){
			debug("Error: StaticGeometry without Entity! %s\n", sgeo->getName().c_str());
			ASSERT(false);
			mStaticGeometry.erase(mStaticGeometry.end()-1);
			Common::GlobalObjects::sceneManager->destroyStaticGeometry(sgeo);
			pElement = pElement->NextSiblingElement("staticGeometry");
			continue;
		}
		auxPElem = auxPElem->FirstChildElement("entity");
		while(auxPElem){
			// get the entities associated
			if(!processEntityStaticGeoemtry(auxPElem, sgeo)){
				debug("Error: Invalid entity of StaticGeometry\n" );
				return false;
			}

			auxPElem = auxPElem->NextSiblingElement("entity");
		}

		// build the staticGeometry
		sgeo->build();

		pElement = pElement->NextSiblingElement("staticGeometry");
	}


	return true;

}
Ejemplo n.º 8
0
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool light)
{
    Ogre::SceneNode* insert = ptr.getRefData().getBaseNode();
    assert(insert);

    Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL;
    NifOgre::ObjectList objects = NifOgre::Loader::createObjects(insert, mesh);
    for(size_t i = 0;i < objects.mEntities.size();i++)
        bounds.merge(objects.mEntities[i]->getWorldBoundingBox(true));

    Ogre::Vector3 extents = bounds.getSize();
    extents *= insert->getScale();
    float size = std::max(std::max(extents.x, extents.y), extents.z);

    bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Viewing distance");

    // do not fade out doors. that will cause holes and look stupid
    if (ptr.getTypeName().find("Door") != std::string::npos)
        small = false;

    if (mBounds.find(ptr.getCell()) == mBounds.end())
        mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL;
    mBounds[ptr.getCell()].merge(bounds);

    bool anyTransparency = false;
    for(size_t i = 0;!anyTransparency && i < objects.mEntities.size();i++)
    {
        Ogre::Entity *ent = objects.mEntities[i];
        for(unsigned int i=0;!anyTransparency && i < ent->getNumSubEntities(); ++i)
        {
            anyTransparency = ent->getSubEntity(i)->getMaterial()->isTransparent();
        }
    }

    if(!mIsStatic || !Settings::Manager::getBool("use static geometry", "Objects") ||
       anyTransparency || objects.mParticles.size() > 0)
    {
        for(size_t i = 0;i < objects.mEntities.size();i++)
        {
            Ogre::Entity *ent = objects.mEntities[i];
            for(unsigned int i=0; i < ent->getNumSubEntities(); ++i)
            {
                Ogre::SubEntity* subEnt = ent->getSubEntity(i);
                subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? RQG_Alpha : RQG_Main);
            }
            ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0);
            ent->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc);
        }
        for(size_t i = 0;i < objects.mParticles.size();i++)
        {
            Ogre::ParticleSystem *part = objects.mParticles[i];
            // TODO: Check the particle system's material for actual transparency
            part->setRenderQueueGroup(RQG_Alpha);
            part->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Viewing distance") : 0);
            part->setVisibilityFlags(mIsStatic ? (small ? RV_StaticsSmall : RV_Statics) : RV_Misc);
        }
    }
    else
    {
        Ogre::StaticGeometry* sg = 0;

        if (small)
        {
            if( mStaticGeometrySmall.find(ptr.getCell()) == mStaticGeometrySmall.end())
            {
                uniqueID = uniqueID +1;
                sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
                mStaticGeometrySmall[ptr.getCell()] = sg;

                sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Viewing distance"));
            }
            else
                sg = mStaticGeometrySmall[ptr.getCell()];
        }
        else
        {
            if( mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end())
            {

                uniqueID = uniqueID +1;
                sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
                mStaticGeometry[ptr.getCell()] = sg;
            }
            else
                sg = mStaticGeometry[ptr.getCell()];
        }

        // This specifies the size of a single batch region.
        // If it is set too high:
        //  - there will be problems choosing the correct lights
        //  - the culling will be more inefficient
        // If it is set too low:
        //  - there will be too many batches.
        sg->setRegionDimensions(Ogre::Vector3(2500,2500,2500));

        sg->setVisibilityFlags(small ? RV_StaticsSmall : RV_Statics);

        sg->setCastShadows(true);

        sg->setRenderQueueGroup(RQG_Main);

        std::vector<Ogre::Entity*>::reverse_iterator iter = objects.mEntities.rbegin();
        while(iter != objects.mEntities.rend())
        {
            Ogre::Node *node = (*iter)->getParentNode();
            sg->addEntity(*iter, node->_getDerivedPosition(), node->_getDerivedOrientation(), node->_getDerivedScale());

            (*iter)->detachFromParent();
            mRenderer.getScene()->destroyEntity(*iter);
            iter++;
        }
    }

    if (light)
    {
        insertLight(ptr, objects.mSkelBase, bounds.getCenter() - insert->_getDerivedPosition());
    }
}