Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtschump committed Sep 10, 2023
1 parent 00071ed commit e8b9c0f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/gmic_stdlib.gmic
Original file line number Diff line number Diff line change
Expand Up @@ -1822,7 +1822,7 @@ d :
#@cli : - '_display_3d_is_axes' can be { 0:off | 1:on } (default value: '1').
#@cli : - '_display_3d_is_bounding_box' can be { 0:off | 1:on } (default value: '0').
#@cli : - '_display_3d_background' is an unsigned integer in range [0,11] (default value: '11').
#@cli : - '_display_3d_is_animated' can be { 0:off | 1:on } (default value: '0').
#@cli : - '_display_3d_animation' can be { 0:off | 1:forward | 2:backward } (default value: '0').
#@cli : - '_display_3d_animation_mode' can be { 0-3:X-axis | 4-7:Y-axis | 8-11:Z-axis | 12-15:XYZ-axes } \
# (default value: '4').
display :
Expand Down Expand Up @@ -1863,7 +1863,7 @@ _display : skip ${1=},${3=}
setting_3d_is_axes:=narg($_display_3d_is_axes)?cut(int(0$_display_3d_is_axes),0,1):1
setting_3d_is_bounding_box:=narg($_display_3d_is_bounding_box)?cut(int(0$_display_3d_is_bounding_box),0,1):0
setting_3d_background:=narg($_display_3d_background)?cut(int(0$_display_3d_background),0,12):11
setting_3d_is_animated:=narg($_display_3d_is_animated)?cut(int(0$_display_3d_is_animated),0,1):0
setting_3d_animation:=narg($_display_3d_animation)?cut(int(0$_display_3d_animation),0,1):0
setting_3d_animation_mode:=narg($_display_3d_animation_mode)?cut(int(0$_display_3d_animation_mode),0,15):4

thumb_height_factor=0.15
Expand Down Expand Up @@ -3395,8 +3395,8 @@ _display : skip ${1=},${3=}
notification="3D background: \#"$setting_3d_background
$0_rmn canvas_3d_background,area_3d_view,canvas_label_notification
elif {*,-J} # J: Toggle 3D animation
setting_3d_is_animated:=!$setting_3d_is_animated
notification="3D animation: "${"arg0 "$setting_3d_is_animated,Off,On}
setting_3d_animation:=($setting_3d_animation+1)%3
notification="3D animation: "${"arg0 "$setting_3d_animation,Off,Forward,Backward}
$0_rmn canvas_label_notification
elif {*,-U} # U: Switch 3D animation mode
setting_3d_animation_mode:=($setting_3d_animation_mode+1)%16
Expand Down Expand Up @@ -3457,14 +3457,15 @@ _display : skip ${1=},${3=}
$0_rmn area_3d_view
fi

if $setting_3d_is_animated
if $setting_3d_animation
eval "
const s = $setting_3d_animation_mode;
step = arg0(s%4,1,2,4,8)°;
M = s<4?rot(1,0,0,step):
s<8?rot(0,1,0,step):
s<12?rot(0,0,1,step):(
A = lerp([1,0,0],[0,1,0],cos($|));
const one = $setting_3d_animation==1?1:-1;
M = s<4?rot(one,0,0,step):
s<8?rot(0,one,0,step):
s<12?rot(0,0,one,step):(
A = lerp([one,0,0],[0,one,0],cos($|));
rot(A[0],A[1],A[2],step)
);
R = mul(M,crop(#$view_3d_pose,0,0,3,3),3);
Expand Down

0 comments on commit e8b9c0f

Please sign in to comment.