
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@loaders.gl/gltf
Advanced tools
@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.
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');
Three.js is a popular JavaScript library for creating 3D graphics in the browser. It includes support for loading and parsing GLTF files through its `GLTFLoader` class. Compared to @loaders.gl/gltf, Three.js offers a more comprehensive suite of tools for rendering and manipulating 3D scenes.
Babylon.js is another powerful JavaScript framework for building 3D games and experiences. It also supports GLTF loading and parsing through its `GLTFFileLoader`. While Babylon.js is more focused on game development, @loaders.gl/gltf is more specialized in data loading and parsing.
gltf-pipeline is a tool for optimizing GLTF files. It can be used to compress, optimize, and transform GLTF assets. While @loaders.gl/gltf focuses on loading and parsing, gltf-pipeline is more about post-processing and optimization of GLTF files.
loaders.gl is a collection of framework-independent 3D and geospatial parsers and encoders.
This module contains loader and writers for the glTF format.
For documentation please visit the website.
FAQs
Framework-independent loader for the glTF format
The npm package @loaders.gl/gltf receives a total of 136,346 weekly downloads. As such, @loaders.gl/gltf popularity was classified as popular.
We found that @loaders.gl/gltf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.