-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
GLTFExporter: CubicSpline interpolation support #13377
Conversation
// Detecting glTF cubic spline interpolant by checking factory method name because | ||
// GLTFCubicSplineInterpolant is a custom interpolant and doesn't return | ||
// valid value from .getInterpolation(). | ||
if ( track.createInterpolant.name === 'InterpolantFactoryMethodGLTFCubicSpline' ) { |
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.
.name
will disappear in some minified builds, I think... :/
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.
Ahhh, right. Hmmmmmm
Related: I imagine we could support exporting three.js's cubic spline interpolant by filling in some inferred tangents? (does not need to be in this PR, though) |
I haven't seen |
Related: I'm thinking to add an option to |
I wonder if we could add support for in/out tangents in |
Values layout and |
…antFactoryMethodGLTFCubicSpline
…y of factory method to detect cubic spline interpolant
Updated. Added |
Yeah, it just seems weird to have two different cubic spline implementations, especially when one is a superset of the other. We could deprecate but not remove the version without tangents, I suppose, or automatically create tangents when they aren't provided? Would want to verify that interpolation is as fast or faster when tangents are used. Meanwhile, this change looks fine to me. |
Ah, probably we could detect old version by checking valueSize(values.length / items.length) and generate tangents maybe? Another concern is increased memory consumption of sample values, 3x larger, if we create tangents at initialization. |
Thanks! |
This PR adds CubicSpline interpolation support to
GLTFExporter
.CubicSpline interpolation isn't in Three.js core yet, so exporting as
CUBICSPLINE
only when a custom interpolationGLTFCubicSplineInterpolant
declared inGLTFLoader
is used.As
GLTFCubicSplineInterpolant
is a custom interpolationtrack.getInterpolation()
doesn't return a valid value, it returns Three.js global interpolation type likeTHREE.InterpolateLinear
but there's no global type forGLTFCubicSplineInterpolant
.Then I named
GLTFCubicSplineInterpolant
factory function and check that name to detect if interpolation is CubicSpline instead of callingtrack.getInterpolation()
.