@gltf-transform/functions
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -18,5 +18,5 @@ import { Document, Property, PropertyResolver } from '@gltf-transform/core'; | ||
* Merges contents of source {@link Document} into target Document, without | ||
* modifying the source. Any extensions missing from the target document will | ||
* be added. {@link Scene Scenes} and {@link Buffer Buffers} are not combined — | ||
* the target Document may contain multiple scenes and buffers after this | ||
* modifying the source. Any extensions missing from the target will be added | ||
* {@link Scene Scenes} and {@link Buffer Buffers} are not combined — | ||
* the target Document may contain multiple Scenes and Buffers after this | ||
* operation. These may be cleaned up manually (see {@link unpartition}), | ||
@@ -37,2 +37,28 @@ * or document contents may be merged more granularly using | ||
* ``` | ||
* | ||
* To merge several Scenes into one: | ||
* | ||
* ```javascript | ||
* import { mergeDocuments } from '@gltf-transform/functions'; | ||
* | ||
* const map = mergeDocuments(targetDocument, sourceDocument); | ||
* | ||
* // Find original Scene. | ||
* const sceneA = targetDocument.getRoot().listScenes()[0]; | ||
* | ||
* // Find counterpart of the source Scene in the target Document. | ||
* const sceneB = map.get(sourceDocument.getRoot().listScenes()[0]); | ||
* | ||
* // Create a Node, and append source Scene's direct children. | ||
* const rootNode = targetDocument.createNode() | ||
* .setName('SceneB') | ||
* .setPosition([10, 0, 0]); | ||
* for (const node of sceneB.listChildren()) { | ||
* rootNode.addChild(node); | ||
* } | ||
* | ||
* // Append Node to original Scene, and dispose the empty Scene. | ||
* sceneA.addChild(rootNode); | ||
* sceneB.dispose(); | ||
* ``` | ||
*/ | ||
@@ -42,9 +68,6 @@ export declare function mergeDocuments(target: Document, source: Document, resolve?: PropertyResolver<Property>): Map<Property, Property>; | ||
* Moves the specified {@link Property Properties} from the source | ||
* {@link Document} to the target Document, and removes them from the source | ||
* Document. Dependencies of the source properties will be copied into the | ||
* target Document, but not removed from the source Document. Returns a Map | ||
* from source properties to their counterparts in the target Document. | ||
* {@link Root} properties cannot be copied. {@link TextureInfo} properties | ||
* cannot be given in the property list, but are handled automatically when | ||
* copying a {@link Material}. | ||
* {@link Document} to the target Document, and removes them from the source. | ||
* Dependencies of the source properties will be copied into the | ||
* target, but not removed from the source. Returns a Map from source | ||
* properties to their counterparts in the target Document. | ||
* | ||
@@ -100,2 +123,7 @@ * Example: | ||
* | ||
* {@link Root} properties cannot be moved. | ||
* | ||
* {@link TextureInfo} properties cannot be given in the property list, but | ||
* are handled automatically when moving a {@link Material}. | ||
* | ||
* To copy properties without removing them from the source Document, see | ||
@@ -109,8 +137,6 @@ * {@link copyToDocument}. | ||
* Copies the specified {@link Property Properties} from the source | ||
* {@link Document} to the target Document, leaving originals in the source | ||
* Document. Dependencies of the source properties will also be copied into the | ||
* target Document. Returns a Map from source properties to their counterparts | ||
* in the target Document. {@link Root} properties cannot be copied. | ||
* {@link TextureInfo} properties cannot be given in the property list, but are | ||
* handled automatically when copying a {@link Material}. | ||
* {@link Document} to the target Document, leaving originals in the source. | ||
* Dependencies of the source properties will also be copied into the | ||
* target. Returns a Map from source properties to their counterparts in the | ||
* target Document. | ||
* | ||
@@ -162,2 +188,7 @@ * Example: | ||
* | ||
* {@link Root} properties cannot be copied. | ||
* | ||
* {@link TextureInfo} properties cannot be given in the property list, but | ||
* are handled automatically when copying a {@link Material}. | ||
* | ||
* To move properties to the target Document without leaving copies behind in | ||
@@ -164,0 +195,0 @@ * the source Document, use {@link moveToDocument} or dispose the properties |
@@ -26,7 +26,9 @@ import { Scene, Node, Mesh, Primitive } from '@gltf-transform/core'; | ||
/** | ||
* Expected number of vertices proceessed by the vertex shader for one render | ||
* pass, assuming a 100% hit ratio on the vertex cache. Assumes vertex attributes | ||
* have been optimized for locality of reused references (see {@link reorder}). | ||
* Typical GPU vertex caches are small, holding 16-32 vertices, and rarely | ||
* achieve 100% hit ratios in practice. | ||
* Expected number of vertices processed by the vertex shader for one render | ||
* pass, assuming an Average Transform to Vertex Ratio (ATVR) of 1. Approaching | ||
* this result requires optimizing for locality of vertex references (see | ||
* {@link reorder}). | ||
* | ||
* References: | ||
* - [ACMR and ATVR](https://www.realtimerendering.com/blog/acmr-and-atvr/), Real-Time Rendering | ||
*/ | ||
@@ -45,8 +47,8 @@ RENDER_CACHED = "render-cached", | ||
* attribute {@link Accessor Accessors} shared by multiple primitives, but | ||
* never uploading the same mesh or primitive to GPU memory more than once. | ||
* never uploading the same Mesh or Primitive to GPU memory more than once. | ||
*/ | ||
UPLOAD_NAIVE = "upload-naive", | ||
/** | ||
* Number of vertex positions never used by any mesh primitive. If all | ||
* vertices are unused, this total will match `'gpu'`. | ||
* Number of vertex positions never used by any {@link Primitive}. If all | ||
* vertices are unused, this total will match `UPLOAD`. | ||
*/ | ||
@@ -56,26 +58,26 @@ UNUSED = "unused" | ||
/** | ||
* Computes total number of vertices in a {@link Scene}, calculated by the | ||
* specified method. Totals for the scene will not necessarily match the sum | ||
* Computes total number of vertices in a {@link Scene}, by the | ||
* specified method. Totals for the Scene will not necessarily match the sum | ||
* of the totals for each {@link Mesh} or {@link Primitive} within it. See | ||
* {@link VertexCountMethod} for further information. | ||
* {@link VertexCountMethod} for available methods. | ||
*/ | ||
export declare function getSceneVertexCount(scene: Scene, method: VertexCountMethod): number; | ||
/** | ||
* Computes total number of vertices in a {@link Node}, calculated by the | ||
* Computes total number of vertices in a {@link Node}, by the | ||
* specified method. Totals for the node will not necessarily match the sum | ||
* of the totals for each {@link Mesh} or {@link Primitive} within it. See | ||
* {@link VertexCountMethod} for further information. | ||
* {@link VertexCountMethod} for available methods. | ||
*/ | ||
export declare function getNodeVertexCount(node: Node | Scene, method: VertexCountMethod): number; | ||
/** | ||
* Computes total number of vertices in a {@link Mesh}, calculated by the | ||
* specified method. Totals for the mesh will not necessarily match the sum | ||
* Computes total number of vertices in a {@link Mesh}, by the | ||
* specified method. Totals for the Mesh will not necessarily match the sum | ||
* of the totals for each {@link Primitive} within it. See | ||
* {@link VertexCountMethod} for further information. | ||
* {@link VertexCountMethod} for available methods. | ||
*/ | ||
export declare function getMeshVertexCount(mesh: Mesh, method: VertexCountMethod): number; | ||
/** | ||
* Computes total number of vertices in a {@link Primitive}, calculated by the | ||
* specified method. See {@link VertexCountMethod} for further information. | ||
* Computes total number of vertices in a {@link Primitive}, by the | ||
* specified method. See {@link VertexCountMethod} for available methods. | ||
*/ | ||
export declare function getPrimitiveVertexCount(prim: Primitive, method: VertexCountMethod): number; |
{ | ||
"name": "@gltf-transform/functions", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -38,8 +38,8 @@ "homepage": "https://gltf-transform.dev/functions.html", | ||
"dependencies": { | ||
"@gltf-transform/core": "^4.0.0", | ||
"@gltf-transform/extensions": "^4.0.0", | ||
"@gltf-transform/core": "^4.0.1", | ||
"@gltf-transform/extensions": "^4.0.1", | ||
"ktx-parse": "^0.7.0", | ||
"ndarray": "^1.0.19", | ||
"ndarray-lanczos": "^0.3.0", | ||
"ndarray-pixels": "^4.0.0" | ||
"ndarray-pixels": "^4.1.0" | ||
}, | ||
@@ -57,3 +57,3 @@ "files": [ | ||
}, | ||
"gitHead": "c7a8045082b4e17e45d5f0429988346629361fd9" | ||
"gitHead": "2a5ad54ae79afcb34cc60c2f000e90e27f1053f6" | ||
} |
@@ -36,5 +36,5 @@ import { Document, Extension, Graph, Property, PropertyResolver, PropertyType } from '@gltf-transform/core'; | ||
* Merges contents of source {@link Document} into target Document, without | ||
* modifying the source. Any extensions missing from the target document will | ||
* be added. {@link Scene Scenes} and {@link Buffer Buffers} are not combined — | ||
* the target Document may contain multiple scenes and buffers after this | ||
* modifying the source. Any extensions missing from the target will be added | ||
* {@link Scene Scenes} and {@link Buffer Buffers} are not combined — | ||
* the target Document may contain multiple Scenes and Buffers after this | ||
* operation. These may be cleaned up manually (see {@link unpartition}), | ||
@@ -55,2 +55,28 @@ * or document contents may be merged more granularly using | ||
* ``` | ||
* | ||
* To merge several Scenes into one: | ||
* | ||
* ```javascript | ||
* import { mergeDocuments } from '@gltf-transform/functions'; | ||
* | ||
* const map = mergeDocuments(targetDocument, sourceDocument); | ||
* | ||
* // Find original Scene. | ||
* const sceneA = targetDocument.getRoot().listScenes()[0]; | ||
* | ||
* // Find counterpart of the source Scene in the target Document. | ||
* const sceneB = map.get(sourceDocument.getRoot().listScenes()[0]); | ||
* | ||
* // Create a Node, and append source Scene's direct children. | ||
* const rootNode = targetDocument.createNode() | ||
* .setName('SceneB') | ||
* .setPosition([10, 0, 0]); | ||
* for (const node of sceneB.listChildren()) { | ||
* rootNode.addChild(node); | ||
* } | ||
* | ||
* // Append Node to original Scene, and dispose the empty Scene. | ||
* sceneA.addChild(rootNode); | ||
* sceneB.dispose(); | ||
* ``` | ||
*/ | ||
@@ -75,9 +101,6 @@ export function mergeDocuments( | ||
* Moves the specified {@link Property Properties} from the source | ||
* {@link Document} to the target Document, and removes them from the source | ||
* Document. Dependencies of the source properties will be copied into the | ||
* target Document, but not removed from the source Document. Returns a Map | ||
* from source properties to their counterparts in the target Document. | ||
* {@link Root} properties cannot be copied. {@link TextureInfo} properties | ||
* cannot be given in the property list, but are handled automatically when | ||
* copying a {@link Material}. | ||
* {@link Document} to the target Document, and removes them from the source. | ||
* Dependencies of the source properties will be copied into the | ||
* target, but not removed from the source. Returns a Map from source | ||
* properties to their counterparts in the target Document. | ||
* | ||
@@ -133,2 +156,7 @@ * Example: | ||
* | ||
* {@link Root} properties cannot be moved. | ||
* | ||
* {@link TextureInfo} properties cannot be given in the property list, but | ||
* are handled automatically when moving a {@link Material}. | ||
* | ||
* To copy properties without removing them from the source Document, see | ||
@@ -156,8 +184,6 @@ * {@link copyToDocument}. | ||
* Copies the specified {@link Property Properties} from the source | ||
* {@link Document} to the target Document, leaving originals in the source | ||
* Document. Dependencies of the source properties will also be copied into the | ||
* target Document. Returns a Map from source properties to their counterparts | ||
* in the target Document. {@link Root} properties cannot be copied. | ||
* {@link TextureInfo} properties cannot be given in the property list, but are | ||
* handled automatically when copying a {@link Material}. | ||
* {@link Document} to the target Document, leaving originals in the source. | ||
* Dependencies of the source properties will also be copied into the | ||
* target. Returns a Map from source properties to their counterparts in the | ||
* target Document. | ||
* | ||
@@ -209,2 +235,7 @@ * Example: | ||
* | ||
* {@link Root} properties cannot be copied. | ||
* | ||
* {@link TextureInfo} properties cannot be given in the property list, but | ||
* are handled automatically when copying a {@link Material}. | ||
* | ||
* To move properties to the target Document without leaving copies behind in | ||
@@ -211,0 +242,0 @@ * the source Document, use {@link moveToDocument} or dispose the properties |
@@ -29,7 +29,9 @@ import { Scene, Node, Mesh, Primitive, Accessor } from '@gltf-transform/core'; | ||
/** | ||
* Expected number of vertices proceessed by the vertex shader for one render | ||
* pass, assuming a 100% hit ratio on the vertex cache. Assumes vertex attributes | ||
* have been optimized for locality of reused references (see {@link reorder}). | ||
* Typical GPU vertex caches are small, holding 16-32 vertices, and rarely | ||
* achieve 100% hit ratios in practice. | ||
* Expected number of vertices processed by the vertex shader for one render | ||
* pass, assuming an Average Transform to Vertex Ratio (ATVR) of 1. Approaching | ||
* this result requires optimizing for locality of vertex references (see | ||
* {@link reorder}). | ||
* | ||
* References: | ||
* - [ACMR and ATVR](https://www.realtimerendering.com/blog/acmr-and-atvr/), Real-Time Rendering | ||
*/ | ||
@@ -50,3 +52,3 @@ RENDER_CACHED = 'render-cached', | ||
* attribute {@link Accessor Accessors} shared by multiple primitives, but | ||
* never uploading the same mesh or primitive to GPU memory more than once. | ||
* never uploading the same Mesh or Primitive to GPU memory more than once. | ||
*/ | ||
@@ -67,3 +69,3 @@ UPLOAD_NAIVE = 'upload-naive', | ||
/** | ||
* Total number of unique vertices represented, considering aonly vertex | ||
* Total number of unique vertices represented, considering only vertex | ||
* positions, and removing any duplicates. Has no direct relationship to | ||
@@ -79,4 +81,4 @@ * runtime characteristics, but may be helpful in identifying asset | ||
/** | ||
* Number of vertex positions never used by any mesh primitive. If all | ||
* vertices are unused, this total will match `'gpu'`. | ||
* Number of vertex positions never used by any {@link Primitive}. If all | ||
* vertices are unused, this total will match `UPLOAD`. | ||
*/ | ||
@@ -87,6 +89,6 @@ UNUSED = 'unused', | ||
/** | ||
* Computes total number of vertices in a {@link Scene}, calculated by the | ||
* specified method. Totals for the scene will not necessarily match the sum | ||
* Computes total number of vertices in a {@link Scene}, by the | ||
* specified method. Totals for the Scene will not necessarily match the sum | ||
* of the totals for each {@link Mesh} or {@link Primitive} within it. See | ||
* {@link VertexCountMethod} for further information. | ||
* {@link VertexCountMethod} for available methods. | ||
*/ | ||
@@ -98,6 +100,6 @@ export function getSceneVertexCount(scene: Scene, method: VertexCountMethod): number { | ||
/** | ||
* Computes total number of vertices in a {@link Node}, calculated by the | ||
* Computes total number of vertices in a {@link Node}, by the | ||
* specified method. Totals for the node will not necessarily match the sum | ||
* of the totals for each {@link Mesh} or {@link Primitive} within it. See | ||
* {@link VertexCountMethod} for further information. | ||
* {@link VertexCountMethod} for available methods. | ||
*/ | ||
@@ -153,6 +155,6 @@ export function getNodeVertexCount(node: Node | Scene, method: VertexCountMethod): number { | ||
/** | ||
* Computes total number of vertices in a {@link Mesh}, calculated by the | ||
* specified method. Totals for the mesh will not necessarily match the sum | ||
* Computes total number of vertices in a {@link Mesh}, by the | ||
* specified method. Totals for the Mesh will not necessarily match the sum | ||
* of the totals for each {@link Primitive} within it. See | ||
* {@link VertexCountMethod} for further information. | ||
* {@link VertexCountMethod} for available methods. | ||
*/ | ||
@@ -182,4 +184,4 @@ export function getMeshVertexCount(mesh: Mesh, method: VertexCountMethod): number { | ||
/** | ||
* Computes total number of vertices in a {@link Primitive}, calculated by the | ||
* specified method. See {@link VertexCountMethod} for further information. | ||
* Computes total number of vertices in a {@link Primitive}, by the | ||
* specified method. See {@link VertexCountMethod} for available methods. | ||
*/ | ||
@@ -186,0 +188,0 @@ export function getPrimitiveVertexCount(prim: Primitive, method: VertexCountMethod): number { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2384795
28816
Updated@gltf-transform/core@^4.0.1
Updatedndarray-pixels@^4.1.0