Skip to content

Commit

Permalink
Updated to wtd-core / wtd-three-ext 2.4.0-next.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai Salmen committed Nov 4, 2023
1 parent 55eec92 commit 1206687
Show file tree
Hide file tree
Showing 8 changed files with 370 additions and 1,011 deletions.
1,337 changes: 351 additions & 986 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dev": "vite",
"dev:debug": "vite --debug --force",
"verify": "npm run verify --workspace packages/examples",
"release:prepare": "npm run reset:repo && npm ci && npm run build && npm run doc && shx cp -f README.md packages/objloader2/README.md",
"release:prepare": "npm run reset:repo && npm ci && npm run lint && npm run build && npm run doc && shx cp -f README.md packages/objloader2/README.md",
"test": "vitest",
"update:versions:dev": "node ./scripts/UpdateVersions.mjs dev",
"update:versions:real": "node ./scripts/UpdateVersions.mjs real",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@react-three/fiber": "~8.15.9",
"wwobjloader2": "~6.2.0-next.3",
"wwobjloader2": "~6.2.0-next.4",
"lil-gui": "~0.19.0",
"react": "~18.2.0",
"react-dom": "~18.2.0",
Expand Down
13 changes: 6 additions & 7 deletions packages/examples/src/worker/BasicExampleOffscreenWorker.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import {
pack,
comRouting,
createFromExisting,
DataPayload,
WorkerTaskCommandResponse,
WorkerTaskWorker,
WorkerTaskMessageType
WorkerTaskMessage,
WorkerTaskMessageType,
WorkerTaskWorker
} from 'wtd-core';
import { OBJLoader2BasicExample } from '../examples/OBJLoader2BasicExample.js';
import { executeExample, resizeDisplayGL } from '../examples/ExampleCommons.js';
Expand All @@ -17,7 +16,7 @@ export class HelloWorlThreedWorker implements WorkerTaskWorker {
init(message: WorkerTaskMessageType) {
console.log(`HelloWorldWorker#init: name: ${message.name} id: ${message.id} cmd: ${message.cmd} workerId: ${message.workerId}`);

const initComplete = createFromExisting(message, WorkerTaskCommandResponse.INIT_COMPLETE);
const initComplete = WorkerTaskMessage.createFromExisting(message, WorkerTaskCommandResponse.INIT_COMPLETE);
self.postMessage(initComplete);
}

Expand All @@ -33,8 +32,8 @@ export class HelloWorlThreedWorker implements WorkerTaskWorker {
resizeDisplayGL(this.objLoader2BasicExample.getSetup());
}
if (dataPayload.message.params?.$type === 'terminate') {
const execComplete = createFromExisting(message, WorkerTaskCommandResponse.EXECUTE_COMPLETE);
const transferables = pack(execComplete.payloads, false);
const execComplete = WorkerTaskMessage.createFromExisting(message, WorkerTaskCommandResponse.EXECUTE_COMPLETE);
const transferables = WorkerTaskMessage.pack(execComplete.payloads, false);
self.postMessage(execComplete, transferables);
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/objloader2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wwobjloader2",
"version": "6.2.0-next.3",
"version": "6.2.0-next.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down Expand Up @@ -70,8 +70,8 @@
},
"dependencies": {
"three": "~0.158.0",
"wtd-core": "~2.4.0-next.3",
"wtd-three-ext": "~2.4.0-next.3"
"wtd-core": "~2.4.0-next.4",
"wtd-three-ext": "~2.4.0-next.4"
},
"peerDependencies": {
"three": ">= 0.137.5 < 1"
Expand Down
8 changes: 3 additions & 5 deletions packages/objloader2/src/OBJLoader2Parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import {
WorkerTask,
WorkerTaskCommandResponse,
WorkerTaskMessage,
WorkerTaskMessageType,
pack,
unpack,
WorkerTaskMessageType
} from 'wtd-core';
import { CallbackOnLoadType, CallbackOnMeshAlterType, FileLoaderOnErrorType, FileLoaderOnProgressType, OBJLoader2 } from './OBJLoader2.js';
import { PreparedMeshType } from './OBJLoader2Parser.js';
Expand Down Expand Up @@ -175,7 +173,7 @@ export class OBJLoader2Parallel extends OBJLoader2 {
dataPayload.message.params.materialNames = new Set(Array.from(this.materialStore.getMaterials().keys()));

execMessage.addPayload(dataPayload);
const transferables = pack(execMessage.payloads, false);
const transferables = WorkerTaskMessage.pack(execMessage.payloads, false);

try {
await this.workerTask?.executeWorker({
Expand Down Expand Up @@ -203,7 +201,7 @@ export class OBJLoader2Parallel extends OBJLoader2 {
* @param {object} materialMetaInfo
*/
private onWorkerMessage(message: WorkerTaskMessageType) {
const wtm = unpack(message, false);
const wtm = WorkerTaskMessage.unpack(message, false);
if (wtm.cmd === WorkerTaskCommandResponse.INTERMEDIATE_CONFIRM) {

const dataPayload = (wtm.payloads.length === 1) ? wtm.payloads[0] as DataPayload : undefined;
Expand Down
9 changes: 3 additions & 6 deletions packages/objloader2/src/worker/OBJLoader2Worker.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import {
applyProperties,
comRouting,
createFromExisting,
pack,
unpack,
AssociatedArrayType,
DataPayload,
WorkerTaskCommandResponse,
Expand Down Expand Up @@ -61,7 +58,7 @@ class OBJLoader2Worker implements WorkerTaskWorker {
intermediateMessage.cmd = WorkerTaskCommandResponse.INTERMEDIATE_CONFIRM;
intermediateMessage.addPayload(dataPayload);

const transferables = pack(intermediateMessage.payloads, false);
const transferables = WorkerTaskMessage.pack(intermediateMessage.payloads, false);
self.postMessage(intermediateMessage, transferables);
};

Expand All @@ -88,7 +85,7 @@ class OBJLoader2Worker implements WorkerTaskWorker {
console.log(`OBJLoader2Worker#init: name: ${message.name} id: ${message.id} cmd: ${message.cmd} workerId: ${message.workerId}`);
}

const initComplete = createFromExisting(wtm, WorkerTaskCommandResponse.INIT_COMPLETE);
const initComplete = WorkerTaskMessage.createFromExisting(wtm, WorkerTaskCommandResponse.INIT_COMPLETE);
self.postMessage(initComplete);
}

Expand Down Expand Up @@ -116,7 +113,7 @@ class OBJLoader2Worker implements WorkerTaskWorker {
}

private processMessage(message: WorkerTaskMessageType) {
const wtm = unpack(message, false);
const wtm = WorkerTaskMessage.unpack(message, false);
const dataPayload = wtm.payloads[0] as DataPayload;

applyProperties(this.localData.params, dataPayload.message.params, true);
Expand Down
4 changes: 2 additions & 2 deletions scripts/UpdateVersions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import shell from 'shelljs';

const versionPattern = '.*[0-9]\\.[0-9]\\.[0-9].*';

const version_wtd_core_real = '~2.4.0-next.3';
const version_wtd_core_real = '~2.4.0-next.4';
const version_wtd_core_dev = '../../../wtd/packages/wtd-core';

const version_wtd_three_ext_real = '~2.4.0-next.3';
const version_wtd_three_ext_real = '~2.4.0-next.4';
const version_wtd_three_ext_dev = '../../../wtd/packages/wtd-three-ext';

const what = process.argv[2];
Expand Down

0 comments on commit 1206687

Please sign in to comment.