Skip to content

Ogre v2-1 glTF2.0 loader plugin v0.2

Compare
Choose a tag to compare
@Ybalrid Ybalrid released this 02 Nov 17:46
· 25 commits to master since this release

This release contains some new features contributed by the community🎉 :

  • Loading and applying the transform of the gltf model node to your Ogre SceneNode (this is useful for situations when the model exported need some transform to look the same as in the modeling program, like scaling)
  • Alpha in materials
  • Multiple materials in same model

This releases fixes missing hardware gamma correction on textures.

We also remove the old plugin API, to replace it with a new, simpler to use and maintain one :

	//Get access to the gltf loader, and load a GLB file in the resources to an item
	//This actually search through the list of installed plugin, keep that pointer somewhere convenient
	auto glTFLoader = gltfPluginAccessor::findPlugin()->getLoader(); 

	//You can create an Item for a scene by giving the name of the GLB file to look for in the resources
	Ogre_glTF::ModelInformation model = gltfLoader->getModelData("myGltfFile.glb", glTFLoaderInterface::LoadFrom::ResourceManager);
	Ogre::Item* myItem = model.makeItem(mySceneManager);

This "model information" structure contains the local transform of the node, the mesh and the material(s) as pointers to HlmsPbsDatablocks.

You can easily apply the transform to the node like so:

	itemNode->attachObject(myItem);
	model.transform.apply(itemNode); //apply the local transform

That's pretty much all there is to it! 😉

Attached to this post is a windows 64bit build against ogre v2-1-61d00f542997 (hg id -i)