Giter Club home page Giter Club logo

Comments (5)

warrenm avatar warrenm commented on September 4, 2024

GLTFAsset.dracoDecompressorClassName = "DracoDecompressor"

from gltfkit2.

daninils avatar daninils commented on September 4, 2024

There is a sample implementation of it here:

@implementation DracoDecompressor

from gltfkit2.

warrenm avatar warrenm commented on September 4, 2024

There's a complete example of how to use GLTFKit2 with draco decompression in the official glTF viewer for iOS published by the Khronos group here.

Here's a list of steps you can use to add draco support to your own app, assuming you have an existing Swift project that already uses GLTFKit2 as a Swift package.

  1. Add DracoSwift as a Swift package dependency. This will automatically download and link against a pre-built draco binary that has support for most Apple platforms. (Alternatively, you can build draco from source yourself, but that's outside the scope of this issue).
  2. Copy the SampleDracoPlugin.h and SampleDracoPlugin.mm files from the macOS sample viewer in the GLTFKit2 repo. These contain an Objective-C implementation of a basic draco decompressor that conforms to the protocol expected by GLTFKit2's draco plugin system. (It may be possible to write such a class in Swift with Swift 5.9's C++ interoperability, but I haven't tried this myself and can't guarantee it will work).
  3. If you don't already have a bridging header in your Swift project, add one.
  4. #import "SampleDracoPlugin.h" (or your own plugin's header) in the bridging header so your plugin's interface becomes available to your Swift code.
  5. Before loading any assets (e.g., at app launch), set the class name of your plugin as the dracoDecompressorClassName class property on the GLTFAsset class. This will allow the asset loader to instantiate your loader plugin and decode draco-compressed assets for you.

from gltfkit2.

warrenm avatar warrenm commented on September 4, 2024

This issue will be automatically closed as complete in seven days if no further response is received.

from gltfkit2.

warrenm avatar warrenm commented on September 4, 2024

Closing.

from gltfkit2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.