Page 1 of 1

Convert v2 Mesh to v1

Posted: Fri Jul 12, 2024 11:33 pm
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?


Re: Convert v2 Mesh to v1

Posted: Sat Jul 13, 2024 10:59 am
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


Re: Convert v2 Mesh to v1

Posted: Sat Jul 13, 2024 5:27 pm
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.