⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shili43.m

📁 1-32是:图形应用篇 33-66是:界面设计篇 67-84是:图形处理篇 85-100是:数值分析篇
💻 M
字号:
h0=figure('toolbar','none',...
    'position',[198 56 450 468],...
    'name','实例43');
h1=axes('parent',h0,...
    'position',[0.15 0.45 0.7 0.5],...
    'visible','off');
sphere
h=findobj('type','surface');
shading interp
axis equal
l=light('position',[0 -2 1]);
k(1)=get(h,'specularstrength');
k(2)=get(h,'diffusestrength');
k(3)=get(h,'specularexponent');
k(4)=get(h,'specularcolorreflectance');
u1=uimenu('parent',h0,...
    'label','灯光效果',...
    'tag','u1',...
    'backgroundcolor',[0.75 0.75 0.75]);
u11=uimenu('parent',u1,...
    'label','gouraud',...
    'tag','u11',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'callback',[...
        'set(u11,''checked'',''on'');,',...
        'set(u12,''checked'',''off'');,',...
        'set(h,''facelighting'',''gouraud'')']);
u12=uimenu('parent',u1,...
    'label','phong',...
    'tag','u12',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'callback',[...
        'set(u11,''checked'',''off'');,',...
        'set(u12,''checked'',''on'');,',...
        'set(h,''facelighting'',''gouraud'')']);
u2=uimenu('parent',h0,...
    'label','背面灯光',...
    'tag','u2',...
    'backgroundcolor',[0.75 0.75 0.75]);
u21=uimenu('parent',u2,...
    'label','reverselit',...
    'tag','u21',...
    'checked','on',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'callback',[...
        'set(u21,''checked'',''on'');,',...
        'set(u22,''checked'',''off'');,',...
        'set(h,''backfacelighting'',''reverselit'')']);
u22=uimenu('parent',u2,...
    'label','reverselit',...
    'tag','u22',...
    'backgroundcolor',[0.75 0.75 0.75],...
    'callback',[...
        'set(u21,''checked'',''off'');,',...
        'set(u22,''checked'',''on'');,',...
        'set(h,''backfacelighting'',''reverselit'')']);
s1=uicontrol('parent',h0,...
    'units','points',...
    'style','slider',...
    'tag','s1',...
    'min',0,...
    'max',1,...
    'value',k(1),...
    'position',[20 80 100 15],...
    'callback',[...
        's1value=get(s1,''value'');,',...
        'set(h,''specularstrength'',s1value)']);
t1=uicontrol('parent',h0,...
    'units','points',...
    'style','text',...
    'tag','t1',...
    'string','镜面反射强度',...
    'position',[20 97 100 15]);
s2=uicontrol('parent',h0,...
    'units','points',...
    'style','slider',...
    'tag','s2',...
    'min',0,...
    'max',1,...
    'value',k(2),...
    'position',[20 30 100 15],...
    'callback',[...
        's2value=get(s2,''value'');,',...
        'set(h,''diffusestrength'',s2value)']);
t2=uicontrol('parent',h0,...
    'units','points',...
    'style','text',...
    'tag','t2',...
    'string','漫反射强度',...
    'position',[20 47 100 15]);
s3=uicontrol('parent',h0,...
    'units','points',...
    'style','slider',...
    'tag','s3',...
    'min',0.1,...
    'max',1,...
    'value',k(3)/20,...
    'position',[220 80 100 15],...
    'callback',[...
        's3value=get(s3,''value'')+eps;,',...
        'set(h,''specularexponent'',20*s3value)']);
t3=uicontrol('parent',h0,...
    'units','points',...
    'style','text',...
    'tag','t3',...
    'string','镜面指数',...
    'position',[220 97 100 15]);
s4=uicontrol('parent',h0,...
    'units','points',...
    'style','slider',...
    'tag','s4',...
    'min',0,...
    'max',1,...
    'value',k(4),...
    'position',[220 30 100 15],...
    'callback',[...
        's4value=get(s4,''value'');,',...
        'set(h,''specularcolorreflectance'',s4value)']);
t4=uicontrol('parent',h0,...
    'units','points',...
    'style','text',...
    'tag','t1',...
    'string','镜面颜色反射比',...
    'position',[220 47 100 15]);
b1=uicontrol('parent',h0,...
    'units','points',...
    'style','pushbutton',...
    'tag','b1',...
    'string','关闭',...
    'position',[145 45 50 30],...
    'callback','close');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -