@hology/core 0.0.192 → 0.0.194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/effects/sequence/index.d.ts +5 -0
- package/dist/effects/sequence/index.js +1 -1
- package/dist/effects/sequence/sequence-action.d.ts +2 -1
- package/dist/effects/sequence/sequence-actor.d.ts +9 -0
- package/dist/effects/sequence/sequence-actor.js +1 -1
- package/dist/effects/sequence/sequence-animation-retiming.d.ts +15 -0
- package/dist/effects/sequence/sequence-animation-retiming.js +4 -0
- package/dist/effects/sequence/sequence-data.d.ts +48 -2
- package/dist/effects/sequence/sequence-data.js +1 -1
- package/dist/effects/sequence/sequence-definitions.d.ts +53 -0
- package/dist/effects/sequence/sequence-definitions.js +4 -0
- package/dist/effects/sequence/sequence-event.d.ts +24 -1
- package/dist/effects/sequence/sequence-event.js +1 -1
- package/dist/effects/sequence/sequence-locator.d.ts +14 -0
- package/dist/effects/sequence/sequence-locator.js +4 -0
- package/dist/effects/sequence/sequence-ops.d.ts +48 -0
- package/dist/effects/sequence/sequence-ops.js +4 -0
- package/dist/effects/sequence/sequence-player.d.ts +37 -3
- package/dist/effects/sequence/sequence-player.js +1 -1
- package/dist/effects/sequence/sequence-value-lane.d.ts +21 -0
- package/dist/effects/sequence/sequence-value-lane.js +4 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -1
- package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -1
- package/dist/gameplay/actors/builtin/post-process-volume-actor.d.ts +25 -1
- package/dist/gameplay/actors/builtin/post-process-volume-actor.js +1 -1
- package/dist/gameplay/index.d.ts +1 -0
- package/dist/gameplay/index.js +1 -1
- package/dist/gameplay/initiate.d.ts +4 -0
- package/dist/gameplay/initiate.js +1 -1
- package/dist/gameplay/services/game-time-scheduler.d.ts +25 -0
- package/dist/gameplay/services/game-time-scheduler.js +4 -0
- package/dist/gameplay/services/render.d.ts +11 -2
- package/dist/gameplay/services/render.js +1 -1
- package/dist/rendering/color-pass.d.ts +62 -7
- package/dist/rendering/color-pass.js +1 -1
- package/dist/rendering.d.ts +25 -0
- package/dist/rendering.js +1 -1
- package/dist/scene/asset-resource-loader.js +1 -1
- package/dist/scene/custom-param-deserialize.d.ts +18 -0
- package/dist/scene/custom-param-deserialize.js +4 -0
- package/dist/scene/materializer.d.ts +1 -0
- package/dist/scene/materializer.js +1 -1
- package/dist/shader/builtin/landscape-composite-shader.js +1 -1
- package/dist/shader/builtin/standard-shader.js +1 -1
- package/dist/shader/parameter.d.ts +5 -0
- package/dist/test/post-process-color-grading.test.d.ts +2 -0
- package/dist/test/post-process-color-grading.test.js +4 -0
- package/dist/test/sequence-animation-retiming.test.d.ts +2 -0
- package/dist/test/sequence-animation-retiming.test.js +4 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{expect as t,test as o}from"vitest";import*as e from"three";import{BaseActor as i}from"../gameplay/actors/actor.js";import{CharacterAnimationComponent as n,CharacterMovementComponent as s}from"../gameplay/actors/index.js";import{RootMotionClip as r}from"../gameplay/animation/root-motion.js";import{createAnimationClipInstance as a,createAnimationSubTrack as c,evaluateAnimationClipOutputProgress as l,evaluateAnimationClipSourceProgress as m,normalizeAnimationClipRetiming as p,SequencePlayer as u,buildRetimedAnimationClip as d}from"../effects/sequence/index.js";function g(t){return Array.from(t).map(t=>Math.round(1e3*t)/1e3)}o("uniform retiming mapping stays linear",()=>{t(m(void 0,.25)).toBeCloseTo(.25),t(l(void 0,.75)).toBeCloseTo(.75),t(m({mode:"uniform",points:[]},.6)).toBeCloseTo(.6)}),o("impact retiming redistributes time around the impact marker",()=>{const o={mode:"impact",points:[{id:"impact",clipProgress:.35,sourceProgress:.55}]};t(m(o,.35)).toBeCloseTo(.55),t(l(o,.55)).toBeCloseTo(.35),t(m(o,.7)).toBeGreaterThan(.7)}),o("advanced retiming sanitization stays monotonic and bounded",()=>{const o=p({mode:"advanced",points:[{id:"a",clipProgress:.9,sourceProgress:.2},{id:"b",clipProgress:-4,sourceProgress:.8},{id:"c",clipProgress:.9,sourceProgress:2},{id:"d",clipProgress:.4,sourceProgress:.1}]});t(o.points).toHaveLength(3);for(let e=1;e<o.points.length;e++)t(o.points[e].clipProgress).toBeGreaterThan(o.points[e-1].clipProgress),t(o.points[e].sourceProgress).toBeGreaterThan(o.points[e-1].sourceProgress);t(o.points[0].clipProgress).toBeGreaterThan(0),t(o.points[o.points.length-1].sourceProgress).toBeLessThan(1)}),o("retimed clip baking preserves trim boundary poses and remaps track times to clip duration",()=>{const o=new e.AnimationClip("trim-test",2,[new e.NumberKeyframeTrack("weight",[0,1,2],[0,10,20])]),i=a("anim",0,1);i.clipStartOffset=.5,i.clipEndOffset=.25,i.retiming={mode:"advanced",points:[]};const n=d(o,i),s=n.tracks[0];t(n.duration).toBeCloseTo(1),t(g(s.times)).toEqual([0,.4,1]),t(g(s.values)).toEqual([5,10,17.5])}),o("root motion track baking stays aligned with the retimed visual clip",()=>{const o=new e.AnimationClip("root-motion-test",2,[new e.VectorKeyframeTrack("hips.position",[0,1,2],[0,0,0,1,0,0,2,0,0])]),i=a("anim",0,1);i.retiming={mode:"impact",points:[{id:"impact",clipProgress:.25,sourceProgress:.5}]};const n=d(o,i),s=n.tracks[0],c=r.fromClip(n,!1);t(g(s.times)).toEqual([0,.25,1]),t(g(c.motionTrack.times)).toEqual([0,.25,1]),t(g(c.motionTrack.values)).toEqual([0,0,0,1,0,0,2,0,0])}),o("sequence player keeps uniform clips on the existing playback path",()=>{const o=new u,i=c(),n=a("anim",0,1);n.playbackRate=1.75,n.clipStartOffset=.25,i.clips.push(n);const s=new e.AnimationClip("uniform-test",2,[new e.NumberKeyframeTrack("weight",[0,1,2],[0,1,2])]);o.animationClips.set("anim",s);const r=new e.Object3D,l={target:r,mixer:new e.AnimationMixer(r),activeActions:new Map};o.evaluateAnimationSubTrack(i,l,.1);const m=l.activeActions.get(`${i.id}-${n.id}`);t(m).toBeDefined(),t(m.getClip()).toBe(s),t(m.timeScale).toBeCloseTo(1.75),t(m.time).toBeCloseTo(.25)}),o("sequence player uses baked retimed clips and still wires root motion through the action",()=>{const o=new u,i=c(),n=a("anim",0,1.5);n.rootMotion=!0,n.playbackRate=2,n.retiming={mode:"impact",points:[{id:"impact",clipProgress:.3,sourceProgress:.55}]},i.clips.push(n);const s=new e.AnimationClip("retimed-root",2,[new e.VectorKeyframeTrack("hips.position",[0,1,2],[0,0,0,1,0,0,2,0,0]),new e.NumberKeyframeTrack("weight",[0,1,2],[0,1,2])]);o.animationClips.set("anim",s);const l=new h,m=new f(l.object),p=new A;l.charAnim=m,l.movement=p;const d={target:l,activeActions:new Map};o.evaluateAnimationSubTrack(i,d,.1);const g=d.activeActions.get(`${i.id}-${n.id}`);t(g).toBeDefined(),t(g.timeScale).toBeCloseTo(1),t(g.getClip()).toBeInstanceOf(r),t(g.getClip().duration).toBeCloseTo(1.5),t(p.lastRootMotionAction).toBe(g),t(o.retimedAnimationClips.size).toBe(1)});class h extends i{constructor(){super(...arguments),this.charAnim=null,this.movement=null}getComponent(t){return t===n?this.charAnim:t===s?this.movement:void 0}}class f{constructor(t){this.fullBodyAction=null,this.mixer=new e.AnimationMixer(t)}play(t,o={}){this.fullBodyAction=this.mixer.clipAction(t),this.fullBodyAction.setLoop(e.LoopOnce,1),this.fullBodyAction.clampWhenFinished=!0,this.fullBodyAction.timeScale=o.timeScale??1,null!=o.offset&&(this.fullBodyAction.time=o.offset),this.fullBodyAction.play()}beginExternalAnimationControl(t,o={}){return this.play(t,o),this.getFullBodyAction()}getFullBodyAction(){if(null==this.fullBodyAction)throw new Error("No full body action is active");return this.fullBodyAction}getMixer(){return this.mixer}beginExternalControl(){}endExternalControl(){}stopSequenceAnimation(){}}class A{constructor(){this.lastRootMotionAction=null}setRootMotionAction(t){this.lastRootMotionAction=t}}/*
|
|
2
|
+
* Copyright (©) 2026 Hology Interactive AB. All rights reserved.
|
|
3
|
+
* See the LICENSE.md file for details.
|
|
4
|
+
*/
|