def transform_rotate_quat_animated(cfg, quat0=(0, 0, -0.474, 0.880), quat1=(0, 0, 0, 0)): cfg.aspect_ratio = (1, 1) shape = _transform_shape(cfg) anim = [ ngl.AnimKeyFrameQuat(0, quat0), ngl.AnimKeyFrameQuat(cfg.duration / 2., quat1), ngl.AnimKeyFrameQuat(cfg.duration, quat0), ] return ngl.RotateQuat(shape, anim=ngl.AnimatedQuat(anim))
def _get_live_trf_spec(layout): t0 = ngl.Identity() t1 = ngl.Transform(t0) t2 = ngl.Translate(t1) t3 = ngl.Rotate(t2) t4 = ngl.Scale(t3) t5 = ngl.RotateQuat(t4) return [ dict( name='m4', type='mat4', category='single', func=lambda data: ngl.UniformMat4(data, transform=t5), livechange=( lambda: t1.set_matrix( # trf_step=1 0.1, 0.2, 0.0, 0.0, 0.0, 0.3, 0.4, 0.0, 0.0, 0.0, 0.5, 0.0, 0.8, 0.7, 0.0, 0.6, ), lambda: t2.set_vector(0.2, 0.7, -0.4), # trf_step=2 lambda: t3.set_angle(123.4), # trf_step=3 lambda: t4.set_factors(0.7, 1.4, 0.2), # trf_step=4 lambda: t5.set_quat(0, 0, -0.474, 0.880), # trf_step=5 lambda: t5.set_quat(0, 0, 0, 1), lambda: t4.set_factors(1, 1, 1), lambda: t3.set_angle(0), lambda: t2.set_vector(0, 0, 0), lambda: t1.set_matrix( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, )), ), ]
def transform_rotate_quat_anchor(cfg, quat=(0, 0, -0.474, 0.880), anchor=(0.15, 0.35, 0.7)): cfg.aspect_ratio = (1, 1) shape = _transform_shape(cfg) return ngl.RotateQuat(shape, quat, anchor=anchor)
def transform_rotate_quat(cfg, quat=(0, 0, -0.474, 0.880)): cfg.aspect_ratio = (1, 1) shape = _transform_shape(cfg) return ngl.RotateQuat(shape, quat)
def _get_live_trf_spec(): t0 = ngl.Identity() t1 = ngl.Transform(t0) t2 = ngl.Translate(t1) t3 = ngl.Rotate(t2) t4 = ngl.Scale(t3) t5 = ngl.RotateQuat(t4) t6 = ngl.Skew(t5) return [ dict( name="m4", type="mat4", category="single", func=lambda data: ngl.UniformMat4(data, transform=t6), livechange=( # fmt: off lambda: t1.set_matrix( # trf_step=1 0.1, 0.2, 0.0, 0.0, 0.0, 0.3, 0.4, 0.0, 0.0, 0.0, 0.5, 0.0, 0.8, 0.7, 0.0, 0.6, ), lambda: t2.set_vector(0.2, 0.7, -0.4), # trf_step=2 lambda: t3.set_angle(123.4), # trf_step=3 lambda: t4.set_factors(0.7, 1.4, 0.2), # trf_step=4 lambda: t5.set_quat(0, 0, -0.474, 0.880), # trf_step=5 lambda: t6.set_angles(0, 50, -145), # trf_step=6 lambda: t6.set_angles(0, 0, 0), lambda: t5.set_quat(0, 0, 0, 1), lambda: t4.set_factors(1, 1, 1), lambda: t3.set_angle(0), lambda: t2.set_vector(0, 0, 0), lambda: t1.set_matrix( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, ) # fmt: on ), ), ]