void World::unload()
{
	//[NOTE] Always remember to delete any PageLoader(s) and PagedGeometry instances to avoid memory leaks.

	//Delete the PageLoader's
	//Delete the PagedGeometry instances
	if(grass) {delete grass->getPageLoader(); delete grass; grass=0;};
	if(trees) {delete trees->getPageLoader(); delete trees; trees=0;};
	if(bushes) {delete bushes->getPageLoader(); delete bushes; bushes=0;};

	//Also delete the entities
	sceneMgr->destroyEntity("Tree1");
	sceneMgr->destroyEntity("Fern");
	sceneMgr->destroyEntity("Plant");
	sceneMgr->destroyEntity("Mushroom");
}
void World::unload()
{
	//[NOTE] Always remember to delete any PageLoader(s) and PagedGeometry instances in order to avoid memory leaks.

	//Delete the TreeLoader2D instance
	delete trees->getPageLoader();

	//Delete the PagedGeometry instance
	delete trees;

	//Also delete the tree entity
	sceneMgr->destroyEntity("Tree");
}
Beispiel #3
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());
}