Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
obj-mtl-loader
Advanced tools
An obj file loader for WebGL, including .mtl loder
Using npm
npm install obj-mtl-loader
To run example, npm install
, then run npm start
, you should see the obj loader working on your http://localhost:3001/.
If you want to edit the example, make sure you run webpack
after you make any changes or you can run webpack --progress --colors --watch
as the watch mode for webpack.
only obj file
var ObjMtlLoader = require("obj-mtl-loader");
var objMtlLoader = new ObjMtlLoader();
objMtlLoader.load("./test/objfiles/bunny.obj", function(err, result) {
if(err){
/*Handle error here*/
}
var vertices = result.vertices;
var faces = result.faces;
var normals = result.normals;
});
with materials(.mtl)
var ObjMtlLoader = require("obj-mtl-loader");
var objMtlLoader = new ObjMtlLoader();
objMtlLoader.load("./test/objfiles/sponza/sponza.obj", "./test/objfiles/sponza/sponza.mtl", function(err, result) {
if(err){
/*Handle error here*/
}
var vertices = result.vertices;
var faces = result.faces;
var normals = result.normals;
var textureCoords = result.textureCoords;
var facesMaterialsIndex = result.facesMaterialsIndex;
var materials = result.materials;
});
See more examples on examples folder
vertices: Double Array, each item is an array with 3 or 4 numbers
normals: Double Array, each item is an array with 3 numbers
textureCoords: Double Array, each item is an array with 2 or 3 numbers
faces: Objects inside Array, each Object is
facesMaterialsIndex(Optional): Objects inside Array, each object is
materials: Objects inside Array, each object is
MIT
FAQs
OBJ and MTL loader for WebGL
We found that obj-mtl-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.