Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@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.
v2.0.0-beta.1
FAQs
Framework-independent loader for the glTF format
The npm package @loaders.gl/gltf receives a total of 173,953 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's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.