New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gltf-builder

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gltf-builder

A builder for the GLTF 3D transmission format

  • 0.9.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-84.78%
Maintainers
0
Weekly downloads
 
Created
Source

gltf-builder

Create 3D models using JS.

gltf-builder provides a means to programatically construct 3D assets in the glTF file format. It aims to make procedural generation easier by letting you build up a model piece-by-piece without having to worry about the structure of the glTF file format itself.

Installation

npm install gltf-builder

Getting started

The gltf-builder package contains builders for various glTF components used to construct a 3D asset. Each component allows for all of its properties to be set in a chaining style syntax, and can be then composed together to make the final product.

const {
  Asset,
  Scene,
  Mesh,
  Node,
  Primitive,
  buildVec3Accessor
} = require('gltf-builder');

const triangleAsset = new Asset().addScene(
  new Scene().addNode(
    new Node().mesh(
      new Mesh().addPrimitive(
        new Primitive().position(
          buildVec3Accessor([[0, 0, 0], [1, 0, 0], [0, 1, 0]])
        )
      )
    )
  )
);

// Calling .build on the asset produces the final product as an object
const gltf = triangleAsset.build();

// Saving to a file
const fs = require('fs');
fs.writeFileSync('triangle.gltf', JSON.stringify(gltf), 'utf8');

The created model can be viewed online using gltf-viewer or added to a scene using a framework like A-Frame.

Docs

FAQs

Package last updated on 17 Jan 2025

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