@@ -5,6 +5,7 @@ mod graphics;
55pub mod image;
66pub mod render;
77mod surface;
8+ pub mod transform;
89
910use std:: { cell:: RefCell , num:: NonZero , path:: PathBuf , sync:: OnceLock } ;
1011
@@ -483,37 +484,6 @@ pub fn graphics_mode_2d(graphics_entity: Entity) -> error::Result<()> {
483484 } )
484485}
485486
486- pub fn graphics_camera_position (
487- graphics_entity : Entity ,
488- x : f32 ,
489- y : f32 ,
490- z : f32 ,
491- ) -> error:: Result < ( ) > {
492- app_mut ( |app| {
493- flush ( app, graphics_entity) ?;
494- app. world_mut ( )
495- . run_system_cached_with ( graphics:: camera_position, ( graphics_entity, x, y, z) )
496- . unwrap ( )
497- } )
498- }
499-
500- pub fn graphics_camera_look_at (
501- graphics_entity : Entity ,
502- target_x : f32 ,
503- target_y : f32 ,
504- target_z : f32 ,
505- ) -> error:: Result < ( ) > {
506- app_mut ( |app| {
507- flush ( app, graphics_entity) ?;
508- app. world_mut ( )
509- . run_system_cached_with (
510- graphics:: camera_look_at,
511- ( graphics_entity, target_x, target_y, target_z) ,
512- )
513- . unwrap ( )
514- } )
515- }
516-
517487pub fn graphics_perspective (
518488 graphics_entity : Entity ,
519489 fov : f32 ,
@@ -571,6 +541,108 @@ pub fn graphics_ortho(
571541 } )
572542}
573543
544+ pub fn transform_set_position ( entity : Entity , x : f32 , y : f32 , z : f32 ) -> error:: Result < ( ) > {
545+ app_mut ( |app| {
546+ app. world_mut ( )
547+ . run_system_cached_with ( transform:: set_position, ( entity, x, y, z) )
548+ . unwrap ( )
549+ } )
550+ }
551+
552+ pub fn transform_translate ( entity : Entity , x : f32 , y : f32 , z : f32 ) -> error:: Result < ( ) > {
553+ app_mut ( |app| {
554+ app. world_mut ( )
555+ . run_system_cached_with ( transform:: translate, ( entity, x, y, z) )
556+ . unwrap ( )
557+ } )
558+ }
559+
560+ pub fn transform_set_rotation ( entity : Entity , x : f32 , y : f32 , z : f32 ) -> error:: Result < ( ) > {
561+ app_mut ( |app| {
562+ app. world_mut ( )
563+ . run_system_cached_with ( transform:: set_rotation, ( entity, x, y, z) )
564+ . unwrap ( )
565+ } )
566+ }
567+
568+ pub fn transform_rotate_x ( entity : Entity , angle : f32 ) -> error:: Result < ( ) > {
569+ app_mut ( |app| {
570+ app. world_mut ( )
571+ . run_system_cached_with ( transform:: rotate_x, ( entity, angle) )
572+ . unwrap ( )
573+ } )
574+ }
575+
576+ pub fn transform_rotate_y ( entity : Entity , angle : f32 ) -> error:: Result < ( ) > {
577+ app_mut ( |app| {
578+ app. world_mut ( )
579+ . run_system_cached_with ( transform:: rotate_y, ( entity, angle) )
580+ . unwrap ( )
581+ } )
582+ }
583+
584+ pub fn transform_rotate_z ( entity : Entity , angle : f32 ) -> error:: Result < ( ) > {
585+ app_mut ( |app| {
586+ app. world_mut ( )
587+ . run_system_cached_with ( transform:: rotate_z, ( entity, angle) )
588+ . unwrap ( )
589+ } )
590+ }
591+
592+ pub fn transform_rotate_axis (
593+ entity : Entity ,
594+ angle : f32 ,
595+ axis_x : f32 ,
596+ axis_y : f32 ,
597+ axis_z : f32 ,
598+ ) -> error:: Result < ( ) > {
599+ app_mut ( |app| {
600+ app. world_mut ( )
601+ . run_system_cached_with (
602+ transform:: rotate_axis,
603+ ( entity, angle, axis_x, axis_y, axis_z) ,
604+ )
605+ . unwrap ( )
606+ } )
607+ }
608+
609+ pub fn transform_set_scale ( entity : Entity , x : f32 , y : f32 , z : f32 ) -> error:: Result < ( ) > {
610+ app_mut ( |app| {
611+ app. world_mut ( )
612+ . run_system_cached_with ( transform:: set_scale, ( entity, x, y, z) )
613+ . unwrap ( )
614+ } )
615+ }
616+
617+ pub fn transform_scale ( entity : Entity , x : f32 , y : f32 , z : f32 ) -> error:: Result < ( ) > {
618+ app_mut ( |app| {
619+ app. world_mut ( )
620+ . run_system_cached_with ( transform:: scale, ( entity, x, y, z) )
621+ . unwrap ( )
622+ } )
623+ }
624+
625+ pub fn transform_look_at (
626+ entity : Entity ,
627+ target_x : f32 ,
628+ target_y : f32 ,
629+ target_z : f32 ,
630+ ) -> error:: Result < ( ) > {
631+ app_mut ( |app| {
632+ app. world_mut ( )
633+ . run_system_cached_with ( transform:: look_at, ( entity, target_x, target_y, target_z) )
634+ . unwrap ( )
635+ } )
636+ }
637+
638+ pub fn transform_reset ( entity : Entity ) -> error:: Result < ( ) > {
639+ app_mut ( |app| {
640+ app. world_mut ( )
641+ . run_system_cached_with ( transform:: reset, entity)
642+ . unwrap ( )
643+ } )
644+ }
645+
574646/// Create a new image with given size and data.
575647pub fn image_create (
576648 size : Extent3d ,
0 commit comments