A three.js body lab (design/tai-chi/sun-salutation.html, tools/sun-salutation.mjs) plays the app's exact Sun Salutation motion, exported by render-sun-salutation-live.py --motion, on the studio's skinned 3D woman in the app's look. There the long top drapes over the hips and a seat ellipsoid sits inside it, which looks natural in every pose. The app now draws her the same way: the slimmer top at the Jade woman's length over one seat ellipsoid on the pelvis, in place of separate buttock shapes.
64 lines
2.0 KiB
Ziran
64 lines
2.0 KiB
Ziran
// Offscreen entry for the same renderer and artwork used by the player.
|
|
#import, file "../apps/practice/sun_salutation_artwork.zi";
|
|
#import, file "../apps/practice/workout_moves.zi";
|
|
#import, file "../src/practices/sun_salutation/sun_salutation_pose.zi";
|
|
#import, file "../src/practices/sun_salutation/sun_salutation_rules.zi";
|
|
#import, file "../src/practices/tai_chi/tai_chi_flat.zi";
|
|
#import, file "../src/practices/tai_chi/tai_chi_rules.zi";
|
|
#import, file "../src/practices/tai_chi/tai_chi_solve.zi";
|
|
|
|
preview_frame: TaiChiFlatFrame;
|
|
preview_framing: TaiChiFraming;
|
|
preview_solved: TaiChiSolved;
|
|
preview_yaw: float64;
|
|
|
|
PreviewState :: () -> SunSalutationPracticeState {
|
|
state: SunSalutationPracticeState
|
|
state.repetitions = 2
|
|
state.start_seconds = 6
|
|
state.end_seconds = 6
|
|
return SalutationStart(state)
|
|
}
|
|
|
|
#program_export
|
|
PreviewDuration :: () -> float64 {
|
|
return cast(float64)SalutationDurationSeconds(PreviewState())
|
|
}
|
|
|
|
#program_export
|
|
PreviewFrame :: (second: float64, width: s32, height: s32) -> *TaiChiFlatFrame {
|
|
state := SalutationAdvance(PreviewState(), second).state
|
|
rig := WorkoutRig()
|
|
pose := SunSalutationPoseAt(state, *rig)
|
|
preview_framing = SunSalutationPaintPose(*preview_frame, state.character, pose, SunSalutationViewAt(state),
|
|
cast(float64)width, cast(float64)height)
|
|
return *preview_frame
|
|
}
|
|
|
|
#program_export
|
|
PreviewHeight :: () -> float64 {
|
|
return preview_framing.view_height
|
|
}
|
|
|
|
#program_export
|
|
PreviewCenter :: () -> float64 {
|
|
return preview_framing.view_center
|
|
}
|
|
|
|
// The solved skeleton at `second` and the camera's turn in degrees, for the
|
|
// three.js lab (design/tai-chi/sun-salutation.html).
|
|
#program_export
|
|
PreviewSolved :: (second: float64) -> *TaiChiSolved {
|
|
state := SalutationAdvance(PreviewState(), second).state
|
|
rig := WorkoutRig()
|
|
pose := SunSalutationPoseAt(state, *rig)
|
|
preview_solved = WorkoutSolve(*pose, *rig)
|
|
preview_yaw = SunSalutationViewAt(state).yaw
|
|
return *preview_solved
|
|
}
|
|
|
|
#program_export
|
|
PreviewYaw :: () -> float64 {
|
|
return preview_yaw
|
|
}
|