All Projects → playcanvas → playcanvas-gltf

playcanvas / playcanvas-gltf

Licence: MIT license
glTF 2.0 support for the PlayCanvas Engine

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to playcanvas-gltf

playcanvas-viewer
glTF 2.0 model viewer
Stars: ✭ 152 (+56.7%)
Mutual labels:  gltf, playcanvas
godot-dynamic-gltf-loader
Dynamic GLTF loader module for Godot 3.2.4+
Stars: ✭ 14 (-85.57%)
Mutual labels:  gltf
gltf-avatar-threejs
A glTF-based 3d avatar system
Stars: ✭ 195 (+101.03%)
Mutual labels:  gltf
panda3d-gltf
glTF utilities for Panda3D
Stars: ✭ 63 (-35.05%)
Mutual labels:  gltf
VGltf
A glTF 2.0 importer/exporter library written in pure C# with support for use in Unity
Stars: ✭ 53 (-45.36%)
Mutual labels:  gltf
binary-gltf-utils
Bundles glTF models, images, shaders and other assets into a Binary glTF (.glb) file.
Stars: ✭ 31 (-68.04%)
Mutual labels:  gltf
gltf-bounding-box
Computes the global bounding box of a gltf model
Stars: ✭ 18 (-81.44%)
Mutual labels:  gltf
GLTFKit2
A glTF 2.0 asset loader and exporter for Objective-C and Swift.
Stars: ✭ 30 (-69.07%)
Mutual labels:  gltf
redcube
JS renderer based on GLTF to WebGPU or WebGL backends.
Stars: ✭ 86 (-11.34%)
Mutual labels:  gltf
pcui-graph
A JavaScript library for creating node-based graphs
Stars: ✭ 78 (-19.59%)
Mutual labels:  playcanvas
typescript-playcanvas-template
PlayCanvas TypeScript/WebPack template
Stars: ✭ 27 (-72.16%)
Mutual labels:  playcanvas
editor
Issue tracker for the PlayCanvas Editor
Stars: ✭ 77 (-20.62%)
Mutual labels:  playcanvas
gemini-viewer
WebGL BIM Viewer based on xeoKit-sdk, written with TypeScript.
Stars: ✭ 24 (-75.26%)
Mutual labels:  gltf
Ogre glTF
glTF 2.0 asset loader plugin for Ogre 2.1
Stars: ✭ 44 (-54.64%)
Mutual labels:  gltf
glTF-Shell-Extensions
Microsoft Windows shell extensions that pack .gltf to .glb and unpack .glb to .gltf
Stars: ✭ 82 (-15.46%)
Mutual labels:  gltf
importer-exporter
3D City Database client for high-performance import and export of 3D city model data
Stars: ✭ 104 (+7.22%)
Mutual labels:  gltf
playcanvas-webpack
Demonstration of building a PlayCanvas app with Webpack
Stars: ✭ 14 (-85.57%)
Mutual labels:  playcanvas
lol2gltf
Tool for converting between the glTF format and League of Legends models and animations
Stars: ✭ 74 (-23.71%)
Mutual labels:  gltf
rendering-fw
Rendering framework with rasterizers & path tracers implemented using Vulkan, OptiX & OpenGL
Stars: ✭ 81 (-16.49%)
Mutual labels:  gltf
mixed-reality-extension-sdk
The Mixed Reality Extension SDK enables developers to build 3D world extensions for AltspaceVR, using Node.JS.
Stars: ✭ 139 (+43.3%)
Mutual labels:  gltf

THIS REPO IS NOW DEPRECATED

Please visit:

playcanvas-gltf

gtTF viewer

This repo extends PlayCanvas to support glTF. It contains:

  • A loader script that can convert a glTF or glB file into a PlayCanvas hierarchy.
  • A viewer application that supports drag and drop of glTF and glB files.

The loader script returns a pc.Model structure. It can be used with the standalone Engine or in conjunction with the PlayCanvas Editor.

To see an example of using the loader with the Engine, check out the viewer app in this repo.

To use the loader with the Editor, simply add playcanvas-gltf.js and playcanvas-anim.js into your project (ensuring they are first in your loading order) and call the following API:

API

loadGlb

Parses an ArrayBuffer holding a binary-encoded glTF scene.

loadGlb(glb, device, done);
  • glb - An ArrayBuffer holding the binary glb file data.
  • device - A pc.GraphicsDevice.
  • done - A Function called when the glb has loaded (either successfully or with an error). The function has the following signature: function (err, res) {}. The parameters of the done function are as follows:
    • err - A String describing any error encountered on load. If err is null, the load operation completed successfully.
    • res - An Object holding the loaded PlayCanvas objects.
    • res.model - A pc.Model object representing the glTF scene
    • res.textures - An array of pc.Texture objects
    • res.animations - An array of AnimationClip objects

Example

app.assets.loadFromUrl('assets/monkey/monkey.glb', 'binary', function (err, asset) {
    var glb = asset.resource;
    loadGlb(glb, app.graphicsDevice, function (err, res) {
        // Wrap the model as an asset and add to the asset registry
        var asset = new pc.Asset('gltf', 'model', {
            url: ''
        });
        asset.resource = res.model;
        asset.loaded = true;
        app.assets.add(asset);

        // Add the loaded scene to the hierarchy
        var gltf = new pc.Entity('gltf');
        gltf.addComponent('model', {
            asset: asset
        });
        app.root.addChild(gltf);
    });
});

loadGltf

Parses an in-memory Object hierarchy holding a glTF scene.

loadGltf(gltf, device, done, options);
  • gltf - An Object representing the root of the glTF scene.
  • device - A pc.GraphicsDevice.
  • done - A Function called when the glb has loaded (either successfully or with an error). The function has the following signature: function (err, res) {}. The parameters of the done function are as follows:
    • err - A String describing any error encountered on load. If err is null, the load operation completed successfully.
    • res - An Object holding the loaded PlayCanvas objects.
    • res.model - A pc.Model object representing the glTF scene
    • res.textures - An array of pc.Texture objects
    • res.animations - An array of AnimationClip objects
  • options - An Object specifying optional parameters for the function.
  • options.buffers - An Array of preloaded ArrayBuffer objects holding the glTF file's buffer data.
  • options.basePath - A String set to the relative path of the glTF file.
  • options.processUri - A Function that provides custom loading behavior for URIs encountered during the loading process.

Example

app.assets.loadFromUrl('assets/monkey/monkey.gltf', 'json', function (err, asset) {
    var json = asset.resource;
    var gltf = JSON.parse(json);
    loadGltf(gltf, app.graphicsDevice, function (err, res) {
        // Wrap the model as an asset and add to the asset registry
        var asset = new pc.Asset('gltf', 'model', {
            url: ''
        });
        asset.resource = res.model;
        asset.loaded = true;
        app.assets.add(asset);

        // Add the loaded scene to the hierarchy
        var gltf = new pc.Entity('gltf');
        gltf.addComponent('model', {
            asset: asset
        });
        app.root.addChild(gltf);
    }, {
        basePath: 'assets/monkey/'
    });
});

glTF Viewer

To load the glTF viewer, run a local web-server and load viewer/index.html. You can then drag a glb or gltf file onto the tab's client area to load it. For non-embedded glTF files (with external buffer and image files), you need to drag the containing folder of the glTF file onto the viewer's client area. Binaries for the viewer can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].