Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/gltf

Package Overview
Dependencies
Maintainers
9
Versions
342
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/gltf

Framework-independent loader for the glTF format

  • 4.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
189K
decreased by-14.45%
Maintainers
9
Weekly downloads
 
Created

What is @loaders.gl/gltf?

@loaders.gl/gltf is a part of the loaders.gl suite, designed to handle the loading, parsing, and processing of GLTF (GL Transmission Format) files. It provides utilities to work with 3D models and scenes, making it easier to integrate GLTF assets into web applications.

What are @loaders.gl/gltf's main functionalities?

Loading GLTF Files

This feature allows you to load GLTF files from a given URL. The `load` function from `@loaders.gl/core` is used in conjunction with the `GLTFLoader` to fetch and parse the GLTF file.

const { load } = require('@loaders.gl/core');
const { GLTFLoader } = require('@loaders.gl/gltf');

async function loadGLTF(url) {
  const data = await load(url, GLTFLoader);
  console.log(data);
}

loadGLTF('path/to/your/model.gltf');

Parsing GLTF Data

This feature allows you to parse GLTF data from an ArrayBuffer. The `parse` function from `@loaders.gl/core` is used with the `GLTFLoader` to convert the binary data into a usable format.

const { parse } = require('@loaders.gl/core');
const { GLTFLoader } = require('@loaders.gl/gltf');

async function parseGLTF(arrayBuffer) {
  const data = await parse(arrayBuffer, GLTFLoader);
  console.log(data);
}

// Assuming you have an ArrayBuffer of GLTF data
const arrayBuffer = new ArrayBuffer();
parseGLTF(arrayBuffer);

Handling GLB Files

This feature allows you to load GLB files, which are binary versions of GLTF files. The `load` function is used with the `GLTFLoader` and the `binary` option set to `true` to handle GLB files.

const { load } = require('@loaders.gl/core');
const { GLTFLoader } = require('@loaders.gl/gltf');

async function loadGLB(url) {
  const data = await load(url, GLTFLoader, { binary: true });
  console.log(data);
}

loadGLB('path/to/your/model.glb');

Other packages similar to @loaders.gl/gltf

Keywords

FAQs

Package last updated on 09 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc