Skip to content
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

Fix confusing code in deferredRendering #327

Merged
merged 1 commit into from
Nov 23, 2023
Merged

Fix confusing code in deferredRendering #327

merged 1 commit into from
Nov 23, 2023

Conversation

tyfkda
Copy link
Contributor

@tyfkda tyfkda commented Nov 17, 2023

I modified the Deferred Rendering implementation due to some confusing code:

  • The initialization of viewMatrix incorrectly uses mat4.inverse with mat4.lookAt.
  • The getCameraViewProjMatrix function has a local variable of the same name, so it's not used.
  • rotation matrix is applied twice within the getCameraViewProjMatrix function.
  • I've changed viewProjMatrix to not reserve space in advance for the result matrix, similar to other matrices like rotation that don't do this.

@austinEng austinEng requested a review from shrekshao November 17, 2023 14:36
Copy link
Collaborator

@shrekshao shrekshao left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the change. I have no idea why the original code looks like that. Probably leftover when migrating from gl-matrix to wgpu-matrix

One comment: Remove eyePosition at line 479 as indicated by GithubActions
(I cannot add a comment there as github says "Line must be part of the diff")

* The initialization of `viewMatrix` incorrectly uses `mat4.inverse` with `mat4.lookAt`.
* The `getCameraViewProjMatrix` function has a local variable of the same name, so it's not used.
* `rotation` matrix is applied twice within the `getCameraViewProjMatrix` function.
* Change `viewProjMatrix` to not reserve space in advance for the result matrix, similar to other matrices like `rotation` that don't do this.
* Remove duplicated `eyePosition` definition.
@tyfkda
Copy link
Contributor Author

tyfkda commented Nov 21, 2023

@shrekshao Thank you for your review.
I've updated (amend) my commit
and it seems passing lint, build and export on my local environment.

@tyfkda
Copy link
Contributor Author

tyfkda commented Nov 23, 2023

@shrekshao, @austinEng,
Would you please proceed merge process? Thanks.

@shrekshao shrekshao merged commit 2d193cb into webgpu:main Nov 23, 2023
1 check passed
@tyfkda tyfkda deleted the feature/remove-inverse branch November 23, 2023 23:01
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.

2 participants