//-----------------------------------------------------------------------
	void MeshParticleVisualData::createVisualData(const String &meshName, const String &matName, Node* parentNode)
	{
		SceneManager *sceneMgr = Root::getSingleton()._getCurrentSceneManager();

		// create scene node and entity
		mSceneNode = sceneMgr->createSceneNode();

        parentNode->addChild(mSceneNode);

		// if the name of mesh is empty, we will use the prefab plane.
		if ( "" == meshName )
			mEntity = sceneMgr->createEntity( mSceneNode->getName(), Ogre::SceneManager::PT_PLANE );
		else
			mEntity = sceneMgr->createEntity( mSceneNode->getName(), meshName );

		assert (mEntity);

		mSceneNode->attachObject(mEntity);

		cloneMaterial(matName);

        mEntity->setCastShadows(false);

		mEntity->setMaterialName(mMaterial->getName());

		mInit = true;
	}
Exemplo n.º 2
0
TEST_F(Instancing, Bounds) {
    SceneManager* sceneMgr = SceneManagerEnumerator::getSingleton().createSceneManager(ST_GENERIC);
    Entity* entity = sceneMgr->createEntity("robot.mesh");

    MeshPtr mesh = entity->getMesh();
    InstanceBatchShader batch(NULL, mesh, entity->getSubEntity(0)->getMaterial(), 1, NULL, "");
    InstancedEntity instanced_entity(&batch, 0);

    SceneNode* node = sceneMgr->createSceneNode();
    node->attachObject(&instanced_entity);
    node->attachObject(entity);
    node->translate(Vector3::UNIT_X);
    node->setScale(Vector3(2, 2, 2));

    EXPECT_EQ(instanced_entity.getBoundingBox(), entity->getBoundingBox());
    EXPECT_EQ(instanced_entity.getBoundingRadius(), entity->getBoundingRadius());

    sceneMgr->destroyEntity(entity);
    MeshManager::getSingleton().remove(mesh->getHandle());
}