Microsoft.glTF.CPP 1.5.19

A C++ library for decoding and encoding glTF files.

Install-Package Microsoft.glTF.CPP -Version 1.5.19
dotnet add package Microsoft.glTF.CPP --version 1.5.19
paket add Microsoft.glTF.CPP --version 1.5.19
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Breaking Changes for 1.5.19.0:

  • Disallow elements with empty ids in IndexedContainer
  • Removed IStreamFactory and GetTemporaryStream
  • Removed ResourceWriter1, renamed ResourceWriter2 to ResourceWriter
  • Removed KHR_material_specularGlossiness support in GLTFDocument
  • Removed MSFT_lod support in GLTFDocument
  • Removed GLTFExentsionUtils
  • Removed GLBtoGLTF

Notes for 1.5.19.0:

  • Added Windows cmake build configuration and scripts
  • Numerous bug fixes
  • Preparation for release to OSS
  • Prep work for releasing Android package
  • Support for trianlge fans and triangle strips
  • Added KHR_draco_mesh_comprerssion extension class and tests
  • Added optional VisitDefaultAction param to visitor callbacks
  • Added GLTFExtensions (full support for extension serialization handling, strongly typed extensions, per-entity extension handling)
  • Added KHR_material_specularGlossiness handling through GLTFExtensions
  • Added optional VisitDefaultAction parameter to Visitor callbacks
  • Added TextureInfo deserialization
  • Animation fixes

#GLTF Deserializer/Serializer in C++

  • Fully compliant with KhronosGroup GLTF 2.0 spec
  • Can ingest GLB/GLTFs as well as GLTFs with embedded Base64
  • Support for extensions
  • Built-in compliance validation during deserialization
  • Low memory overhead
  • Simple interface for reading any model information automatically converted to any bit size
  • Flexibility and ease of integration to any 3D engine
  • macOS/Windows Compatible

GLTFSDK is a fully compliant Deserializer/Serializer for GLTF, GLB and Base64 encoded GLTF files, implemented in C++ 11. Designed for flexibility and ease of integration into 3D engines. It supports files containing extensions and extras, allows easy direct reading of any model information into vectors of any desired bit size, and has built-in compliance validation of files during deserialization. Available for both Windows and macOS.

#include <GLTFSDK/Deserialize.h>
#include <GLTFSDK/Serialize.h>
#include <GLTFSDK/GLTFResourceWriter.h>
#include <GLTFSDK/GLBResourceReader.h>
#include <iostream>
#include <fstream>


using namespace Microsoft::glTF;

class InStream : public IStreamReader
{
public:
    InStream() : m_stream(std::make_shared<std::stringstream>(std::ios_base::app | std::ios_base::binary | std::ios_base::in | std::ios_base::out))
    {
    }

    std::shared_ptr<std::istream> GetInputStream(const std::string&) const override
    {
        return m_stream;
    }

private:
    std::shared_ptr<std::stringstream> m_stream;
};

int main(int arg, char *argv[])
{
    auto glbStream = std::make_shared<std::ifstream>("some\\path.glb", std::ios::binary);
    auto streamReader = std::make_unique<InStream>();
    GLBResourceReader reader(*streamReader, glbStream);

    // get json from GLB and deserialize into GLTFDocument
    std::string json = reader.GetJson();
    GLTFDocument gltfDoc = DeserializeJson(json);

    //serialize and write new gltf json showing the json structure originally hidden in GLB
    std::string gltfJson = Serialize(gltfDoc, SerializeFlags::Pretty);
    std::ofstream outStream("some\\path.gltf");
    outStream << gltfJson;
    outStream.flush();
}

Breaking Changes for 1.5.19.0:

  • Disallow elements with empty ids in IndexedContainer
  • Removed IStreamFactory and GetTemporaryStream
  • Removed ResourceWriter1, renamed ResourceWriter2 to ResourceWriter
  • Removed KHR_material_specularGlossiness support in GLTFDocument
  • Removed MSFT_lod support in GLTFDocument
  • Removed GLTFExentsionUtils
  • Removed GLBtoGLTF

Notes for 1.5.19.0:

  • Added Windows cmake build configuration and scripts
  • Numerous bug fixes
  • Preparation for release to OSS
  • Prep work for releasing Android package
  • Support for trianlge fans and triangle strips
  • Added KHR_draco_mesh_comprerssion extension class and tests
  • Added optional VisitDefaultAction param to visitor callbacks
  • Added GLTFExtensions (full support for extension serialization handling, strongly typed extensions, per-entity extension handling)
  • Added KHR_material_specularGlossiness handling through GLTFExtensions
  • Added optional VisitDefaultAction parameter to Visitor callbacks
  • Added TextureInfo deserialization
  • Animation fixes

#GLTF Deserializer/Serializer in C++

  • Fully compliant with KhronosGroup GLTF 2.0 spec
  • Can ingest GLB/GLTFs as well as GLTFs with embedded Base64
  • Support for extensions
  • Built-in compliance validation during deserialization
  • Low memory overhead
  • Simple interface for reading any model information automatically converted to any bit size
  • Flexibility and ease of integration to any 3D engine
  • macOS/Windows Compatible

GLTFSDK is a fully compliant Deserializer/Serializer for GLTF, GLB and Base64 encoded GLTF files, implemented in C++ 11. Designed for flexibility and ease of integration into 3D engines. It supports files containing extensions and extras, allows easy direct reading of any model information into vectors of any desired bit size, and has built-in compliance validation of files during deserialization. Available for both Windows and macOS.

#include <GLTFSDK/Deserialize.h>
#include <GLTFSDK/Serialize.h>
#include <GLTFSDK/GLTFResourceWriter.h>
#include <GLTFSDK/GLBResourceReader.h>
#include <iostream>
#include <fstream>


using namespace Microsoft::glTF;

class InStream : public IStreamReader
{
public:
    InStream() : m_stream(std::make_shared<std::stringstream>(std::ios_base::app | std::ios_base::binary | std::ios_base::in | std::ios_base::out))
    {
    }

    std::shared_ptr<std::istream> GetInputStream(const std::string&) const override
    {
        return m_stream;
    }

private:
    std::shared_ptr<std::stringstream> m_stream;
};

int main(int arg, char *argv[])
{
    auto glbStream = std::make_shared<std::ifstream>("some\\path.glb", std::ios::binary);
    auto streamReader = std::make_unique<InStream>();
    GLBResourceReader reader(*streamReader, glbStream);

    // get json from GLB and deserialize into GLTFDocument
    std::string json = reader.GetJson();
    GLTFDocument gltfDoc = DeserializeJson(json);

    //serialize and write new gltf json showing the json structure originally hidden in GLB
    std::string gltfJson = Serialize(gltfDoc, SerializeFlags::Pretty);
    std::ofstream outStream("some\\path.gltf");
    outStream << gltfJson;
    outStream.flush();
}

Release Notes

Breaking Changes for 1.5.19.0:
- Disallow elements with empty ids in IndexedContainer
- Removed IStreamFactory and GetTemporaryStream
- Removed ResourceWriter1, renamed ResourceWriter2 to ResourceWriter
- Removed KHR_material_specularGlossiness support in GLTFDocument
- Removed MSFT_lod support in GLTFDocument
- Removed GLTFExentsionUtils
- Removed GLBtoGLTF

Notes for 1.5.19.0:
- Added Windows cmake build configuration and scripts
- Numerous bug fixes
- Preparation for release to OSS
- Prep work for releasing Android package
- Support for trianlge fans and triangle strips
- Added KHR_draco_mesh_comprerssion extension class and tests
- Added optional VisitDefaultAction param to visitor callbacks
- Added GLTFExtensions (full support for extension serialization handling, strongly typed extensions, per-entity extension handling)
- Added KHR_material_specularGlossiness handling through GLTFExtensions
- Added optional VisitDefaultAction parameter to Visitor callbacks
- Added TextureInfo deserialization
- Animation fixes

Version History

Version Downloads Last updated
1.5.19 (current) 45 6/15/2018
1.3.55 216 4/23/2018
1.3.54 71 4/19/2018
1.3.46 2,211 2/16/2018
1.3.26 846 12/7/2017
1.3.25 254 12/5/2017