Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusLongmuir committed Apr 25, 2024
1 parent 28db78c commit 728508e
Show file tree
Hide file tree
Showing 22 changed files with 826 additions and 780 deletions.
7 changes: 3 additions & 4 deletions clis/glft-avatar-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
"lint-fix": "eslint \"./{src,test}/**/*.{js,jsx,ts,tsx}\" --fix"
},
"dependencies": {
"three": "0.161.0",
"@napi-rs/canvas": "0.1.51",
"jimp": "0.22.12",
"three": "0.163.0",
"@mml-io/model-loader": "0.14.0",
"gltf-avatar-export-lib": "file:../../packages/gltf-avatar-export-lib",
"yargs": "17.7.2"
},
"devDependencies": {
"@types/three": "0.160.0"
"@types/three": "0.163.0"
}
}
14 changes: 7 additions & 7 deletions clis/glft-avatar-exporter/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import fs from "fs";
import process from "process";

import { correctionSteps, correctionStepNames, ModelLoader } from "gltf-avatar-export-lib";
import { ModelLoader } from "@mml-io/model-loader";
import { correctionSteps, correctionStepNames } from "gltf-avatar-export-lib";
import { LoadingManager } from "three";
import { GLTFExporter } from "three/examples/jsm/exporters/GLTFExporter.js";
import { TGALoader } from "three/examples/jsm/loaders/TGALoader.js";
import { setupPolyfills } from "threejs-nodejs-polyfills";
import { Options } from "yargs";
import yargs from "yargs/yargs";

// A lot of classes used for texture loading and saving must be polyfilled as they are not present in Node
import "./setupPolyfills";
setupPolyfills(global);

function stepNameToSkipArgName(stepName: string): string {
return `skip-${stepName}`;
Expand Down Expand Up @@ -47,7 +49,6 @@ fs.readFile(argv.input, function (readFileErr, fileBuffer) {
try {
const asArrayBuffer = fileBuffer.buffer.slice(0);

const modelLoader = new ModelLoader();
const loadingManager = new LoadingManager();
loadingManager.addHandler(/\.tga$/i, new TGALoader(loadingManager));
let hasAssetsToLoad = false;
Expand All @@ -60,7 +61,8 @@ fs.readFile(argv.input, function (readFileErr, fileBuffer) {
};
});

const { group } = await modelLoader.loadFromBuffer(asArrayBuffer, "", loadingManager);
const modelLoader = new ModelLoader(loadingManager);
const { group } = await modelLoader.loadFromBuffer(asArrayBuffer, "");

// Only wait for loading if there are assets to load
if (hasAssetsToLoad) {
Expand All @@ -80,9 +82,7 @@ fs.readFile(argv.input, function (readFileErr, fileBuffer) {
async (gltf) => {
// process data
const buff = Buffer.from(gltf as ArrayBuffer);
const base64data = buff.toString("base64");

fs.writeFile(argv.output, base64data, "base64", (writeFileErr) => {
fs.writeFile(argv.output, buff, (writeFileErr) => {
if (writeFileErr) {
console.error("Error writing file", writeFileErr);
process.exit(1);
Expand Down
244 changes: 0 additions & 244 deletions clis/glft-avatar-exporter/src/setupPolyfills.ts

This file was deleted.

Loading

0 comments on commit 728508e

Please sign in to comment.