Convert v2 Mesh to v1 Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


jwwalker
Goblin
Posts: 247
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 18

Convert v2 Mesh to v1

Post by jwwalker »

The explanatory text in the MeshLod sample says that meshes can be converted back and
forth between v1 and v2. The code for this sample uses MeshManager::createByImportingV1
to convert v1 to v2. But how would one convert a V2 mesh to V1?

Lax
Gnoll
Posts: 643
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 57

Re: Convert v2 Mesh to v1

Post by Lax »

Hi,

maybe you can try this one:

Code: Select all

if ((v1Mesh = Ogre::v1::MeshManager::getSingletonPtr()->getByName(tempMeshFile, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME)) == nullptr)
{
				v1Mesh = Ogre::v1::MeshManager::getSingletonPtr()->load(tempMeshFile, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME,
																		Ogre::v1::HardwareBuffer::HBU_STATIC, Ogre::v1::HardwareBuffer::HBU_STATIC);
}

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5429
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1337

Re: Convert v2 Mesh to v1

Post by dark_sylinc »

See v1::Mesh::importV2. See MeshTool which provides this functionality.

Note: createByImportingV1 guarantees that vertex buffers will be regenerated if the device is lost (i.e. by loading the V1 mesh again and importing it again). There is no such convenience functionality for v2 -> v1.