MCPcopy
hub / github.com/sparkjsdev/spark / update

Method update

src/SplatMesh.ts:831–1002  ·  view source on GitHub ↗
({
    renderer,
    time,
    deltaTime,
    viewToWorld,
    camera,
    renderSize,
    globalEdits,
    lodIndices,
  }: FrameUpdateContext)

Source from the content-addressed store, hash-verified

829 // call it. It updates parameters for the generated pipeline and calls
830 // updateGenerator() if the pipeline needs to change.
831 update({
832 renderer,
833 time,
834 deltaTime,
835 viewToWorld,
836 camera,
837 renderSize,
838 globalEdits,
839 lodIndices,
840 }: FrameUpdateContext) {
841 this.context.time.value = time;
842 this.context.deltaTime.value = deltaTime;
843 SplatMesh.dynoTime.value = time;
844 this.showLodPageDyno.value = this.showLodPage ?? -1;
845
846 const splats = this.splats ?? this.packedSplats ?? this.extSplats;
847 if (splats) {
848 this.context.splats = splats;
849 }
850 this.numSplats = this.context.splats.getNumSplats();
851
852 let updated = false;
853
854 const lodSplats = this.packedSplats?.lodSplats ?? this.extSplats?.lodSplats;
855 this.context.enableLod.value = lodSplats != null && lodIndices != null;
856 if (this.enableLod === false) {
857 this.context.enableLod.value = false;
858 }
859 this.context.lodIndices.value = lodIndices?.texture ?? emptyLodIndices;
860
861 if (this.context.enableLod.value && lodSplats) {
862 this.context.splats = lodSplats;
863 this.numSplats = lodIndices?.numSplats ?? 0;
864 }
865
866 this.context.numSplats.value = this.numSplats;
867
868 if (this.context.splats !== this.lastSplats) {
869 this.lastSplats = this.context.splats;
870 this.generatorDirty = true;
871 }
872
873 if (!this.covSplats) {
874 if (this.context.transform.update(this)) {
875 updated = true;
876 }
877
878 if (
879 this.context.viewToWorld.updateFromMatrix(viewToWorld) &&
880 this.enableViewToWorld
881 ) {
882 updated = true;
883 }
884 const worldToView = viewToWorld.clone().invert();
885 if (
886 this.context.worldToView.updateFromMatrix(worldToView) &&
887 this.enableWorldToView
888 ) {

Callers 1

constructorMethod · 0.95

Calls 5

constructGeneratorMethod · 0.95
updateVersionMethod · 0.80
getNumSplatsMethod · 0.65
hasRgbDirMethod · 0.65
updateFromMatrixMethod · 0.45

Tested by

no test coverage detected