3d-model-manger 中文文档教程

发布于 4年前 浏览 29 项目主页 更新于 3年前

3D Model Manger

About

3D Model Manger 是一个用于管理 3d 模型的 NPM 包。

Table Of Contents

Install

在你的 shell 中输入 $ npm install 3d-model-manger

Usage

const modelManger = require('3d-model-manger'); // imports 3d-model-manger
const modelPath = "cube.obj"; // enter your model path here! (currently only supports .obj files)

console.log(parseRead(readModel("cube.obj"))); // returns object with vertex data and class data

Docs

readModel

从 3d 模型文件 (obj) 中读取文件数据并返回一个数组

语法: readModel(filePath)

参数:

参数 | 类型 | 默认 | 描述 :-:|:-:|:-:|:-: 文件路径 | 字符串 | ❌ | 读取文件的路径

Example:

const modelManger = require('3d-model-manger'); // imports 3d-model-manger
const modelPath = "cube.obj"; // enter your model path here! (currently only supports .obj files)

console.log(readModel("cube.obj"));
/* returns : {
  modelType: 'obj',
  modelData: "# Blender v2.76 (sub 0) OBJ File: ''\n" +
    '# www.blender.org\n' +
    'mtllib cube.mtl\n' +
    'o Cube\n' +
    'v 1.000000 -1.000000 -1.000000\n' +
    'v 1.000000 -1.000000 1.000000\n' +
    'v -1.000000 -1.000000 1.000000\n' +
    'v -1.000000 -1.000000 -1.000000\n' +
    ...
  }
*/

parseRead

解析 readModel() 函数给出的对象并将其转换为简单的-to-use object

语法: parseRead(Modeldata, [options])

参数:

Parameter | 类型 | 默认 | 描述 :-:|:-:|:-:|:-: 模型数据 | 字符串 | ❌ | 读取文件的路径
选项 | 对象 | ✔ | 选项

示例:

const modelManger = require('3d-model-manger'); // imports 3d-model-manger
const modelPath = "cube.obj"; // enter your model path here! (currently only supports .obj files)

console.log(parseRead(readModel("cube.obj")));
/* returns : {
     Vertices: [[Vertex], [Vertex], [Vertex], [Vertex], etc],
     Faces: [[Face], [Face], [Face], [Face], etc]
  }
*/

3D Model Manger

About

3D Model Manger is an NPM package for managing 3d models.

Table Of Contents

Install

Type in $ npm install 3d-model-manger in you shell.

Usage

const modelManger = require('3d-model-manger'); // imports 3d-model-manger
const modelPath = "cube.obj"; // enter your model path here! (currently only supports .obj files)

console.log(parseRead(readModel("cube.obj"))); // returns object with vertex data and class data

Docs

readModel

Reads file data from 3d model files (obj) and returns an array

Syntax: readModel(filePath)

Parameters:

Parameter | Type | Default | Description :-:|:-:|:-:|:-: filePath | String | ❌ | The Path of the read file

Example:

const modelManger = require('3d-model-manger'); // imports 3d-model-manger
const modelPath = "cube.obj"; // enter your model path here! (currently only supports .obj files)

console.log(readModel("cube.obj"));
/* returns : {
  modelType: 'obj',
  modelData: "# Blender v2.76 (sub 0) OBJ File: ''\n" +
    '# www.blender.org\n' +
    'mtllib cube.mtl\n' +
    'o Cube\n' +
    'v 1.000000 -1.000000 -1.000000\n' +
    'v 1.000000 -1.000000 1.000000\n' +
    'v -1.000000 -1.000000 1.000000\n' +
    'v -1.000000 -1.000000 -1.000000\n' +
    ...
  }
*/

parseRead

Parses the object given by the readModel() function and converts it into an easy-to-use object

Syntax: parseRead(Modeldata, [options])

Parameters:

Parameter | Type | Default | Description :-:|:-:|:-:|:-: Modeldata | String | ❌ | The Path
of the read file options | Object | ✔ | options

Example:

const modelManger = require('3d-model-manger'); // imports 3d-model-manger
const modelPath = "cube.obj"; // enter your model path here! (currently only supports .obj files)

console.log(parseRead(readModel("cube.obj")));
/* returns : {
     Vertices: [[Vertex], [Vertex], [Vertex], [Vertex], etc],
     Faces: [[Face], [Face], [Face], [Face], etc]
  }
*/
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文