@needle-tools/gltf-build-pipeline 2.8.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.9.0] - 2024-05-22
8
+ - add: initial texture compression mode support for `world` and `product`
9
+
7
10
  ## [2.8.1] - 2024-04-17
8
11
  - bump version
9
12
 
@@ -1,7 +1,7 @@
1
1
  import { Extension, ExtensionProperty, PropertyType, ReaderContext, WriterContext } from "@gltf-transform/core";
2
2
  export declare const EXTENSION_NAME = "NEEDLE_compression_texture";
3
3
  export declare interface NEEDLE_compression_texture_schema {
4
- mode: "none" | "auto" | "webp" | "UASTC" | "ETC1S";
4
+ mode: "none" | "auto" | "webp" | "UASTC" | "ETC1S" | "world" | "product";
5
5
  slot: string;
6
6
  /** quality in range of 0 - 1 */
7
7
  quality: number;
@@ -117,7 +117,24 @@ async function processTexture(texture, index, document, logger, context) {
117
117
  const canRunToktx = context.noToktx !== true;
118
118
  const originalUri = texture.getURI();
119
119
  if (compressionSettings && compressionSettings.mode !== "auto") {
120
- switch (compressionSettings.mode) {
120
+ let mode = compressionSettings.mode;
121
+ // Handle highlevel modes
122
+ switch (mode) {
123
+ case "world":
124
+ mode = "ETC1S";
125
+ break;
126
+ case "product":
127
+ switch (compressionSettings.slot) {
128
+ case "baseColorTexture":
129
+ case "normalTexture":
130
+ case "metallicRoughnessTexture":
131
+ case "lightmapTexture":
132
+ mode = "webp";
133
+ break;
134
+ }
135
+ break;
136
+ }
137
+ switch (mode) {
121
138
  case "webp":
122
139
  if (cached) {
123
140
  texture.setImage(cached).setMimeType("image/webp");
@@ -1 +1 @@
1
- export declare const version = "2.8.1";
1
+ export declare const version = "2.9.0";
@@ -1 +1 @@
1
- export const version = "2.8.1";
1
+ export const version = "2.9.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "2.8.1",
3
+ "version": "2.9.0",
4
4
  "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",