Skip to content

Commit

Permalink
Release preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kai Salmen committed Jan 5, 2024
1 parent c353715 commit ee877c2
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ node_modules
/packages/examples/models/obj/extra
/packages/examples/models/obj/misc

/packages/objloader2/README.md

tsconfig.tsbuildinfo
*.tgz
.env
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 6.2.0 - 2024-01-05

- Switch to `[email protected]` and `[email protected]`
- Adjust code to the changes
- Example OBJLoader2 basic (Offscreen Canvas) now relies on utility functions supplied by `wtd-core` and `wtd-three-ext`

## 6.1.0 - 2023-10-21

- Upgrade to versions `2.3.0` of `wtd-core` and `wtd-three-ext`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
DataPayload,
RawPayload,
WorkerTask,
WorkerTaskMessage,
buildDefaultEventHandlingInstructions,
Expand Down Expand Up @@ -44,13 +44,12 @@ export class OBJLoader2BasicExampleOffscreen {
await initOffscreenCanvas(workerTask, canvas);

// once the init Promise returns enqueue the execution
// TODO: make this a raw payload
const dataPayload = new DataPayload();
dataPayload.message.params = {
const rawPayload = new RawPayload();
rawPayload.message.raw = {
modelUrl: new URL('./models/obj/main/female02/female02_vertex_colors.obj', window.location.href).href
};
await workerTask.executeWorker({
message: WorkerTaskMessage.fromPayload(dataPayload),
message: WorkerTaskMessage.fromPayload(rawPayload),
});
console.log('enqueueWorkerExecutionPlan finished successfully.');
} catch (e: unknown) {
Expand Down
6 changes: 3 additions & 3 deletions packages/examples/src/worker/BasicExampleOffscreenWorker.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
comRouting,
DataPayload,
getOffscreenCanvas,
OffscreenPayload,
OffscreenWorker,
OffscreenWorkerCommandResponse,
RawPayload,
WorkerTaskMessage,
WorkerTaskWorker
} from 'wtd-core';
Expand Down Expand Up @@ -66,8 +66,8 @@ export class HelloWorlThreeWorker implements WorkerTaskWorker, OffscreenWorker {
execute(message: WorkerTaskMessage) {
console.log(`HelloWorldWorker#execute: name: ${message.name} id: ${message.uuid} cmd: ${message.cmd} workerId: ${message.workerId}`);

const dataPayload = message.payloads[0] as DataPayload;
this.objLoader2BasicExample!.setUrls(dataPayload.message.params?.modelUrl as string);
const rawPayload = message.payloads[0] as RawPayload;
this.objLoader2BasicExample!.setUrls(rawPayload.message.raw.modelUrl as string);

executeExample(this.objLoader2BasicExample!);
}
Expand Down
82 changes: 82 additions & 0 deletions packages/objloader2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# OBJLoader2 & OBJLoader2Parallel for three.js

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/kaisalmen/WWOBJLoader/blob/dev/LICENSE)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/kaisalmen/WWOBJLoader)
[![WWOBJLoader](https://github.com/kaisalmen/WWOBJLoader/actions/workflows/actions.yml/badge.svg)](https://github.com/kaisalmen/WWOBJLoader/actions/workflows/actions.yml)
[![NPM Version](https://img.shields.io/npm/v/wwobjloader2.svg)](https://www.npmjs.com/package/wwobjloader2)
[![NPM Download](https://img.shields.io/npm/dt/wwobjloader2.svg)](https://www.npmjs.com/package/wwobjloader2)

**OBJLoader2** is a loader for the **OBJ** file format. It is an alternative to [OBJLoader](https://github.com/mrdoob/three.js/blob/dev/examples/jsm/loaders/OBJLoader.js) included in [three.js](https://threejs.org). The loader and its parser can be used on Main via **OBJLoader2** or in parallel inside a web worker via **OBJLoader2Parallel**.

## Project History

New versions of **OBJLoader2** and **OBJLoader2Parallel** are from now on again released as npm modules independent of three.js. The first stable version that was released independent again is 4.0.0. Versions 3.x.y were never released as independent npm and only in combination with three.ts itself.

Between release of version 5.0.0 and 6.0.0 all code has been transformed to TypeScript.

### Changelog

Interested in recent changes? Check the [CHANGELOG](https://github.com/kaisalmen/WWOBJLoader/blob/main/CHANGELOG.md).

## Development

### Getting Started

There exist three possibilities:

* Checkout the repository and run `npm install`, `npm run build` and then `npm run dev` to spin up local Vite dev server
* Press the `Gitpod` button above and start coding and using the examples directly in the browser
* Checkout the repository and use `docker-compose up -d` to spin up local Vite dev server.

Whatever environment you choose to start [Vite](https://vitejs.dev/) is used to serve the code and the examples using it. With this setup you are able to change the code and examples without invoking an additional bundler. Vite ensures all imported npm modules are available if previously installed in local environment (see `npm install`).

If you run Vite locally you require a **nodejs LTS** and **npm**. The Gitpod and local docker environment ensure all prerequisites are fulfilled.

In any environment the server is reachable on port 8085.

### Examples

If you want to get started see take a look at the following examples. They get more advanced from top to bottom:

* OBJLoader2 basic: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2_basic.html)] [[ts](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/OBJLoader2BasicExample.ts)]
* OBJLoader2 basic (Offscreen Canvas): [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2_basic_offscreen.html)] [[ts](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/OBJLoader2BasicExampleOffscreen.ts)]
* OBJLoader2Parallel basic: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2parallel_basic.html)] [[ts](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/OBJLoader2ParallelsBasicExample.ts)]
* OBJLoader2 usage options: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2_options.html)] [[ts](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/OBJLoader2OptionsExample.ts)]
* OBJLoader2 / OBJLoader parser capability comparison: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2_obj_compare.html)] [[ts](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/OBJLoader2OBJLoaderCompareExample.ts)]
* OBJLoader2 in react with a .jpg texture: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2_react.html)] [[tsx](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/ReactExample.tsx)]
* OBJLoader2 in react with a .mtl material: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/obj2_react-mtl.html)] [[tsx](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/ReactExampleMtl.tsx)]
* AssetPipelineLoader basic example: [[html](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/assetpipeline.html)] [[ts](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/AssetPipelineLoaderExample.ts)]

### Main Branch

Main development now takes place on branch [main](https://github.com/kaisalmen/WWOBJLoader/tree/main). Tags identify the releases. The stable branch has been retired.

## Feature Overview

### OBJLoader2Parser

The parser `OBJLoader2Parser` used by `OBJLoader2` and `OBJLoader2Parallel` has all OBJ parsing capabilities of `OBJLoader` from three.js, plus some extra feature. Please see the following list:

* The `parse` methods of `OBJLoader2Parser` accepts `ArrayBuffer` or `String` as input. Text processing is approx. 15-20 pecent slower.
* In case `OBJLoader2Parallel` the of Parser `OBJLoader2Parser` is executed inside a worker.
* `OBJLoader2Parser` features indexed rendering including vertex reduction.
* Indexed rendering is available if switched on via `setUseIndices` (see `useIndices` in example **[OBJLoader2 usage options](https://github.com/kaisalmen/WWOBJLoader/blob/main/packages/examples/src/examples/OBJLoader2OptionsExample.ts#L63)**).
* Face N-Gons are supported.
* Multi-Materials are created when needed.
* Flat smoothing defined by "s 0" or "s off" is supported and Multi-Material is created when one object/group defines both smoothing groups equal and not equal to zero.
* Support for points and lines is available since V2.3.0.
* New mesh detection relies on 'g' occurrence or 'f', 'l' or 'p' type change (since V2.3.0). This allows multiple mesh definitions within one group.
* Negative face indices are supported (issue #28)
* The parser is now a single class that can be directly stored as string and therefore embedded in module or standard Workers (since V4.0.0).

## WorkerTaskDirector Core Library

`WorkerTask` from [wtd-core](https://github.com/kaisalmen/wtd/tree/main/packages/wtd-core) is used to control everything regarding workers. This library was separated with the 4.0.0 release. It now evolves as independent library that is utilized by `OBJLoader2Parallel`.

## Docs

Run `npm run doc` to create the documentation in [directory]((./packages/objloader2/docs).

Happy coding!

Kai

0 comments on commit ee877c2

Please sign in to comment.