11import React , { useRef , useMemo , useState , useEffect } from 'react'
22import * as THREE from 'three'
3- import { useAnalysisStore , useGlobalStore , usePlotStore , useZarrStore } from '@/utils/GlobalStates'
3+ import { useAnalysisStore , useGlobalStore , usePlotStore } from '@/utils/GlobalStates'
44import { ZarrDataset } from '@/components/zarr/ZarrLoaderLRU' ;
55import { useShallow } from 'zustand/shallow'
66import { sphereVertex , sphereVertexFlat , sphereFrag , flatSphereFrag } from '../textures/shaders'
@@ -51,18 +51,10 @@ export const Sphere = ({textures, ZarrDS} : {textures: THREE.Data3DTexture[] | T
5151 flipY : state . flipY ,
5252 textureArrayDepths : state . textureArrayDepths
5353 } ) ) )
54- const { zSlice, ySlice, xSlice} = useZarrStore ( useShallow ( state => ( {
55- zSlice : state . zSlice ,
56- ySlice : state . ySlice ,
57- xSlice : state . xSlice
58- } ) ) )
59- const dimSlices = [
60- dimArrays [ 0 ] . slice ( zSlice [ 0 ] , zSlice [ 1 ] ? zSlice [ 1 ] : undefined ) ,
61- dimArrays [ 1 ] . slice ( ySlice [ 0 ] , ySlice [ 1 ] ? ySlice [ 1 ] : undefined ) ,
62- dimArrays . length > 2 ? dimArrays [ 2 ] . slice ( xSlice [ 0 ] , xSlice [ 1 ] ? xSlice [ 1 ] : undefined ) : [ ] ,
63- ]
54+
6455 const { animate, animProg, cOffset, cScale, selectTS, lonExtent, latExtent,
6556 lonResolution, latResolution, nanColor, nanTransparency, sphereDisplacement, sphereResolution,
57+ zSlice, ySlice, xSlice,
6658 getColorIdx, incrementColorIdx} = usePlotStore ( useShallow ( state => ( {
6759 animate : state . animate ,
6860 animProg : state . animProg ,
@@ -77,10 +69,17 @@ export const Sphere = ({textures, ZarrDS} : {textures: THREE.Data3DTexture[] | T
7769 nanTransparency : state . nanTransparency ,
7870 sphereDisplacement : state . sphereDisplacement ,
7971 sphereResolution : state . sphereResolution ,
72+ zSlice : state . zSlice ,
73+ ySlice : state . ySlice ,
74+ xSlice : state . xSlice ,
8075 getColorIdx : state . getColorIdx ,
8176 incrementColorIdx : state . incrementColorIdx
8277 } ) ) )
83-
78+ const dimSlices = [
79+ dimArrays [ 0 ] . slice ( zSlice [ 0 ] , zSlice [ 1 ] ? zSlice [ 1 ] : undefined ) ,
80+ dimArrays [ 1 ] . slice ( ySlice [ 0 ] , ySlice [ 1 ] ? ySlice [ 1 ] : undefined ) ,
81+ dimArrays . length > 2 ? dimArrays [ 2 ] . slice ( xSlice [ 0 ] , xSlice [ 1 ] ? xSlice [ 1 ] : undefined ) : [ ] ,
82+ ]
8483 const [ boundsObj , setBoundsObj ] = useState < Record < string , THREE . Vector4 > > ( { } )
8584 const [ bounds , setBounds ] = useState < THREE . Vector4 [ ] > ( new Array ( 10 ) . fill ( new THREE . Vector4 ( - 1 , - 1 , - 1 , - 1 ) ) )
8685 const [ height , width ] = useMemo ( ( ) => isFlat ? dataShape : [ dataShape [ 1 ] , dataShape [ 2 ] ] , [ dataShape ] )
0 commit comments