Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@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.
v0.7.2
FAQs
Framework-independent loader for the glTF format
The npm package @loaders.gl/gltf receives a total of 139,162 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.