(context: SplatMeshContext)
| 734 | } |
| 735 | |
| 736 | constructCovGenerator(context: SplatMeshContext) { |
| 737 | // console.log("CovSplatMesh.constructCovGenerator"); |
| 738 | const { covTransform, covViewToObject, recolor } = context; |
| 739 | const generator = dynoBlock( |
| 740 | { index: "int" }, |
| 741 | { covsplat: CovSplat }, |
| 742 | ({ index }) => { |
| 743 | if (!index) { |
| 744 | throw new Error("index is undefined"); |
| 745 | } |
| 746 | |
| 747 | index = maybeLookupIndex( |
| 748 | context.lodIndices, |
| 749 | index, |
| 750 | context.numSplats, |
| 751 | context.enableLod, |
| 752 | this.showLodPageDyno, |
| 753 | ); |
| 754 | |
| 755 | // Read a Gsplat from the SplatSource |
| 756 | context.splats.prepareFetchSplat(); |
| 757 | let gsplat = context.splats.fetchSplat({ |
| 758 | index, |
| 759 | viewOrigin: covViewToObject.offset, |
| 760 | }); |
| 761 | |
| 762 | if (this.splatRgba) { |
| 763 | // Overwrite RGBA with baked RGBA values |
| 764 | gsplat = maybeInjectSplatRgba( |
| 765 | gsplat, |
| 766 | this.splatRgba.dyno, |
| 767 | index, |
| 768 | context.enableLod, |
| 769 | ); |
| 770 | } |
| 771 | |
| 772 | if (this.objectModifiers) { |
| 773 | // Inject object-space Gsplat modifier dyno |
| 774 | for (const modifier of this.objectModifiers) { |
| 775 | gsplat = modifier.apply({ gsplat }).gsplat; |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | let covsplat = gsplatToCovSplat(gsplat); |
| 780 | |
| 781 | if (this.skinning) { |
| 782 | // Transform according to bones + skinning weights |
| 783 | covsplat = this.skinning.modifyCov(covsplat); |
| 784 | } |
| 785 | |
| 786 | if (this.covObjectModifiers) { |
| 787 | // Inject object-space CovSplat modifier dyno |
| 788 | for (const modifier of this.covObjectModifiers) { |
| 789 | covsplat = modifier.apply({ covsplat }).covsplat; |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | // Transform from object to world-space |
no test coverage detected