@vctrl/hooks 0.4.0 → 0.6.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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## Overview
10
10
 
11
- `@vctrl/hooks` is a React hooks package designed to simplify 3D model loading, optimization, and exporting within React applications. It's part of the vectreal-core ecosystem and is primarily used in the `@vctrl/viewer` React component and the official website application.
11
+ `@vctrl/hooks` is a React hooks package designed to simplify 3D model loading, optimization, and exporting within React applications. It's part of the [vectreal-core](https://github.com/vectreal/vectreal-core) ecosystem and is primarily used in the `@vctrl/viewer` React component and the [official website application](https://core.vectreal.com).
12
12
 
13
13
  The package provides powerful hooks for:
14
14
 
@@ -177,11 +177,12 @@ function ModelLoader() {
177
177
  }
178
178
  ```
179
179
 
180
- The `optimize` object includes:
180
+ The `optimize` object includes quick access optimization:
181
181
 
182
- - `simplifyOptimization()`: Simplifies the model using mesh simplification.
183
- - `dedupOptimization()`: Removes duplicate vertices and meshes.
184
- - `quantizeOptimization()`: Reduces the precision of vertex attributes.
182
+ - `simplifyOptimization(options)`: Simplifies the model using mesh simplification.
183
+ - `dedupOptimization(options)`: Removes duplicate vertices and meshes.
184
+ - `quantizeOptimization(options)`: Reduces the precision of vertex attributes.
185
+ - `texturesCompressionOptimization(options)`: Compresses the relevant textures in the model file using texture compression.
185
186
 
186
187
  ### useOptimizeModel
187
188
 
@@ -295,9 +296,15 @@ The `useOptimizeModel` hook returns the following:
295
296
 
296
297
  - `load(model)`: Loads a Three.js `Object3D` model into the optimizer.
297
298
  - `getModel()`: Retrieves the optimized model as a binary array buffer.
298
- - `simplifyOptimization()`: Simplifies the current model using the `MeshoptSimplifier`.
299
- - `dedupOptimization()`: Removes duplicate vertices and meshes.
300
- - `quantizeOptimization()`: Reduces the precision of vertex attributes.
299
+ - `simplifyOptimization(options)`: Simplifies the current model using the `MeshoptSimplifier`.
300
+ - `dedupOptimization(options)`: Removes duplicate vertices and meshes.
301
+ - `quantizeOptimization(options)`: Reduces the precision of vertex attributes.
302
+ - `texturesOptimization(options)`: Compresses related textures.
303
+ - `getSize()`: Object with byte size of gltf scene and a formatted megabyte string
304
+ - `reset()`: Resets the current optimizer model and report state.
305
+ - `report`: @gltf-transform gltf report object with relevant details about a gltf scene
306
+ - `error`: Stores any possible optimization errors
307
+ - `loading`: Boolean for when the model is being loaded
301
308
 
302
309
  ### useExportModel
303
310
 
package/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./model-context-BmfXsk0j.cjs"),o=require("./use-optimize-model-CXJnsRYK.cjs");exports.ModelContext=e.ModelContext;exports.ModelFileTypes=e.ModelFileTypes;exports.ModelProvider=e.ModelProvider;exports.useLoadModel=e.useLoadModel;exports.useModelContext=e.useModelContext;exports.useOptimizeModel=o.useOptimizeModel;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./model-context-DLPGvQ8f.cjs"),o=require("./use-optimize-model-7wjiNiSZ.cjs"),t=require("./use-export-model-BBfXwJbA.cjs");exports.ModelContext=e.ModelContext;exports.ModelFileTypes=e.ModelFileTypes;exports.ModelProvider=e.ModelProvider;exports.useLoadModel=e.useLoadModel;exports.useModelContext=e.useModelContext;exports.useOptimizeModel=o.useOptimizeModel;exports.useExportModel=t.useExportModel;
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './use-load-model';
2
2
  export * from './use-optimize-model';
3
+ export * from './use-export-model';
package/index.es.js CHANGED
@@ -1,10 +1,12 @@
1
- import { a as s, M as a, b as d, u as l, c as t } from "./model-context-qjRd1gfd.js";
2
- import { u as r } from "./use-optimize-model-CsddjnWO.js";
1
+ import { a as s, M as a, b as d, u as r, c as t } from "./model-context-hgFMs-nK.js";
2
+ import { u as M } from "./use-optimize-model-CVcoeFrO.js";
3
+ import { u as p } from "./use-export-model-CUUL3YCH.js";
3
4
  export {
4
5
  s as ModelContext,
5
6
  a as ModelFileTypes,
6
7
  d as ModelProvider,
7
- l as useLoadModel,
8
+ p as useExportModel,
9
+ r as useLoadModel,
8
10
  t as useModelContext,
9
- r as useOptimizeModel
11
+ M as useOptimizeModel
10
12
  };