跳到主要内容

快速入门

安装

npm install real_api

使用

  • 普通 Three.js 场景
import * as REAL from "real_api";

const blob = await REAL.Scene(scene, camera);
  • 任意 3D 网格
const filePath = "test.gltf" // 本地 GLTF, GLB, FBX 等
const buffer = await new Promise((resolve, reject) => {
// 代码用于将本地文件加载到缓冲区
});
const blob = new Blob([buffer], {type: 'application/octet-stream'});

创建新任务

import * as REAL from "real_api";

const uri = `https://${REAL.Domain}/rapi/render`;

const params = {
"prodCred": {
"insID": 0,
"appKey": "ABC",
"prodKey": "XYZ"
},
"type": "new",
"render": {
"expFrom": "3js"
}
}

const response = await axios.post(uri, params);

上传场景

 const request = await axios.put(uploadUri, blob);

提交任务

const params = {
"prodCred": {
"insID": 0,
"appKey": "ABC",
"prodKey": "XYZ"
},
"type": "render",
"jobID": "1703925059_301526"
}

const response = await axios.post(uri, params);