From 008689630467a527f77c957cec7116a083b6c2a4 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Fri, 23 Feb 2024 09:20:23 -0500 Subject: [PATCH] WebGPURenderer: Better skinning performance (#836) --- types/three/examples/jsm/nodes/Nodes.d.ts | 2 +- .../examples/jsm/nodes/accessors/ReferenceNode.d.ts | 11 ++++++----- .../examples/jsm/nodes/accessors/SkinningNode.d.ts | 8 ++++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/types/three/examples/jsm/nodes/Nodes.d.ts b/types/three/examples/jsm/nodes/Nodes.d.ts index 27a3362e3..4d788dcf3 100644 --- a/types/three/examples/jsm/nodes/Nodes.d.ts +++ b/types/three/examples/jsm/nodes/Nodes.d.ts @@ -270,7 +270,7 @@ export { positionWorld, positionWorldDirection, } from "./accessors/PositionNode.js"; -export { default as ReferenceNode, reference } from "./accessors/ReferenceNode.js"; +export { default as ReferenceNode, reference, referenceBuffer } from "./accessors/ReferenceNode.js"; export { default as ReflectVectorNode, reflectVector } from "./accessors/ReflectVectorNode.js"; export { default as SkinningNode, skinning } from "./accessors/SkinningNode.js"; export { default as StorageBufferNode, storage, storageObject } from "./accessors/StorageBufferNode.js"; diff --git a/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts b/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts index b52150aad..5c8c62602 100644 --- a/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/ReferenceNode.d.ts @@ -4,24 +4,25 @@ import { NodeOrType, NodeRepresentation, ShaderNodeObject } from "../shadernode/ export default class ReferenceNode extends Node { property: string; - indexNode: Node | null; uniformType: NodeTypeOption; object: T; - reference: T | null; + count: number | null; + properties: string[]; + reference: T | null; node: Node | null; - constructor(property: string, uniformType: NodeTypeOption, object?: T | null, indexNode?: Node | null); + constructor(property: string, uniformType: NodeTypeOption, object?: T | null, count?: number | null); setNodeType(uniformType: NodeTypeOption): void; } export const reference: (name: string, nodeOrType: NodeOrType, object: T) => ShaderNodeObject>; -export const referenceIndex: ( +export const referenceBuffer: ( name: string, - index: NodeRepresentation, nodeOrType: NodeOrType, + count: NodeRepresentation, object: T, ) => ShaderNodeObject>; diff --git a/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts b/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts index e64457d34..71bfd9551 100644 --- a/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts +++ b/types/three/examples/jsm/nodes/accessors/SkinningNode.d.ts @@ -3,6 +3,9 @@ import Node from "../core/Node.js"; import { ShaderNodeObject } from "../shadernode/ShaderNode.js"; export default class SkinningNode extends Node { + skinnedMesh: SkinnedMesh; + useReference: boolean; + skinIndexNode: Node; skinWeightNode: Node; @@ -10,7 +13,8 @@ export default class SkinningNode extends Node { bindMatrixInverseNode: Node; boneMatricesNode: Node; - constructor(skinnedMesh: SkinnedMesh); + constructor(skinnedMesh: SkinnedMesh, useReference?: boolean); } -export function skinning(skinnedMesh: SkinnedMesh): ShaderNodeObject; +export const skinning: (skinnedMesh: SkinnedMesh) => ShaderNodeObject; +export const skinningReference: (skinnedMesh: SkinnedMesh) => ShaderNodeObject;