@reactvision/react-viro 2.53.0 → 2.53.1

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.
@@ -1 +1 @@
1
- export const VIRO_VERSION = "2.53.0";
1
+ export const VIRO_VERSION = "2.53.1";
@@ -30,7 +30,13 @@ type Props = {
30
30
  */
31
31
  resources?: ImageSourcePropType[];
32
32
  /**
33
- * TODO: what does this do?
33
+ * Sets morph target weights for GLB/GLTF models that contain morph targets (blend shapes).
34
+ * Each entry pairs a target name (as exported from the model) with a blend weight in [0, 1].
35
+ *
36
+ * Example:
37
+ * morphTargets={[{ target: "Smile", weight: 0.8 }, { target: "Blink", weight: 1.0 }]}
38
+ *
39
+ * Use getMorphTargets() to discover the available target names at runtime.
34
40
  */
35
41
  morphTargets?: Array<{
36
42
  target?: string;
@@ -1 +1 @@
1
- export declare const VIRO_VERSION = "2.53.0";
1
+ export declare const VIRO_VERSION = "2.53.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIRO_VERSION = void 0;
4
- exports.VIRO_VERSION = "2.53.0";
4
+ exports.VIRO_VERSION = "2.53.1";
@@ -13,7 +13,13 @@ type Props = {
13
13
  */
14
14
  resources?: ImageSourcePropType[];
15
15
  /**
16
- * TODO: what does this do?
16
+ * Sets morph target weights for GLB/GLTF models that contain morph targets (blend shapes).
17
+ * Each entry pairs a target name (as exported from the model) with a blend weight in [0, 1].
18
+ *
19
+ * Example:
20
+ * morphTargets={[{ target: "Smile", weight: 0.8 }, { target: "Blink", weight: 1.0 }]}
21
+ *
22
+ * Use getMorphTargets() to discover the available target names at runtime.
17
23
  */
18
24
  morphTargets?: Array<{
19
25
  target?: string;
@@ -119,7 +119,7 @@ private:
119
119
  static bool processCamera(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, int cameraIndex);
120
120
  static bool processLight(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, int lightIndex);
121
121
  static bool processMesh(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, const tinygltf::Mesh &gMesh,
122
- std::shared_ptr<VRODriver> driver);
122
+ int meshIndex, std::shared_ptr<VRODriver> driver);
123
123
  static bool processSkin(const tinygltf::Model &gModel, std::shared_ptr<VRONode> &node, int skinIndex);
124
124
  static bool processVertexElement(const tinygltf::Model &gModel, const tinygltf::Primitive &gPrimitive,
125
125
  std::vector<std::shared_ptr<VROGeometryElement>> &element);
@@ -186,7 +186,8 @@ private:
186
186
  static bool processKeyFrameAnimations(const tinygltf::Model &gModel,
187
187
  std::map<int, std::map<int, std::vector<int>>> &gltfAnimatedNodes);
188
188
  static void flattenSkeletalKeyframeAnimations(
189
- std::map<int, std::pair<int, std::vector<int>>> &skeletalAnimToNodeSkinPair);
189
+ std::map<int, std::pair<int, std::vector<int>>> &skeletalAnimToNodeSkinPair,
190
+ int skinIndex);
190
191
  static std::shared_ptr<VROKeyframeAnimation> convertChannelToKeyFrameAnimation(
191
192
  const tinygltf::Model &gModel,
192
193
  const tinygltf::Animation &anim,
@@ -195,9 +196,11 @@ private:
195
196
  std::string channelProperty,
196
197
  int channelTarget,
197
198
  const tinygltf::AnimationSampler &gChannelSampler,
198
- std::vector<std::unique_ptr<VROKeyframeAnimationFrame>> &framesOut);
199
+ std::vector<std::unique_ptr<VROKeyframeAnimationFrame>> &framesOut,
200
+ float animDuration = 1.0f);
201
+ // skeletalAnimToSkinToNodeMap: animIndex → vector of (skinIndex, animatedJointNodeIndices)
199
202
  static bool processSkeletalAnimation(const tinygltf::Model &gModel,
200
- std::map<int, std::pair<int, std::vector<int>>> &skeletalAnimToSkinToNodeMap);
203
+ std::map<int, std::vector<std::pair<int, std::vector<int>>>> &skeletalAnimToSkinToNodeMap);
201
204
  static bool processSkeletalTransformsForFrame(const tinygltf::Model &gModel,
202
205
  int skin,
203
206
  int animation,
@@ -229,6 +232,14 @@ private:
229
232
  static std::map<int, std::shared_ptr<VROSkinner>> _skinMap;
230
233
  static std::map<int, int> _skinIndexToSkeletonRootJoint;
231
234
 
235
+ /*
236
+ Per-mesh bone attribute sources cached during processMesh so that processNode can wire them
237
+ into the VROSkinner once both mesh geometry and skin data are available.
238
+ Keyed by glTF mesh index.
239
+ */
240
+ static std::map<int, std::shared_ptr<VROGeometrySource>> _meshBoneIndices;
241
+ static std::map<int, std::shared_ptr<VROGeometrySource>> _meshBoneWeights;
242
+
232
243
  /*
233
244
  Cached maps of nodeIndexes to it's corresponding animations. These caches are cleared
234
245
  out after the parsing of a single gLTF model. Note that _nodeKeyFrameAnims is of the form:
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "dist/index.js",
4
4
  "module": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
- "version": "2.53.0",
6
+ "version": "2.53.1",
7
7
  "license": "MIT",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org/"