Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Examples - Update WebGPU Compute Water#30440

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cmhhelgeson wants to merge1 commit intomrdoob:dev
base:dev
Choose a base branch
Loading
fromcmhhelgeson:cmh/compute_water_more_struct

Conversation

cmhhelgeson
Copy link
Contributor

@cmhhelgesoncmhhelgeson commentedFeb 1, 2025
edited
Loading

Related issue:#30426

Description

Updates WebGPU Compute Water to demonstrate an example of returning a struct from a defined function. DOES NOT solve the issue mentioned by this comment in this initial struct implementation, which is still under investigation:#30394 (comment)

sunag, Makio64, lin72h, and IRainman reacted with heart emoji
@sunagsunag added this to ther174 milestoneFeb 2, 2025
@mrdoob
Copy link
Owner

@sunag looks good?

@sunag
Copy link
Collaborator

@sunag looks good?

@cmhhelgeson did a great job, I just would like to think a little more aboutdestructureStruct() and maybe make something easier natively in TSL.

cmhhelgeson and mrdoob reacted with thumbs up emoji

@cmhhelgeson
Copy link
ContributorAuthor

cmhhelgeson commentedFeb 6, 2025
edited
Loading

@sunag looks good?

@cmhhelgeson did a great job, I just would like to think a little more aboutdestructureStruct() and maybe make something easier natively in TSL.

Dirty version I was able to come up with in StructNode, though it currently has only limited use cases (i.e it can destructure right after creating a struct but not a struct that has been returned from a funtion). I'll try experimenting from here.

destructure(){conststructMembers=this.structLayoutNode.membersLayout.map(member=>member.name);constmemberNodes={};for(constmemberofstructMembers){memberNodes[member]=this.get(member);}returnmemberNodes;}

// Use Case

constneighborValues=NeighborValuesStruct();const{ north, south, east, west}=neighborValues.destructure();north.assign(store.element(northIndex));south.assign(store.element(southIndex));east.assign(store.element(eastIndex));west.assign(store.element(westIndex));returnneighborValues;

Would we prefer destructure(StructNodeInstance) or StructNodeInstance.destructure()

@sunag
Copy link
Collaborator

Initially I did the assignment directly from the declaration ofstruct, so we could use it with the properties. e.g:

constneighborValues=NeighborValuesStruct();neighborValues.north.assign( ...)

The problem is that this doesn't work when we work with TSL function returns. So my solution was to createget() so that it could generate aMemberNode that would look for the reference at the time ofsetup() orgenerate().

Then I thought about generating a member for properties that had the$ prefix, for example.

constneighborValues=NeighborValuesStruct();neighborValues.$north.assign( ...)

This would solve the case, since with the prefix you could still access undefined properties of the Nodes. But I would be extremely dependent on the Proxy class, and to be honest, I hope we can do everything with prototype in the future. So I was thinking about using.member() similar to what you presented, but handlingProxy only in the scope of members, so that it would also work on returns from TSL functions.

@mrdoob
Copy link
Owner

I hope we can do everything with prototype in the future

👍

@mrdoobmrdoob modified the milestones:r174,r175Feb 27, 2025
@mrdoobmrdoob modified the milestones:r175,r176Mar 28, 2025
@mrdoobmrdoob modified the milestones:r176,r177Apr 24, 2025
@mrdoobmrdoob modified the milestones:r177,r178May 30, 2025
@mrdoobmrdoob modified the milestones:r178,r179Jun 30, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
r179
Development

Successfully merging this pull request may close these issues.

3 participants
@cmhhelgeson@mrdoob@sunag

[8]ページ先頭

©2009-2025 Movatter.jp