remove textureData#697
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors texture data management by removing the global textureData state and its setter from GlobalStore.ts. Instead, ArrayToTexture now generates and passes textureData directly to CreateTexture using a new createData helper function. Additionally, unused imports and hook calls are cleaned up in PointCloud.tsx, and maxPointsPerDraw is reduced to a more reasonable limit of 25 million. Feedback on these changes suggests making the data parameter in CreateTexture required to improve type safety, as the fallback to the global store has been removed.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| export function CreateTexture(shape: number[], data?: Uint8Array) : THREE.DataTexture[] | THREE.Data3DTexture[] | undefined { | ||
| const {textureArrayDepths} = useGlobalStore.getState() | ||
| const textureData = data ? data : useGlobalStore.getState().textureData | ||
| const textureData = data |
There was a problem hiding this comment.
Since the fallback to useGlobalStore.getState().textureData has been removed, the data parameter is now effectively required for CreateTexture to function. If data is omitted, the function immediately returns undefined.
To improve type safety and catch potential bugs at compile time, we should make data a required parameter in the function signature (line 27) and update the return type to exclude undefined.
export function CreateTexture(shape: number[], data: Uint8Array) : THREE.DataTexture[] | THREE.Data3DTexture[]
This removes the extra textureData state from the global store freeing up memory. It partially addresses #435 but ideally it would be nice to find a way of putting the data already in the textures explicitly on the vertices.
Also went back to 25 million points in drawcalls for the points. I misunderstood the limitation that was being addressed with that.