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.
109 lines
4.2 KiB
Ziran
109 lines
4.2 KiB
Ziran
// How the Sun Salutation figures look and where the camera stands.
|
|
#import, file "../../src/practices/tai_chi/tai_chi_flat.zi";
|
|
#import, file "../../src/practices/tai_chi/tai_chi_math.zi";
|
|
#import, file "../../src/practices/tai_chi/tai_chi_solve.zi";
|
|
#import, file "../../src/practices/tai_chi/tai_chi_rules.zi";
|
|
#import, file "../../src/practices/tai_chi/tai_chi_view.zi";
|
|
#import, file "../../src/practices/sun_salutation/sun_salutation_pose.zi";
|
|
#import, file "../../src/practices/sun_salutation/sun_salutation_rules.zi";
|
|
#import, file "workout_moves.zi";
|
|
|
|
// Camera turns in degrees, as the workout frames its figure: prayer a
|
|
// little from her right so her feet and hands show, every other pose from
|
|
// her right side, turned enough that her face shows too.
|
|
SUN_SALUTATION_PRAYER_YAW :: -25.0
|
|
SUN_SALUTATION_SIDE_YAW :: -80.0
|
|
SUN_SALUTATION_TILT :: 7.0
|
|
SUN_SALUTATION_STANDING_SPAN :: 1.3
|
|
SUN_SALUTATION_FLOOR_SPAN :: 2.2
|
|
SUN_SALUTATION_STANDING_CENTER :: 0.25
|
|
SUN_SALUTATION_FLOOR_CENTER :: -0.08
|
|
|
|
SunSalutationView :: struct {
|
|
yaw: float64
|
|
span: float64
|
|
center: float64
|
|
}
|
|
|
|
// The Jade woman of Tai Chi and the workout in the chosen Auburn Dawn
|
|
// colours (design/sun-salutation/face-redesign): fair skin, auburn hair and
|
|
// a natural face.
|
|
SunSalutationWomanLook :: () -> TaiChiFlatLook {
|
|
look := TaiChiFlatLookNamed("jadeWoman")
|
|
look.skin = 0xf7c4a3
|
|
look.hair = 0x7c3a24
|
|
look.features = 0x3a2119
|
|
look.mouth = 0xd9937c
|
|
look.blush = 0xf0a08a
|
|
look.blush_alpha = 0.3
|
|
// The band round her bun is a darker auburn, not a bright tie.
|
|
look.accent = 0x5a2818
|
|
// A slimmer top of the Jade woman's length over a seat inside it, as the
|
|
// studio's 3D figure wears them (design/tai-chi, the sunWoman look), and
|
|
// finer hands and feet than the cartoon figure's.
|
|
TaiChiFlatJacket(*look, 0.112, 0.106, 0.09, 0.097, 0.1, 0.075, 0.062, 0.071, 0.006)
|
|
look.jacket_from = look.jacket[0][0]
|
|
look.limbs = 0.92
|
|
look.seat[0] = 0.088
|
|
look.seat[1] = 0.058
|
|
look.seat[2] = 0.06
|
|
look.seat[3] = -0.03
|
|
look.seat[4] = -0.008
|
|
look.hand_size = 0.92
|
|
look.foot_length = 0.85
|
|
look.foot_depth = 0.8
|
|
return look
|
|
}
|
|
|
|
SunSalutationStepView :: (step: s32) -> SunSalutationView {
|
|
view := SunSalutationView.{.yaw = SUN_SALUTATION_SIDE_YAW, .span = SUN_SALUTATION_FLOOR_SPAN,
|
|
.center = SUN_SALUTATION_FLOOR_CENTER}
|
|
// The camera turns while she stands tall, never while she is bent and
|
|
// the inside of her top would show.
|
|
if step == 0 || step == SUN_SALUTATION_STEP_COUNT - 1 {
|
|
view.yaw = SUN_SALUTATION_PRAYER_YAW
|
|
}
|
|
if step <= 2 || step >= SUN_SALUTATION_STEP_COUNT - 3 {
|
|
view.span = SUN_SALUTATION_STANDING_SPAN
|
|
view.center = SUN_SALUTATION_STANDING_CENTER
|
|
}
|
|
return view
|
|
}
|
|
|
|
SunSalutationViewAt :: (state: SunSalutationPracticeState) -> SunSalutationView {
|
|
to := SunSalutationStepView(state.step)
|
|
if state.step <= 0 {
|
|
return to
|
|
}
|
|
from := SunSalutationStepView(state.step - 1)
|
|
amount := SunSalutationTransition(state)
|
|
return SunSalutationView.{.yaw = from.yaw + (to.yaw - from.yaw) * amount,
|
|
.span = from.span + (to.span - from.span) * amount,
|
|
.center = from.center + (to.center - from.center) * amount}
|
|
}
|
|
|
|
// The app and exported video use the same pose, illustration and camera.
|
|
SunSalutationPaintPose :: (frame: *TaiChiFlatFrame, character: s32, pose: WorkoutPose,
|
|
view: SunSalutationView, width: float64, height: float64) -> TaiChiFraming {
|
|
rig := WorkoutRig()
|
|
solved := WorkoutSolve(*pose, *rig)
|
|
look := TaiChiFlatLookNamed("indigoMan")
|
|
if character == SUN_SALUTATION_MAN {
|
|
look.plain_top = true
|
|
} else {
|
|
look = SunSalutationWomanLook()
|
|
}
|
|
framing: TaiChiFraming
|
|
framing.camera.yaw = view.yaw * TAI_CHI_DEGREE
|
|
framing.camera.tilt = SUN_SALUTATION_TILT * TAI_CHI_DEGREE
|
|
framing.camera.center = TaiChiV3(0.0, 0.0, view.center)
|
|
framing.view_height = 2.35
|
|
framing.view_center = 1.02
|
|
across := framing.view_height * width / height
|
|
if across < view.span {
|
|
framing.view_height *= view.span / across
|
|
}
|
|
TaiChiFlatPaintLook(frame, *solved, *rig, look, framing.camera)
|
|
return framing
|
|
}
|