@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 +15 -8
- package/index.cjs.js +1 -1
- package/index.d.ts +1 -0
- package/index.es.js +6 -4
- package/{model-context-BmfXsk0j.cjs → model-context-DLPGvQ8f.cjs} +5 -5
- package/{model-context-qjRd1gfd.js → model-context-hgFMs-nK.js} +460 -388
- package/package.json +1 -1
- package/use-export-model-BBfXwJbA.cjs +12 -0
- package/use-export-model-CUUL3YCH.js +2465 -0
- package/use-export-model.cjs.js +1 -12
- package/use-export-model.es.js +2 -2463
- package/use-load-model/model-context.d.ts +38 -0
- package/use-load-model/state.d.ts +8 -0
- package/use-load-model/types.d.ts +2 -1
- package/use-load-model/use-load-model.d.ts +54 -0
- package/use-load-model.cjs.js +1 -1
- package/use-load-model.es.js +1 -1
- package/use-optimize-model/state.d.ts +13 -0
- package/use-optimize-model/types.d.ts +37 -0
- package/use-optimize-model/use-optimize-model.d.ts +23 -4
- package/use-optimize-model-7wjiNiSZ.cjs +1 -0
- package/use-optimize-model-CVcoeFrO.js +117 -0
- package/use-optimize-model.cjs.js +1 -1
- package/use-optimize-model.es.js +1 -1
- package/use-optimize-model-CXJnsRYK.cjs +0 -1
- package/use-optimize-model-CsddjnWO.js +0 -51
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-
|
|
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
package/index.es.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { a as s, M as a, b as d, u as
|
|
2
|
-
import { u as
|
|
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
|
-
|
|
8
|
+
p as useExportModel,
|
|
9
|
+
r as useLoadModel,
|
|
8
10
|
t as useModelContext,
|
|
9
|
-
|
|
11
|
+
M as useOptimizeModel
|
|
10
12
|
};
|