x_ite 10.5.7 → 10.5.8
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 +4 -4
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +2 -2
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +373 -114
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +2 -2
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +2 -2
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +2 -2
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +4 -4
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +10 -10
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +2 -2
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.d.ts +13 -0
- package/dist/x_ite.js +197 -111
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +197 -111
- package/dist/x_ite.zip +0 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v10.5.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.5.
|
|
1
|
+
/* X_ITE v10.5.8 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.5.8")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -263,7 +263,7 @@ function HAnimHumanoid (executionContext)
|
|
|
263
263
|
|
|
264
264
|
this .skeletonNode = new (external_X_ITE_X3D_Group_default()) (executionContext);
|
|
265
265
|
this .viewpointsNode = new (external_X_ITE_X3D_Group_default()) (executionContext);
|
|
266
|
-
this .skinNode = new
|
|
266
|
+
this .skinNode = new Skin (executionContext, this);
|
|
267
267
|
this .transformNode = new (external_X_ITE_X3D_Transform_default()) (executionContext);
|
|
268
268
|
this .motionNodes = [ ];
|
|
269
269
|
this .jointNodes = [ ];
|
|
@@ -344,25 +344,14 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
344
344
|
if (gl .getVersion () === 1)
|
|
345
345
|
return;
|
|
346
346
|
|
|
347
|
-
// Prepare skinNode.
|
|
348
|
-
|
|
349
|
-
this .skinNode .traverse = function (humanoidNode, type, renderObject)
|
|
350
|
-
{
|
|
351
|
-
renderObject .getHumanoids () .push (humanoidNode);
|
|
352
|
-
|
|
353
|
-
external_X_ITE_X3D_Group_default().prototype .traverse .call (this, type, renderObject);
|
|
354
|
-
|
|
355
|
-
renderObject .getHumanoids () .pop ();
|
|
356
|
-
}
|
|
357
|
-
.bind (this .skinNode, this);
|
|
358
|
-
|
|
359
347
|
// Textures
|
|
360
348
|
|
|
361
|
-
this .jointsTexture
|
|
362
|
-
this .displacementsTexture
|
|
363
|
-
this .
|
|
349
|
+
this .jointsTexture = gl .createTexture ();
|
|
350
|
+
this .displacementsTexture = gl .createTexture ();
|
|
351
|
+
this .displacementWeightsTexture = gl .createTexture ();
|
|
352
|
+
this .jointMatricesTexture = gl .createTexture ();
|
|
364
353
|
|
|
365
|
-
for (const texture of [this .jointsTexture, this .displacementsTexture, this .jointMatricesTexture])
|
|
354
|
+
for (const texture of [this .jointsTexture, this .displacementsTexture, this .displacementWeightsTexture, this .jointMatricesTexture])
|
|
366
355
|
{
|
|
367
356
|
gl .bindTexture (gl .TEXTURE_2D, texture);
|
|
368
357
|
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE);
|
|
@@ -400,7 +389,7 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
400
389
|
{
|
|
401
390
|
return this .transformNode .getMatrix ();
|
|
402
391
|
},
|
|
403
|
-
|
|
392
|
+
getHAnimKey ()
|
|
404
393
|
{
|
|
405
394
|
return this .humanoidKey;
|
|
406
395
|
},
|
|
@@ -586,26 +575,36 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
586
575
|
length = this .skinCoordNode ?._point .length || 1,
|
|
587
576
|
displacements = Array .from ({ length }, () => [ ]);
|
|
588
577
|
|
|
578
|
+
let displacer = 0;
|
|
579
|
+
|
|
580
|
+
this .displacementWeights .length = 0;
|
|
581
|
+
|
|
589
582
|
for (const [joint, jointNode] of this .jointNodes .entries ())
|
|
590
583
|
{
|
|
591
584
|
for (const displacerNode of jointNode .getDisplacers ())
|
|
592
585
|
{
|
|
593
586
|
const d = displacerNode ._displacements;
|
|
594
587
|
|
|
588
|
+
// Store reference to weight SFFloat.
|
|
589
|
+
this .displacementWeights .push (displacerNode ._weight, 0, 0, 0);
|
|
590
|
+
|
|
595
591
|
for (const [i, index] of displacerNode ._coordIndex .entries ())
|
|
596
|
-
displacements [index] ?.push (... d [i], joint);
|
|
592
|
+
displacements [index] ?.push (... d [i], joint, displacer, 0, 0, 0);
|
|
593
|
+
|
|
594
|
+
++ displacer;
|
|
597
595
|
}
|
|
598
596
|
}
|
|
599
597
|
|
|
600
598
|
const
|
|
601
|
-
numDisplacements = displacements .reduce ((p, n) => Math .max (p, n .length), 0) /
|
|
602
|
-
numElements = numDisplacements *
|
|
603
|
-
size =
|
|
599
|
+
numDisplacements = displacements .reduce ((p, n) => Math .max (p, n .length), 0) / 8,
|
|
600
|
+
numElements = numDisplacements * 8,
|
|
601
|
+
size = Math .ceil (Math .sqrt (length * numDisplacements * 2)) || 1,
|
|
604
602
|
displacementsArray = new Float32Array (size * size * 4);
|
|
605
603
|
|
|
606
604
|
for (let i = 0; i < length; ++ i)
|
|
607
605
|
displacementsArray .set (displacements [i], i * numElements);
|
|
608
606
|
|
|
607
|
+
// Number of displacements per coord index.
|
|
609
608
|
this .numDisplacements = numDisplacements;
|
|
610
609
|
|
|
611
610
|
// Upload texture.
|
|
@@ -619,14 +618,8 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
619
618
|
|
|
620
619
|
// Weights
|
|
621
620
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
for (let i = displacementWeights .length; i < length; ++ i)
|
|
625
|
-
displacementWeights [i] = [ ];
|
|
626
|
-
|
|
627
|
-
displacementWeights .length = length;
|
|
628
|
-
|
|
629
|
-
this .displacementWeightsArray = new Float32Array (size * size * 2);
|
|
621
|
+
this .displacementWeightsSize = Math .ceil (Math .sqrt (displacer));
|
|
622
|
+
this .displacementWeightsArray = new Float32Array (this .displacementWeightsSize * this .displacementWeightsSize * 4);
|
|
630
623
|
|
|
631
624
|
// Trigger update.
|
|
632
625
|
|
|
@@ -635,47 +628,17 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
635
628
|
},
|
|
636
629
|
set_displacementWeightsTexture__ ()
|
|
637
630
|
{
|
|
638
|
-
// Create array.
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
length = this .skinCoordNode ?._point .length || 1,
|
|
642
|
-
displacementWeights = this .displacementWeights;
|
|
643
|
-
|
|
644
|
-
for (const d of displacementWeights)
|
|
645
|
-
d .length = 0;
|
|
646
|
-
|
|
647
|
-
for (const jointNode of this .jointNodes)
|
|
648
|
-
{
|
|
649
|
-
for (const displacerNode of jointNode .getDisplacers ())
|
|
650
|
-
{
|
|
651
|
-
const weight = displacerNode ._weight;
|
|
652
|
-
|
|
653
|
-
for (const index of displacerNode ._coordIndex)
|
|
654
|
-
displacementWeights [index] ?.push (weight, 0, 0, 0);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
const
|
|
659
|
-
numDisplacements = this .numDisplacements,
|
|
660
|
-
numElements = numDisplacements * 4,
|
|
661
|
-
size = external_X_ITE_X3D_Algorithm_default().roundToMultiple (Math .ceil (Math .sqrt (length * numDisplacements * 2)) || 1, 2),
|
|
662
|
-
displacementWeightsArray = this .displacementWeightsArray;
|
|
663
|
-
|
|
664
|
-
for (let i = 0; i < length; ++ i)
|
|
665
|
-
displacementWeightsArray .set (displacementWeights [i], i * numElements);
|
|
666
|
-
|
|
667
631
|
// Upload texture.
|
|
668
632
|
|
|
669
633
|
const
|
|
670
|
-
|
|
671
|
-
|
|
634
|
+
gl = this .getBrowser () .getContext (),
|
|
635
|
+
size = this .displacementWeightsSize,
|
|
636
|
+
array = this .displacementWeightsArray;
|
|
672
637
|
|
|
673
|
-
|
|
674
|
-
gl .texSubImage2D (gl .TEXTURE_2D, 0, 0, size / 2, size, size / 2, gl .RGBA, gl .FLOAT, displacementWeightsArray)
|
|
638
|
+
array .set (this .displacementWeights);
|
|
675
639
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
this .change .enable ();
|
|
640
|
+
gl .bindTexture (gl .TEXTURE_2D, this .displacementWeightsTexture);
|
|
641
|
+
gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, size, size, 0, gl .RGBA, gl .FLOAT, array);
|
|
679
642
|
},
|
|
680
643
|
set_skinCoord__ ()
|
|
681
644
|
{
|
|
@@ -686,7 +649,8 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
686
649
|
this .skinCoordNode .removeInterest ("addEvent", this ._displacementWeightsTexture);
|
|
687
650
|
}
|
|
688
651
|
|
|
689
|
-
this .skinCoordNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).
|
|
652
|
+
this .skinCoordNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).Coordinate, this ._skinCoord)
|
|
653
|
+
?? external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).CoordinateDouble, this ._skinCoord);
|
|
690
654
|
|
|
691
655
|
if (this .skinCoordNode)
|
|
692
656
|
{
|
|
@@ -707,61 +671,62 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
707
671
|
},
|
|
708
672
|
traverse (type, renderObject)
|
|
709
673
|
{
|
|
674
|
+
const invHumanoidMatrix = renderObject .getInvHumanoidMatrix ();
|
|
675
|
+
|
|
676
|
+
invHumanoidMatrix .push (this .transformNode .getMatrix ());
|
|
677
|
+
invHumanoidMatrix .multRight (renderObject .getModelViewMatrix () .get ());
|
|
678
|
+
invHumanoidMatrix .inverse ();
|
|
679
|
+
|
|
710
680
|
this .transformNode .traverse (type, renderObject);
|
|
711
681
|
|
|
712
682
|
this .skinning (type, renderObject);
|
|
683
|
+
|
|
684
|
+
invHumanoidMatrix .pop ();
|
|
713
685
|
},
|
|
714
|
-
skinning
|
|
686
|
+
skinning (type, renderObject)
|
|
715
687
|
{
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
return function (type, renderObject)
|
|
719
|
-
{
|
|
720
|
-
if (type !== (external_X_ITE_X3D_TraverseType_default()).DISPLAY || this .change .lock ())
|
|
721
|
-
return;
|
|
722
|
-
|
|
723
|
-
// Determine inverse model matrix of humanoid.
|
|
724
|
-
|
|
725
|
-
invModelViewMatrix .assign (this .transformNode .getMatrix ())
|
|
726
|
-
.multRight (renderObject .getModelViewMatrix () .get ()) .inverse ();
|
|
688
|
+
if (type !== (external_X_ITE_X3D_TraverseType_default()).DISPLAY || this .change .lock ())
|
|
689
|
+
return;
|
|
727
690
|
|
|
728
|
-
|
|
691
|
+
// Create joint matrices.
|
|
729
692
|
|
|
693
|
+
const
|
|
694
|
+
invModelViewMatrix = renderObject .getInvHumanoidMatrix () .get (),
|
|
695
|
+
jointNodes = this .jointNodes,
|
|
696
|
+
jointNodesLength = jointNodes .length,
|
|
697
|
+
jointBindingMatrices = this .jointBindingMatrices,
|
|
698
|
+
jointMatricesArray = this .jointMatricesArray,
|
|
699
|
+
size = Math .ceil (Math .sqrt (jointNodesLength * 8));
|
|
700
|
+
|
|
701
|
+
for (let i = 0; i < jointNodesLength; ++ i)
|
|
702
|
+
{
|
|
730
703
|
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
size = Math .ceil (Math .sqrt (jointNodesLength * 8));
|
|
704
|
+
jointNode = jointNodes [i],
|
|
705
|
+
jointBindingMatrix = jointBindingMatrices [i],
|
|
706
|
+
jointMatrix = jointNode .getModelViewMatrix () .multRight (invModelViewMatrix) .multLeft (jointBindingMatrix),
|
|
707
|
+
jointNormalMatrix = jointMatrix .submatrix .transpose () .inverse ();
|
|
736
708
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
jointNode = jointNodes [i],
|
|
741
|
-
jointBindingMatrix = jointBindingMatrices [i],
|
|
742
|
-
jointMatrix = jointNode .getModelViewMatrix () .multRight (invModelViewMatrix) .multLeft (jointBindingMatrix),
|
|
743
|
-
jointNormalMatrix = jointMatrix .submatrix .transpose () .inverse ();
|
|
744
|
-
|
|
745
|
-
jointMatricesArray .set (jointMatrix, i * 32 + 0);
|
|
746
|
-
jointMatricesArray .set (jointNormalMatrix, i * 32 + 16);
|
|
747
|
-
}
|
|
709
|
+
jointMatricesArray .set (jointMatrix, i * 32 + 0);
|
|
710
|
+
jointMatricesArray .set (jointNormalMatrix, i * 32 + 16);
|
|
711
|
+
}
|
|
748
712
|
|
|
749
|
-
|
|
713
|
+
// Upload textures.
|
|
750
714
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
715
|
+
const
|
|
716
|
+
browser = this .getBrowser (),
|
|
717
|
+
gl = browser .getContext ();
|
|
754
718
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
})(),
|
|
719
|
+
gl .bindTexture (gl .TEXTURE_2D, this .jointMatricesTexture);
|
|
720
|
+
gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, size, size, 0, gl .RGBA, gl .FLOAT, jointMatricesArray);
|
|
721
|
+
},
|
|
759
722
|
setShaderUniforms (gl, shaderObject)
|
|
760
723
|
{
|
|
761
724
|
const
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
725
|
+
browser = this .getBrowser (),
|
|
726
|
+
jointsTextureTextureUnit = browser .getTexture2DUnit (),
|
|
727
|
+
displacementsTextureTextureUnit = browser .getTexture2DUnit (),
|
|
728
|
+
displacementWeightsTextureTextureUnit = browser .getTexture2DUnit (),
|
|
729
|
+
jointMatricesTextureUnit = browser .getTexture2DUnit ();
|
|
765
730
|
|
|
766
731
|
gl .activeTexture (gl .TEXTURE0 + jointsTextureTextureUnit);
|
|
767
732
|
gl .bindTexture (gl .TEXTURE_2D, this .jointsTexture);
|
|
@@ -771,6 +736,10 @@ Object .assign (Object .setPrototypeOf (HAnimHumanoid .prototype, (external_X_IT
|
|
|
771
736
|
gl .bindTexture (gl .TEXTURE_2D, this .displacementsTexture);
|
|
772
737
|
gl .uniform1i (shaderObject .x3d_DisplacementsTexture, displacementsTextureTextureUnit);
|
|
773
738
|
|
|
739
|
+
gl .activeTexture (gl .TEXTURE0 + displacementWeightsTextureTextureUnit);
|
|
740
|
+
gl .bindTexture (gl .TEXTURE_2D, this .displacementWeightsTexture);
|
|
741
|
+
gl .uniform1i (shaderObject .x3d_DisplacementWeightsTexture, displacementWeightsTextureTextureUnit);
|
|
742
|
+
|
|
774
743
|
gl .activeTexture (gl .TEXTURE0 + jointMatricesTextureUnit);
|
|
775
744
|
gl .bindTexture (gl .TEXTURE_2D, this .jointMatricesTexture);
|
|
776
745
|
gl .uniform1i (shaderObject .x3d_JointMatricesTexture, jointMatricesTextureUnit);
|
|
@@ -824,6 +793,27 @@ Object .defineProperties (HAnimHumanoid,
|
|
|
824
793
|
},
|
|
825
794
|
});
|
|
826
795
|
|
|
796
|
+
class Skin extends (external_X_ITE_X3D_Group_default())
|
|
797
|
+
{
|
|
798
|
+
#humanoidNode;
|
|
799
|
+
|
|
800
|
+
constructor (executionContext, humanoidNode)
|
|
801
|
+
{
|
|
802
|
+
super (executionContext);
|
|
803
|
+
|
|
804
|
+
this .#humanoidNode = humanoidNode;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
traverse (type, renderObject)
|
|
808
|
+
{
|
|
809
|
+
renderObject .getHAnimNode () .push (this .#humanoidNode);
|
|
810
|
+
|
|
811
|
+
super .traverse (type, renderObject);
|
|
812
|
+
|
|
813
|
+
renderObject .getHAnimNode () .pop ();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
827
817
|
class Lock
|
|
828
818
|
{
|
|
829
819
|
#locked = true;
|
|
@@ -850,9 +840,6 @@ const HAnimHumanoid_default_ = HAnimHumanoid;
|
|
|
850
840
|
;// external "__X_ITE_X3D__ .X3DTransformNode"
|
|
851
841
|
const external_X_ITE_X3D_X3DTransformNode_namespaceObject = __X_ITE_X3D__ .X3DTransformNode;
|
|
852
842
|
var external_X_ITE_X3D_X3DTransformNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DTransformNode_namespaceObject);
|
|
853
|
-
;// external "__X_ITE_X3D__ .Vector3"
|
|
854
|
-
const external_X_ITE_X3D_Vector3_namespaceObject = __X_ITE_X3D__ .Vector3;
|
|
855
|
-
var external_X_ITE_X3D_Vector3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Vector3_namespaceObject);
|
|
856
843
|
;// ./src/x_ite/Components/HAnim/HAnimJoint.js
|
|
857
844
|
/*******************************************************************************
|
|
858
845
|
*
|
|
@@ -911,7 +898,6 @@ var external_X_ITE_X3D_Vector3_default = /*#__PURE__*/__webpack_require__.n(exte
|
|
|
911
898
|
|
|
912
899
|
|
|
913
900
|
|
|
914
|
-
|
|
915
901
|
function HAnimJoint (executionContext)
|
|
916
902
|
{
|
|
917
903
|
external_X_ITE_X3D_X3DTransformNode_default().call (this, executionContext);
|
|
@@ -976,6 +962,9 @@ Object .assign (Object .setPrototypeOf (HAnimJoint .prototype, (external_X_ITE_X
|
|
|
976
962
|
displacerNode ._coordIndex .addInterest ("addEvent", this ._displacementWeights);
|
|
977
963
|
displacerNode ._weight .addInterest ("addEvent", this ._displacementWeights);
|
|
978
964
|
}
|
|
965
|
+
|
|
966
|
+
this ._displacements .addEvent ();
|
|
967
|
+
this ._displacementWeights .addEvent ();
|
|
979
968
|
},
|
|
980
969
|
traverse (type, renderObject)
|
|
981
970
|
{
|
|
@@ -1046,6 +1035,9 @@ var external_X_ITE_X3D_PositionInterpolator_default = /*#__PURE__*/__webpack_req
|
|
|
1046
1035
|
;// external "__X_ITE_X3D__ .OrientationInterpolator"
|
|
1047
1036
|
const external_X_ITE_X3D_OrientationInterpolator_namespaceObject = __X_ITE_X3D__ .OrientationInterpolator;
|
|
1048
1037
|
var external_X_ITE_X3D_OrientationInterpolator_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_OrientationInterpolator_namespaceObject);
|
|
1038
|
+
;// external "__X_ITE_X3D__ .Vector3"
|
|
1039
|
+
const external_X_ITE_X3D_Vector3_namespaceObject = __X_ITE_X3D__ .Vector3;
|
|
1040
|
+
var external_X_ITE_X3D_Vector3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Vector3_namespaceObject);
|
|
1049
1041
|
;// external "__X_ITE_X3D__ .Rotation4"
|
|
1050
1042
|
const external_X_ITE_X3D_Rotation4_namespaceObject = __X_ITE_X3D__ .Rotation4;
|
|
1051
1043
|
var external_X_ITE_X3D_Rotation4_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Rotation4_namespaceObject);
|
|
@@ -1516,16 +1508,283 @@ var external_X_ITE_X3D_X3DGroupingNode_default = /*#__PURE__*/__webpack_require_
|
|
|
1516
1508
|
|
|
1517
1509
|
|
|
1518
1510
|
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
|
|
1519
1515
|
function HAnimSegment (executionContext)
|
|
1520
1516
|
{
|
|
1521
1517
|
external_X_ITE_X3D_X3DGroupingNode_default().call (this, executionContext);
|
|
1522
1518
|
|
|
1523
1519
|
this .addType ((external_X_ITE_X3D_X3DConstants_default()).HAnimSegment);
|
|
1524
1520
|
|
|
1521
|
+
this .addChildObjects ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "displacementsTexture", new (external_X_ITE_X3D_Fields_default()).SFTime (),
|
|
1522
|
+
(external_X_ITE_X3D_X3DConstants_default()).inputOutput, "displacementWeightsTexture", new (external_X_ITE_X3D_Fields_default()).SFTime ());
|
|
1523
|
+
|
|
1524
|
+
// Units
|
|
1525
|
+
|
|
1525
1526
|
this ._mass .setUnit ("mass");
|
|
1527
|
+
|
|
1528
|
+
// Private properties
|
|
1529
|
+
|
|
1530
|
+
const size = Math .ceil (Math .sqrt (1 * 8));
|
|
1531
|
+
|
|
1532
|
+
this .numJoints = 0;
|
|
1533
|
+
this .numDisplacements = 0;
|
|
1534
|
+
this .displacerNodes = [ ];
|
|
1535
|
+
this .displacementWeights = [ ];
|
|
1536
|
+
this .jointMatricesArray = new Float32Array (size * size * 4);
|
|
1526
1537
|
}
|
|
1527
1538
|
|
|
1528
|
-
Object .setPrototypeOf (HAnimSegment .prototype, (external_X_ITE_X3D_X3DGroupingNode_default()).prototype)
|
|
1539
|
+
Object .assign (Object .setPrototypeOf (HAnimSegment .prototype, (external_X_ITE_X3D_X3DGroupingNode_default()).prototype),
|
|
1540
|
+
{
|
|
1541
|
+
initialize ()
|
|
1542
|
+
{
|
|
1543
|
+
external_X_ITE_X3D_X3DGroupingNode_default().prototype .initialize .call (this);
|
|
1544
|
+
|
|
1545
|
+
// Check WebGL version.
|
|
1546
|
+
|
|
1547
|
+
const
|
|
1548
|
+
browser = this .getBrowser (),
|
|
1549
|
+
gl = browser .getContext ();
|
|
1550
|
+
|
|
1551
|
+
if (gl .getVersion () === 1)
|
|
1552
|
+
return;
|
|
1553
|
+
|
|
1554
|
+
// Textures
|
|
1555
|
+
|
|
1556
|
+
this .displacementsTexture = gl .createTexture ();
|
|
1557
|
+
this .displacementWeightsTexture = gl .createTexture ();
|
|
1558
|
+
this .jointMatricesTexture = gl .createTexture ();
|
|
1559
|
+
|
|
1560
|
+
for (const texture of [this .displacementsTexture, this .displacementWeightsTexture, this .jointMatricesTexture])
|
|
1561
|
+
{
|
|
1562
|
+
gl .bindTexture (gl .TEXTURE_2D, texture);
|
|
1563
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE);
|
|
1564
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE);
|
|
1565
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .LINEAR);
|
|
1566
|
+
gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .LINEAR);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// Events
|
|
1570
|
+
|
|
1571
|
+
this ._displacers .addInterest ("set_displacers__", this);
|
|
1572
|
+
this ._coord .addInterest ("set_coord__", this);
|
|
1573
|
+
|
|
1574
|
+
this ._displacementsTexture .addInterest ("set_displacementsTexture__", this);
|
|
1575
|
+
this ._displacementWeightsTexture .addInterest ("set_displacementWeightsTexture__", this);
|
|
1576
|
+
|
|
1577
|
+
this .set_displacers__ ();
|
|
1578
|
+
this .set_coord__ ();
|
|
1579
|
+
},
|
|
1580
|
+
getHAnimKey ()
|
|
1581
|
+
{
|
|
1582
|
+
return this .humanoidKey;
|
|
1583
|
+
},
|
|
1584
|
+
getNumJoints ()
|
|
1585
|
+
{
|
|
1586
|
+
return this .numJoints;
|
|
1587
|
+
},
|
|
1588
|
+
getNumDisplacements ()
|
|
1589
|
+
{
|
|
1590
|
+
return this .numDisplacements;
|
|
1591
|
+
},
|
|
1592
|
+
set_humanoidKey__ ()
|
|
1593
|
+
{
|
|
1594
|
+
this .humanoidKey = `[${this .numJoints}.${this .numDisplacements}]`;
|
|
1595
|
+
},
|
|
1596
|
+
set_displacers__ ()
|
|
1597
|
+
{
|
|
1598
|
+
const displacerNodes = this .displacerNodes;
|
|
1599
|
+
|
|
1600
|
+
for (const displacerNode of displacerNodes)
|
|
1601
|
+
{
|
|
1602
|
+
displacerNode ._coordIndex .removeInterest ("addEvent", this ._displacementsTexture);
|
|
1603
|
+
displacerNode ._displacements .removeInterest ("addEvent", this ._displacementsTexture);
|
|
1604
|
+
displacerNode ._coordIndex .removeInterest ("addEvent", this ._displacementWeightsTexture);
|
|
1605
|
+
displacerNode ._weight .removeInterest ("addEvent", this ._displacementWeightsTexture);
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
displacerNodes .length = 0;
|
|
1609
|
+
|
|
1610
|
+
for (const node of this ._displacers)
|
|
1611
|
+
{
|
|
1612
|
+
const displacerNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).HAnimDisplacer, node);
|
|
1613
|
+
|
|
1614
|
+
if (displacerNode)
|
|
1615
|
+
displacerNodes .push (displacerNode);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
for (const displacerNode of displacerNodes)
|
|
1619
|
+
{
|
|
1620
|
+
displacerNode ._coordIndex .addInterest ("addEvent", this ._displacementsTexture);
|
|
1621
|
+
displacerNode ._displacements .addInterest ("addEvent", this ._displacementsTexture);
|
|
1622
|
+
displacerNode ._coordIndex .addInterest ("addEvent", this ._displacementWeightsTexture);
|
|
1623
|
+
displacerNode ._weight .addInterest ("addEvent", this ._displacementWeightsTexture);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
this ._displacementsTexture .addEvent ();
|
|
1627
|
+
this ._displacementWeightsTexture .addEvent ();
|
|
1628
|
+
},
|
|
1629
|
+
set_displacementsTexture__ ()
|
|
1630
|
+
{
|
|
1631
|
+
// Create array.
|
|
1632
|
+
|
|
1633
|
+
const
|
|
1634
|
+
length = this .coordNode ?._point .length || 1,
|
|
1635
|
+
displacements = Array .from ({ length }, () => [ ]);
|
|
1636
|
+
|
|
1637
|
+
let displacer = 0;
|
|
1638
|
+
|
|
1639
|
+
this .displacementWeights .length = 0;
|
|
1640
|
+
|
|
1641
|
+
for (const displacerNode of this .displacerNodes)
|
|
1642
|
+
{
|
|
1643
|
+
const d = displacerNode ._displacements;
|
|
1644
|
+
|
|
1645
|
+
// Store reference to weight SFFloat.
|
|
1646
|
+
this .displacementWeights .push (displacerNode ._weight, 0, 0, 0);
|
|
1647
|
+
|
|
1648
|
+
for (const [i, index] of displacerNode ._coordIndex .entries ())
|
|
1649
|
+
displacements [index] ?.push (... d [i], 0, displacer, 0, 0, 0);
|
|
1650
|
+
|
|
1651
|
+
++ displacer;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
const
|
|
1655
|
+
numDisplacements = displacements .reduce ((p, n) => Math .max (p, n .length), 0) / 8,
|
|
1656
|
+
numElements = numDisplacements * 8,
|
|
1657
|
+
size = Math .ceil (Math .sqrt (length * numDisplacements * 2)) || 1,
|
|
1658
|
+
displacementsArray = new Float32Array (size * size * 4);
|
|
1659
|
+
|
|
1660
|
+
for (let i = 0; i < length; ++ i)
|
|
1661
|
+
displacementsArray .set (displacements [i], i * numElements);
|
|
1662
|
+
|
|
1663
|
+
// Number of displacements per coord index.
|
|
1664
|
+
this .numDisplacements = numDisplacements;
|
|
1665
|
+
|
|
1666
|
+
// Upload texture.
|
|
1667
|
+
|
|
1668
|
+
const
|
|
1669
|
+
browser = this .getBrowser (),
|
|
1670
|
+
gl = browser .getContext ();
|
|
1671
|
+
|
|
1672
|
+
gl .bindTexture (gl .TEXTURE_2D, this .displacementsTexture);
|
|
1673
|
+
gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, size, size, 0, gl .RGBA, gl .FLOAT, displacementsArray);
|
|
1674
|
+
|
|
1675
|
+
// Weights
|
|
1676
|
+
|
|
1677
|
+
this .displacementWeightsSize = Math .ceil (Math .sqrt (displacer));
|
|
1678
|
+
this .displacementWeightsArray = new Float32Array (this .displacementWeightsSize * this .displacementWeightsSize * 4);
|
|
1679
|
+
|
|
1680
|
+
// Trigger update.
|
|
1681
|
+
|
|
1682
|
+
this .set_humanoidKey__ ();
|
|
1683
|
+
},
|
|
1684
|
+
set_displacementWeightsTexture__ ()
|
|
1685
|
+
{
|
|
1686
|
+
// Upload texture.
|
|
1687
|
+
|
|
1688
|
+
const
|
|
1689
|
+
gl = this .getBrowser () .getContext (),
|
|
1690
|
+
size = this .displacementWeightsSize,
|
|
1691
|
+
array = this .displacementWeightsArray;
|
|
1692
|
+
|
|
1693
|
+
array .set (this .displacementWeights);
|
|
1694
|
+
|
|
1695
|
+
gl .bindTexture (gl .TEXTURE_2D, this .displacementWeightsTexture);
|
|
1696
|
+
gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, size, size, 0, gl .RGBA, gl .FLOAT, array);
|
|
1697
|
+
},
|
|
1698
|
+
set_coord__ ()
|
|
1699
|
+
{
|
|
1700
|
+
if (this .coordNode)
|
|
1701
|
+
{
|
|
1702
|
+
this .coordNode .removeInterest ("addEvent", this ._displacementsTexture);
|
|
1703
|
+
this .coordNode .removeInterest ("addEvent", this ._displacementWeightsTexture);
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
this .coordNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).Coordinate, this ._coord)
|
|
1707
|
+
?? external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).CoordinateDouble, this ._coord);
|
|
1708
|
+
|
|
1709
|
+
if (this .coordNode)
|
|
1710
|
+
{
|
|
1711
|
+
delete this .skinning;
|
|
1712
|
+
|
|
1713
|
+
this .coordNode .addInterest ("addEvent", this ._displacementsTexture);
|
|
1714
|
+
this .coordNode .addInterest ("addEvent", this ._displacementWeightsTexture);
|
|
1715
|
+
}
|
|
1716
|
+
else
|
|
1717
|
+
{
|
|
1718
|
+
this .skinning = Function .prototype;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
this ._displacementsTexture .addEvent ();
|
|
1722
|
+
this ._displacementWeightsTexture .addEvent ();
|
|
1723
|
+
},
|
|
1724
|
+
traverse (type, renderObject)
|
|
1725
|
+
{
|
|
1726
|
+
if (this .coordNode)
|
|
1727
|
+
renderObject .getHAnimNode () .push (this);
|
|
1728
|
+
|
|
1729
|
+
external_X_ITE_X3D_X3DGroupingNode_default().prototype .traverse .call (this, type, renderObject);
|
|
1730
|
+
|
|
1731
|
+
this .skinning (type, renderObject);
|
|
1732
|
+
|
|
1733
|
+
if (this .coordNode)
|
|
1734
|
+
renderObject .getHAnimNode () .pop ();
|
|
1735
|
+
},
|
|
1736
|
+
skinning: (() =>
|
|
1737
|
+
{
|
|
1738
|
+
const modelViewMatrix = new (external_X_ITE_X3D_Matrix4_default()) ();
|
|
1739
|
+
|
|
1740
|
+
return function (type, renderObject)
|
|
1741
|
+
{
|
|
1742
|
+
if (type !== (external_X_ITE_X3D_TraverseType_default()).DISPLAY)
|
|
1743
|
+
return;
|
|
1744
|
+
|
|
1745
|
+
// Create joint matrices.
|
|
1746
|
+
|
|
1747
|
+
const
|
|
1748
|
+
invHumanoidMatrix = renderObject .getInvHumanoidMatrix () .get (),
|
|
1749
|
+
jointMatricesArray = this .jointMatricesArray,
|
|
1750
|
+
size = Math .ceil (Math .sqrt (1 * 8));
|
|
1751
|
+
|
|
1752
|
+
const jointMatrix = modelViewMatrix .assign (renderObject .getModelViewMatrix () .get ()) .multRight (invHumanoidMatrix);
|
|
1753
|
+
|
|
1754
|
+
jointMatricesArray .set (jointMatrix, 0);
|
|
1755
|
+
// No need for jointNormalMatrix.
|
|
1756
|
+
|
|
1757
|
+
// Upload textures.
|
|
1758
|
+
|
|
1759
|
+
const
|
|
1760
|
+
browser = this .getBrowser (),
|
|
1761
|
+
gl = browser .getContext ();
|
|
1762
|
+
|
|
1763
|
+
gl .bindTexture (gl .TEXTURE_2D, this .jointMatricesTexture);
|
|
1764
|
+
gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, size, size, 0, gl .RGBA, gl .FLOAT, jointMatricesArray);
|
|
1765
|
+
};
|
|
1766
|
+
})(),
|
|
1767
|
+
setShaderUniforms (gl, shaderObject)
|
|
1768
|
+
{
|
|
1769
|
+
const
|
|
1770
|
+
browser = this .getBrowser (),
|
|
1771
|
+
displacementsTextureTextureUnit = browser .getTexture2DUnit (),
|
|
1772
|
+
displacementWeightsTextureTextureUnit = browser .getTexture2DUnit (),
|
|
1773
|
+
jointMatricesTextureUnit = browser .getTexture2DUnit ();
|
|
1774
|
+
|
|
1775
|
+
gl .activeTexture (gl .TEXTURE0 + displacementsTextureTextureUnit);
|
|
1776
|
+
gl .bindTexture (gl .TEXTURE_2D, this .displacementsTexture);
|
|
1777
|
+
gl .uniform1i (shaderObject .x3d_DisplacementsTexture, displacementsTextureTextureUnit);
|
|
1778
|
+
|
|
1779
|
+
gl .activeTexture (gl .TEXTURE0 + displacementWeightsTextureTextureUnit);
|
|
1780
|
+
gl .bindTexture (gl .TEXTURE_2D, this .displacementWeightsTexture);
|
|
1781
|
+
gl .uniform1i (shaderObject .x3d_DisplacementWeightsTexture, displacementWeightsTextureTextureUnit);
|
|
1782
|
+
|
|
1783
|
+
gl .activeTexture (gl .TEXTURE0 + jointMatricesTextureUnit);
|
|
1784
|
+
gl .bindTexture (gl .TEXTURE_2D, this .jointMatricesTexture);
|
|
1785
|
+
gl .uniform1i (shaderObject .x3d_JointMatricesTexture, jointMatricesTextureUnit);
|
|
1786
|
+
},
|
|
1787
|
+
});
|
|
1529
1788
|
|
|
1530
1789
|
Object .defineProperties (HAnimSegment,
|
|
1531
1790
|
{
|