- Many of the divergence copy is redundant and could be covered by a single note in the readme. Things like "split into folders" "tonemapping", the switch to cameraCOntrols, camera near/far, etc. Its all generic fluff not about whats actually different. Especially if theres an inline comment saying the same thing already.
- The langauge is HARD to read for an intermediate user. Maybe headline with more approachable language and if the detailed tecnical description is required we can expand below it.
- In components/classes add inline breaks. These big blocks of code are hard to navigate and understand. these are just ideas, we can make it formal/better but it would be cleaner to read Like: //* -- Control Panel -- (big header)
// Tools: (sections) 4. CRITICAL: Avoid imperitive material, geometry, etc creation. In raging sea for example you create the material and geometry in a useMemo then use a primitive. When the whole point of all this is the r3f style. There was already a raging sea example in the v10 demos but we ignored it. I'm rewriting this to be in-line. 5. USE THE NEW HOOKS. In almost every instance you use useMemos and complex wrapping when useNodes, useTextures, etc would work for this. Specifically useNodes. It has access to the uniforms, textures, etc within itself and doesnt need some of the crazy wrapping. 6. If we find ourselves casting or doing types in each demo, thats a smell to a larger problem. Flag the issue and have a stronger agent reasses it. 7. r3f types and setup means we dont need to import Mesh, Materials, etc. something is broken if using them inline doesnt work. 8.TRY TO USE REACT its much cleaner and simpler to write than injecting imperitive everwhere. Yes, we can make clean for loops and data tracks like that. but it is harder to read/infer what is happening compared to declaritive. We can still use loops but a bit more direct and the demo is to show react & vanilla working together. If its BAD to use react then of course use vanilla but we should try react first.
- Imports should use a hierarchy.
Root is the largest most important libraries. So react > three > r3f > third party r3f > global utils > parent > siblings.
-
The language and verbose nature of some of the comments is a bit much. For example the RTT pass. We can way simplify, and if later comments like the NDC come up in-line then we should decide where we want to say it, or mention early a tease/pre list. Otherwise it reads as 32 lines of outline.
-
Avoid calling a ref just ref. in errors or other messages it wount be clear. const ref = useRef(null) Instead use boxRef, meshRef, etc so if it shows in a console we know what/where.
-
Multiple similarly linked useEffects against the same target is a bad smell. This may seem it goes against the pattern to put controls in the root, but a strength of Leva is that it can take inputs from many useControls and link to gether.
-
I dont know why everything has a hard controls only on the root. THis makes us CONSTANTLY prop drill. Leva and useUniforms are specifically designed to work together. We should put the controls/folders close to their use so we can make uniforms or other things from them directly. Passing props from leva through react only to pass it into uniforms or nodes is a massive fail.
-
useFrame has delta and elapsed in its state. Yes you can get it direct from the other param but it looks weird to underscore the state to get delta. just destructure
-
Use react hooks, even less generic ones like useCallback.