So, I've been talking about this in a few topics here and there, but I'm working on a plugin that allows user to load glTF 2.0 files into Ogre, complete with their PBR material (relying on HlmsPbs obviously!) and animations. Since it's is almost at a usable stage, I think I can create my own here, like, to do a proper little announcement!
The current goal is to allow users to use (binary) glTF files files in lieu of the good old .mesh format. I know a few people are interested into that idea, and it could make the workflow from taking objects made by artists on 3D software, or getting assets found online, into Ogre. And doing so using an industry standard file format.
This is free and open source software, available under the MIT license, like Ogre itself.
This plugin, is NOT a scene loader. It load meshes from glTF files, not a hierarchy of objects
So, today, I'm releasing a first alpha, and I need people to break test it!
Release history:
- 0.2.1 : Add support of Draco compressed meshes
- 0.2 : Fixes, alpha in materials, multi material objects, and local transform loading are now supported
- 0.1.1: Added methods to glTF interface to get the v2 Mesh object and datablock instead of just an item (idea from a remark by @dark_sylinc)
- 0.1: first release
- Project management in my Phabricator : https://phabricator.polutropon.games/project/view/4/
- Github (because free bandwidth... ^^") : https://github.com/Ybalrid/Ogre_glTF
- Github releases : https://github.com/Ybalrid/Ogre_glTF/releases/
- Website : https://ybalrid.github.io/Ogre_glTF/
You need to add the headers in the /include directory to your project. Either point your compiler to that directory, or copy them directly.
Then, once the plugin as been loaded and installed by Ogre, you can do the following to get a pointer to a glTF loader object:
Code: Select all
glTFLoaderInterface* glTFLoader = gltfPluginAccessor::findPlugin()->getLoader();
Put simply, if you put a .glb file into your resource group, you can do this :
Edit November the 2nd, 2018: Sample code in this post updated to reflect version 0.2's new API
Code: Select all
//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);
Code: Select all
itemNode->attachObject(myItem);
model.transform.apply(itemNode); //apply the local transform
I'm open to any questions, suggestions, bug reports and pull request on the GitHub repository, or in this very topic!