// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Includes.gdshaderinc" // #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Variables.gdshaderinc" // #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Vertex.gdshaderinc" // vec3 translation; mat3 rotation; if ( positionInterpolationMode == 0 ) { translation = mix( startPosition, endPosition, t ); } else if ( positionInterpolationMode == 1 ) { float controlLength = length( endPosition - startPosition ) * bezierCurvature; vec3 c0 = startPosition + normalize( startForward ) * controlLength; vec3 c1 = endPosition - normalize( endForward ) * controlLength; translation = cubicBezier( t, startPosition, c0, c1, endPosition ); } else if ( positionInterpolationMode == 2 ) { float controlLength = length( endPosition - startPosition ) * rationalCurvature; vec3 c0 = startPosition + normalize( startForward ) * controlLength; vec3 c1 = endPosition - normalize( endForward ) * controlLength; translation = rationalCubicBezier( t, startPosition, c0, c1, endPosition, 1.0, rationalWeighting, rationalWeighting, 1.0 ); } if ( rotationInterpolationMode == 0 ) { vec3 forward = normalize( mix( startForward, endForward, t ) ); vec3 up = normalize( mix( startUp, endUp, t ) ); rotation = lookRotation( forward, up ); } else if ( rotationInterpolationMode == 1 ) { vec4 startRotation = quaternionFromLookRotation( startForward, startUp ); vec4 endRotation = quaternionFromLookRotation( endForward, endUp ); vec4 qRotation = quaternionSlerp( startRotation, endRotation, t ); rotation = quaternionToRotationMatrix( qRotation ); } else if ( rotationInterpolationMode == 2 ) { float controlLength = length( endPosition - startPosition ) * bezierCurvature; vec3 c0 = startPosition + normalize( startForward ) * controlLength; vec3 c1 = endPosition - normalize( endForward ) * controlLength; vec3 forward = normalize( cubicBezierDerivative( t, startPosition, c0, c1, endPosition ) ); vec3 up = normalize( mix( startUp, endUp, t ) ); rotation = lookRotation( forward, up ); } else if ( rotationInterpolationMode == 3 ) { vec3 lineDirection = normalize( endPosition - startPosition ); vec3 forward = t < 0.5 ? mix( startForward, lineDirection, t * 2.0 ) : mix( lineDirection, endForward, ( t - 0.5 ) * 2.0 ); vec3 up = normalize( mix( startUp, endUp, t ) ); rotation = lookRotation( forward, up ); } else if ( rotationInterpolationMode == 4 ) { bool isStart = t < 0.5; vec3 lineDirection = normalize( endPosition - startPosition ); vec3 centerUp = normalize( mix( startUp, endUp, 0.5 ) ); vec3 forwardA = isStart ? startForward : lineDirection; vec3 forwardB = isStart ? lineDirection : endForward; vec3 upA = isStart ? startUp : centerUp; vec3 upB = isStart ? centerUp : endUp; vec4 rotationA = quaternionFromLookRotation( forwardA, upA ); vec4 rotationB = quaternionFromLookRotation( forwardB, upB ); float rt = isStart ? ( t * 2.0 ) : ( ( t -0.5 ) * 2.0 ); vec4 qRotation = quaternionSlerp( rotationA, rotationB, rt ); rotation = quaternionToRotationMatrix( qRotation ); }