-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Raycaster: Add barycoord to intersection result, make attribution interpolation more convenient. #29340
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
src/math/Triangle.js
Outdated
@@ -106,6 +111,25 @@ class Triangle { | |||
|
|||
} | |||
|
|||
static getAttributeInterpolationFromBarycoord( attr, i1, i2, i3, barycoord, target ) { |
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.
The change is okay for me 👍 .
Would you still add a documentation for getAttributeInterpolationFromBarycoord()
?
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.
Done!
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.
How about simply getInterpolatedAttribute()
.
It is more than just barycoord
that you are passing in.
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.
Just renamed it! I think the simpler name is better, as well.
…terpolation more convenient (mrdoob#29340) * Add a barycoord helper * add fields to point, line * Fix import * Remove unused variables * Update docs * Rename method * Rename function in Mesh class
Related issue: --
Description
Currently raycasting only returns a few pre-interpolated results but not all, which can be useful in cases where other attributes need to be interpolated abitrarily, such as when sampling the recently-added Cesium metadata plugins for 3D Tiles Renderer. This PR outputs the barcoord of the hit point relative to the surface to mesh raycast intersections and adds a
getAttributeInterpolationFromBarycoord
function to Triangle to make interpolating attributes more convenient.Currently this is the code that needs to be run to interpolate a uv3 attribute after raycast:
And this is what it is after:
This contribution is funded by Cesium GIS Ecosystem Grant