Skip to content

remove textureData#697

Open
TheJeran wants to merge 5 commits into
mainfrom
jp/removeTexData
Open

remove textureData#697
TheJeran wants to merge 5 commits into
mainfrom
jp/removeTexData

Conversation

@TheJeran

Copy link
Copy Markdown
Collaborator

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant