uv-map-xatlas

0.0.2 • Public • Published

uv-map-xatlas

use this tool to perform automatic uv mapping / uv unwrapping / mesh parameterization / texture mapping of a triangle mesh / simplicial complex.

this is just a simplified interface for xatlas.js using the wasm build, allowing easy use of xatlas in a Node.js environment

Installation

npm i uv-map-xatlas

Usage

//basic usage
var bunny1 = require('bunny');
var xatlas = require('uv-map-xatlas');
xatlas.atlasForIndexedTriangles(bunny1, function(atlas){
    var resultObject = xatlas.atlasToTrianglesObjsList(atlas);
    console.log(resultObject);
    // {
    //     positions, //unique verts [x,y,z]
    //     cells, //cell per triangle [a,b,c]
    //     uvs, //uv per unique vert, each [u,v]
    //     triangles, //triangles in 3d
    //     trianglesUVs, //triplets of uv coords, per-triangle
    //     trianglesUVPreview //3d triangles in 2d, to show UV layout
    // }
});

//usage using raw triangles -- each tri is [[x,y,z],[x,y,z],[x,y,z]]
// var ti = require("triangles-index");
// var bunny1tris = ti.deindexTriangles_meshView(bunny1);
// xatlas.atlasForTriangles(bunny1tris, function(res){})

Full list of functions

{
    atlasToUVList,
    atlasToVertList,
    atlasToCellList,
    atlasToTrianglesObjsList,
    atlasForIndexedTriangles,
    atlasForTriangles
}

See Also

xatlas-web

stonks

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    6
  • 0.0.1
    0

Package Sidebar

Install

npm i uv-map-xatlas

Weekly Downloads

6

Version

0.0.2

License

MIT

Unpacked Size

702 kB

Total Files

18

Last publish

Collaborators

  • stonkpunk