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 view z calculation for 'distance' used as sort key #4330

Closed

Commits on May 4, 2022

  1. examples: Fix view z calculation for 'distance' used as sort key

    The model translation must be transformed by the inverse view transform. If you
    consider an object directly in front of you and you turn your head to the left
    you're now looking to the left of the object. The way rendering works is that
    you instead consider that your head remains stationary, and you rotate
    everything else in the opposite direction to how you want to turn your head.
    So, you transform the model by the inverse view transform.
    
    To get the view space z of the object, we can calculate the dot product of row
    2 of the inverse view matrix and the object's translation, which is stored in
    column 3 of the object transform.
    superdump committed May 4, 2022
    Configuration menu
    Copy the full SHA
    d7966d7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5027282 View commit details
    Browse the repository at this point in the history
  3. Clean up unused imports

    superdump committed May 4, 2022
    Configuration menu
    Copy the full SHA
    684edd4 View commit details
    Browse the repository at this point in the history