-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathviewupdate.m
40 lines (33 loc) · 1.14 KB
/
viewupdate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function viewupdate(hObject, view )
% VIEWUPDATE update ShowMotion camera view
% viewupdate(view) stores the given viewing parameters in the data
% structure ShoMoData.view. If there is no animation in progress, then it
% also updates the ShowMotion camera; otherwise it marks the new viewing
% parameters as 'on hold'. If viewupdate is called with no argument, then
% it unconditionally updates the ShowMotion camera with any on-hold viewing
% parameters in ShoMoData.view.
handles = guidata(hObject);
if nargin == 0
view = handles.view;
if view.on_hold
update = 1; % unconditional update
else
return % nothing to do
end
else
update = ~handles.animating; % update only if not animating
end
view.on_hold = ~update;
view.upvec = [0 0 1];
handles.view = view;
guidata(hObject,handles);
if update
set( handles.ax, ...
'CameraPosition', view.campos, ...
'CameraTarget', view.focus, ...
'CameraUpVector', view.upvec, ...
'CameraViewAngle', view.angle * 180/pi );
guidata(hObject,handles);
adjustlighting(hObject);
%adjustball(hObject);
end