-
-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Allow for...of statement to work with vectors and matrices #1226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pkg.pr.new packages
benchmark commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
packages/typegpu/src/data/matrix.ts
Outdated
yield this[1]; | ||
yield this[2]; | ||
yield this[3]; | ||
return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that return undefined
is unnecessary, is there a reason for including this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without it the function's return type is void instead of undefined and there's a type error (not assignable to the property in base class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind. that's only for vectors, cause they extend Array
This will indeed work, just fyi the current implementation of vector already supports iteration due to it extending from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome change! 🚀
* Raster cube with lighting Added dependencies, cube model, textures, directional and point lighting * Moved cube code into separate file * Comprehensive logic separation * Added gravitational force * Rewrote shader to apply gravitational force * Central gravity * Code reformatting and drag * Moved necessary celestial bodies to gpu data holders * Accessing celestialBodies in shader * Compute shader modifications, celestialBodiesGroup changes * Moved all calculations into compute shader * Compute shader is now fully integrated * Introduced matrix translation * Introduced std identity * Added tests for std.identity * Tests updates * Compute shader fixes * Working compute shader implementation * Compute shader works for multiple objects * Working multiple celestial bodies * Background colour to black * Introduced newton gravity equation * Sphere vertices * 4th cube spawns * Merge with origin/main * Revert "Merge with origin/main" This reverts commit 5e10b86. * Refactor 1 * Refactor 2 - remove cube.ts * Refactor 3 - rename files * Refactor 4 - schemas.ts * Refactor 5 - move matrix functions to another file * Add buffer for other compute inputs * Rewrite compute shader * Move compute buffers to DynamicResources * Add initial parameters loading from presets.ts * Add preset switching * Add depth stencil * Fix compute bodies count * Add lighting from 3D fish * Add sphere model * Add celestial body radius * Merge fixes * Update camera to newer version * Make velocity and radius optional in presets.ts * Add resizeObserver, make canvas fit to container * Add skyboxes * Move textures to gravity folder in assets * Add custom celestial body texture support * Change algorithm to leapfrog, fix transformation matrix issues * Replace compute method with more accurate one * Update celestial body bouncing * Finish `Planet rings` preset * Update `CelestialBody` schema * Move enums to a dedicated folder * Remove radius and transformation matrix from CelestialBody * Split compute pipeline into two pipelines * Implement merge collisions * Remove celestialBodiesLayout from render * Split compute layouts for different pipelines * Add simulation speed slider * Replace sphere model with an icosphere * Refactor render bing groups * Add attribution, dispose od old data * Add mobile controls * Remove matrix changes * Remove test presets * Add Solar System preset * Add default camera positions to the presets * Remove extra skyboxes, make Solar System the default preset * Update lighting system * Update preset light sources * Remove babel dependency (why was it here to begin with?) * Make simulation frame independent * Merge load-models and textures into helpers.ts * Nits * Remove dev comment * Make naming schema consistent * Change `collisionBehaviors` from array to object * Refactor collision logic * Change skyBox to a static resource * Inline device * Add `initialPreset` variable * Simplify arrow syntax where possible * Remove cull mode * Git LFS * Treating .obj files as large files * I don't know what changed * Change mouseup event to be on window * Add cullMode to render pipeline * Update CI * Reload github actions * Apply deno formatting * Remove `.does` from examples * Try remove manual `git lfs pull` * Apply suggestions from code review Co-authored-by: Iwo Plaza <[email protected]> * feat: Use accessor for OKLab alpha (#1228) * feat: Use accessor for OKLab alpha * Review fixes * docs: unplugin-typegpu guide (#1191) * docs: ColorPicker example controls (#1214) * docs: Persist ControlPanel toggles state in local storage (#1222) * fix: Small formatting fix in ColorPicker * impr: Throw error when trying to define tgpu.derived during resolution (#1223) * feat: Allow for...of statement to work with vectors and matrices (#1226) * Undo formatting on index * Update skybox vertexFn in examples * Simplified skybox shader * Simplified skybox in the reflection example --------- Co-authored-by: lursz <[email protected]> Co-authored-by: Aleksander Katan <[email protected]> Co-authored-by: Iwo Plaza <[email protected]> Co-authored-by: Marcin Hawryluk <[email protected]>
closes #1106