Releases: Ybalrid/Ogre_glTF
Feature Freeze for 2.1
This point tag the latest feature version that should be compatible with Ogre v2.1.
Development behind this point will go towards supporting Ogre 2.2!
If bugs need fixing for 2.1, they will be branched of this very commit
This contains bugfixes and improvement contributed by @chchwy and @xissburg. Big shoutout to them!
- Fixed computation of bounding boxes from loaded vertex buffers
- Fixed material alpha values
- Bunch of cleanup and refactor
- Support for loading Morph Target Animation (big thanks to @xissburg again for adding this to Ogre V2 itself, and this plugin!)
v0.2.1 - No API changes - Add Draco support
Ogre v2-1 glTF2.0 loader plugin v0.2
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
)
Ogre v2-1 glTF2.0 loader plugin v0.1.2
Minor release:
- Updated tinygltf to version 2.0
- Fix CMake prefix installation override
- Plugin only verbosely log in Debug builds
0.1.1: Permit to retreive Mesh and datablock witout creating Item.
Thanks to @darksylinc suggestion:
This release adds the two following methods to the glTTLoaderInterface Plugin :
///struct that contains a mesh and the datablock that should be used with it.
///This represent what an extracted object from a glTF asset contains.
///The mash should have a skeletonInstance attached to it the glTF file defined a skin;
struct MeshAndDataBlock
{
///Pointer to the Ogre Mesh
Ogre::MeshPtr Mesh;
///Pointer to the HlmsDatablock. This should be a HlmsPbsDatablock
Ogre::HlmsDatablock* datablock;
};
///Plugin accessible interface that plugin users can use
struct glTFLoaderInterface
{
/* ... */
//NEW BELOW:
///Get you a mesh and a material datablock from a GLB in the resource manager
/// \param name The name of the resource
/// \return a struct containing pointers to a mesh and a datablock
virtual MeshAndDataBlock getMeshFromResource(const std::string& name) = 0;
///Get you mesh and a material datablock from GLB or a GLTF file from the filesystem
/// \param name The name of the resource
/// \return a struct containing pointers to a mesh and a datablock
virtual MeshAndDataBlock getMeshFromFileSystem(const std::string& name) = 0;
};
Theses addition to the interface permit you to get the v2 Mesh (with it's skeleton instance and animation), and the data block used as a material on it separately.
This way you can plug this to a more complex caching system for gltf assets, and not limit you to consuming them.
(see the "note" on this forum post: https://forums.ogre3d.org/viewtopic.php?f=25&t=94387#p542155)
Ogre v2-1 glTF2.0 loader plugin v0.1
This is the first release of the plugin for Ogre v2-1!
It support loading of single-mesh glTF files (same content as you would find in an Ogre .mesh
file)
.gltf
+ their accompanying files are loadable by directly accessing the file system.
.glb
files are loadable from Ogre resource group, and from direct file system access.
I would recommend you to use .glb files from Ogre resources.
There are probably lots of bugs to find at the moment, I expect this plugin to break easily if there are some non handled edge cases on your glTF files. If this happens to you PLEASE Open an issue here, and provide the file that does not work, so that the problem can be solved!
Included here is a build of the source code for Windows made with Visual Studio 2017 and the necessary header files to access the functionality once the plugin's DLL was loaded. project README contains some usage information, but basically :
- Point your compiler to the public headers (the /include directory of the repository), or copy them to
- Point Ogre to use Ogre_glTF as a plugin in the same way you'll do to the other (e.g. RenderSystems, using plugin.cfg, ...)
- You can put binary glTF files (GLB files) inside your resources, like you would do with .mesh/.skeleton/textures files
- In your code:
//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 convinient
auto glTFLoader = gltfPluginAccessor::findPlugin()->getLoader();
//You can creae an Item for a scene by giving the name of the GLB file to look for in the resources
Ogre::Item* cesiumMan = glTFLoader->getItemFromResource("CesiumMan.glb, smgr);