Krpano 1.19支持WebVR / MobileVR,MAKE VTOUR生成器内置对VR的支持。配合VR设备使用,可以实现VR效果。默认Web VR主界面和Customize界面为英文,需要汉化。
krpano使用简单的xml文本文件来存储相关的设置等,包括提示信息和界面文字。汉化,其实是把英文提示信息和界面文字替翻译替换成中文。
步骤:
下面以krpano-1.19-pr8为例:
- 找到全景项目文件夹vtour\plugins的webvr.xml(或者直接把krpano-1.19-pr8文件夹下\templates\xml\plugins的webvr.xml,这样以后生成的webvr.xml都是已经汉化过的)
- 编辑工具(例如sublime)打开webvr.xml。
- 将英文对应替换成中文。以下是中英文对比:
英文 | 中文 |
---|---|
No Distortion | 无扭曲 |
[i][u]Simulated WebVR Mode![/u][/i][br]For real WebVR with headset tracking, either use a [a href="http://webvr.info" target="_blank" style="color:#FFFFFF;"]WebVR-API-capable[/a] desktop browser or a mobile device and a VR headset. | [i][u]模拟WebVR模式![/u][/i][br]需要体验头显设备跟踪的真正的WebVR,请使用支持[a href="http://webvr.info" target="_blank" style="color:#FFFFFF;"]WebVR-API[/a]的桌面浏览器或手机和VR头显设备。 |
Enter VR | 进入VR模式 |
Exit VR | 退出VR模式 |
VR Setup | VR模式设置 |
inch | 英寸 |
mm | 毫米 |
Custom | 自定义 |
MOBILE VR SETUP | VR设置 |
Device | 设备 |
Screensize | 屏幕尺寸 |
IPD | 瞳距 |
VR Headset | VR头显或VR头戴设备 |
Customize | 自定义设置 |
Calibrate Gyroscope | 陀螺仪校准 |
SAVE | 保存 |
RESET | 恢复默认值 |
CLOSE | 关闭 |
VR HEADSET | VR头显设备 |
FOV | 垂直视域 |
Distortion | 扭曲参数 |
Dist2 | 附加扭曲参数 |
CA Corr | 色差校正 |
Vignette | 镜头晕影 |
Overlap | 视野重叠 |
GYROSCOPE | 陀螺仪 |
Place the device on a flat and[br]stable surface and tab calibrate[br]to correct a gyroscope drifting. | 将设备放置在[br]水平面上,点击校准[br]修正陀螺仪偏移. |
CALIBRATE | 校准 |
Calibrating... | 校准中... |
Calibration okay. | 校准完成. |
Calibration failed! | 校准失败! |
if(webvr.isenabled,
if(%1 != null, set(vr_aclk_timeout, %1), set(vr_aclk_timeout, 2000));
copy(vr_aclk_t1, timertick);
set(vr_aclk_waiting, true);
copy(vr_aclk_hotspot, name);
set(hotspot[vr_cursor].crop,'0|0|80|80');
asyncloop(vr_aclk_waiting AND vr_aclk_hotspot == name,
sub(dt, timertick,vr_aclk_t1);
if(!hovering,
set(vr_aclk_waiting, false);
set(hotspot[vr_cursor].crop,'0|0|80|80');
,
div(f, dt, vr_aclk_timeout);
mul(f, 16);
roundval(f);
Math.min(f, 16);
mul(f, 80);
txtadd(hotspot[vr_cursor].crop,get(f),'|0|80|80');
sub(dt, 100);
if(dt GT vr_aclk_timeout,
set(vr_aclk_waiting,false);
set(hotspot[vr_cursor].crop,'0|0|80|80');
onclick();
);
);
);
);
webvr.loadsettings();
delayedcall(0.5, tween(layer[webvr_enterbutton].alpha,1.0); );
if(webvr.isfake AND device.desktop AND webvr.havesettings == false,
set(webvr.mobilevr_lens_overlap, 1.0);
set(webvr.mobilevr_lens_fov, 96.0);
set(webvr.mobilevr_lens_dist, 0.0);
set(webvr.mobilevr_lens_dist2, '1|0|0|0');
set(webvr.mobilevr_lens_ca, 0.0);
set(webvr.mobilevr_lens_vign, 100);
,
set(ask_user_for_screensize,true);
);
tween(layer[webvr_enterbutton].alpha,0,0);
webvr_showbuttons();
webvr_hide_all_non_vr_layers();
if(webvr.ismobilevr == true AND !webvr.isfake AND ask_user_for_screensize == true AND webvr.mobilevr_screensize == 'auto',
set(ask_user_for_screensize, false);
vr_setup();
);
if(webvr.isfake,
webvr_show_fakemode_info(true);
);
stopdelayedcall(vr_button_fadeout);
tween(layer[webvr_enterbutton].alpha,1);
tween(layer[webvr_exitbutton].alpha,0);
tween(layer[webvr_setupbutton].alpha,0);
webvr_show_fakemode_info(false);
webvr_restore_layers();
for(set(i,0), i LT layer.count, inc(i),
copy(lr, layer[get(i)]);
if(lr.vr !== true,
copy(lr.vr_backup_visible, lr.visible);
set(lr.visible, false);
);
);
for(set(i,0), i LT layer.count, inc(i),
copy(lr, layer[get(i)]);
if(lr.vr_backup_visible,
copy(lr.visible, lr.vr_backup_visible);
delete(lr.vr_backup_visible);
);
);
if('%1' == 'true',
addlayer(webvr_fakemode_info);
set(layer[webvr_fakemode_info].url, '%SWFPATH%/plugins/textfield.swf');
set(layer[webvr_fakemode_info].keep, true);
set(layer[webvr_fakemode_info].align, 'bottom');
set(layer[webvr_fakemode_info].y, 80);
set(layer[webvr_fakemode_info].background, false);
set(layer[webvr_fakemode_info].css, 'color:#FFFFFF;text-align:center;');
set(layer[webvr_fakemode_info].html, '[i][u]模拟WebVR模式![/u][/i][br]需要体验头显设备跟踪的真正的WebVR,请使用支持[a href="http://webvr.info" target="_blank" style="color:#FFFFFF;"]WebVR-API[/a]的桌面浏览器或手机和VR头显设备。');
,
removelayer(webvr_fakemode_info);
);
stopdelayedcall(vr_button_fadeout);
if(webvr.ismobilevr,
tween(layer[webvr_exitbutton].alpha|layer[webvr_setupbutton].alpha, 1.0|1.0, 0.25);
delayedcall(vr_button_fadeout, 3.0, tween(layer[webvr_exitbutton].alpha|layer[webvr_setupbutton].alpha, 0.0|0.0, 1.0); );
,
tween(layer[webvr_exitbutton].alpha, 1.0, 0.25);
delayedcall(vr_button_fadeout, 3.0, tween(layer[webvr_exitbutton].alpha, 0.0, 1.0); );
);
set(webvr.vr_cursor_enabled, false);
tween(layer[webvr_exitbutton].alpha,0);
tween(layer[webvr_setupbutton].alpha,0);
addlayer(vr_setup_bg);
set(layer[vr_setup_bg].type, container);
set(layer[vr_setup_bg].bgcolor, 0x000000);
set(layer[vr_setup_bg].bgalpha, 0.5);
set(layer[vr_setup_bg].bgcapture, true);
set(layer[vr_setup_bg].handcursor, false);
set(layer[vr_setup_bg].align, lefttop);
set(layer[vr_setup_bg].width, 100%);
set(layer[vr_setup_bg].height, 100%);
set(layer[vr_setup_bg].zorder, 99999);
copy(i_screensize, webvr.mobilevr_screensize);
if(i_screensize == 'auto', copy(i_screensize, webvr.devicesize));
if(i_screensize LE 0, set(i_screensize, 5.0));
roundval(i_screensize, 1);
txtadd(i_screensize, ' 英寸');
copy(i_ipd, webvr.mobilevr_ipd);
roundval(i_ipd, 1);
txtadd(i_ipd, ' 毫米');
copy(i_fov, webvr.mobilevr_lens_fov);
roundval(i_fov, 1);
copy(i_dist, webvr.mobilevr_lens_dist);
roundval(i_dist, 2);
copy(i_dist2, webvr.mobilevr_lens_dist2);
txtsplit(i_dist2, '|', i_dist2_k1, i_dist2_k2, i_dist2_k3, i_dist2_k4);
mul(i_dist2_k1,1);
mul(i_dist2_k2,10);
mul(i_dist2_k3,10);
mul(i_dist2_k4,10);
roundval(i_dist2_k1,2);
roundval(i_dist2_k2,2);
roundval(i_dist2_k3,2);
roundval(i_dist2_k4,2);
copy(i_vig, webvr.mobilevr_lens_vign);
roundval(i_vig, 0);
copy(i_overlap, webvr.mobilevr_lens_overlap);
roundval(i_overlap, 2);
copy(i_ca, webvr.mobilevr_lens_ca);
roundval(i_ca, 3);
set(i_headset, '自定义');
for(set(i,0), i LT vrheadsets.headset.count, inc(i),
copy(hs, vrheadsets.headset[get(i)]);
if(i_overlap == hs.overlap AND i_fov == hs.fov AND i_dist == hs.dist AND i_dist2 == hs.dist2 AND i_ca == hs.ca AND i_vig == hs.vig , copy(i_headset, hs.caption));
);
set(known_size, true);
set(sizcol, #FFFFFF);
copy(i_devicename, webvr.devicename);
if(i_devicename == 'Unknown',
if(webvr.mobilevr_screensize == 'auto',
set(sizcol, #AA0000);
set(known_size, false);
,
set(i_devicename, '自定义');
);
);
addlayer(vr_setup_m1);
set(layer[vr_setup_m1].type, container);
set(layer[vr_setup_m1].parent, vr_setup_bg);
set(layer[vr_setup_m1].align, lefttop);
set(layer[vr_setup_m1].width, 100%);
set(layer[vr_setup_m1].height, 100%);
addlayer(vr_setup_m3);
set(layer[vr_setup_m3].type, container);
set(layer[vr_setup_m3].parent, vr_setup_bg);
set(layer[vr_setup_m3].align, lefttop);
set(layer[vr_setup_m3].width, 100%);
set(layer[vr_setup_m3].height, 100%);
set(layer[vr_setup_m3].visible, false);
addlayer(vr_setup_m2);
set(layer[vr_setup_m2].type, container);
set(layer[vr_setup_m2].parent, vr_setup_bg);
set(layer[vr_setup_m2].align, lefttop);
set(layer[vr_setup_m2].width, 100%);
set(layer[vr_setup_m2].height, 100%);
set(layer[vr_setup_m2].visible, false);
set(vr_setup_text_parent, 'vr_setup_m1');
vr_setup_createtext(vr_setup_title, 'VR设置', center, center, 0, -225, #FFFFFF, false);
vr_setup_createtext(vr_setup_dvn1, '设备:', center, right, 0, -145, #FFFFFF, true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_dvn2, get(i_devicename), center, left, 0, -145, get(sizcol), true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_siz1, '屏幕尺寸:', center, right, 0, -105, #FFFFFF, true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_siz2, get(i_screensize), center, left, 0, -105, get(sizcol), true, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_ipd1, '瞳距:', center, right, 0, -35, #FFFFFF, true, vr_setup_select('ipd') );
vr_setup_createtext(vr_setup_ipd2, get(i_ipd), center, left, 0, -35, #FFFFFF, true, vr_setup_select('ipd') );
vr_setup_createtext(vr_setup_hmd1, 'VR头显:', center, right, 0, +35, #FFFFFF, true, vr_setup_select('headset') );
vr_setup_createtext(vr_setup_hmd2, get(i_headset), center, left, 0, +35, #FFFFFF, true, vr_setup_select('headset') );
vr_setup_createtext(vr_setup_hmd3, '自定义设置', center, center, 0, +75, #FFFFFF, true, set(background,true), set(background,false), vr_setup_customize_headset() );
if(webvr.iswebvr == false,
vr_setup_createtext(vr_setup_cal, '陀螺仪校准', center, center, 0, +145, #FFFFFF, true, set(background,true), set(background,false), vr_setup_calibration() );
);
vr_setup_createtext(vr_setup_sav, '保存', center, center, -200, +225, #FFFFFF, true, set(background,true), set(background,false), vr_setup_save() );
vr_setup_createtext(vr_setup_rst, '恢复默认值', center, center, 0, +225, #FFFFFF, true, set(background,true), set(background,false), vr_setup_reset() );
vr_setup_createtext(vr_setup_cls, '关闭', center, center, +200, +225, #FFFFFF, true, set(background,true), set(background,false), vr_setup_close() );
vr_setup_createbutton(vr_setup_btn1, '<', left, left, 5%, -35, #FFFFFF, true, null);
vr_setup_createbutton(vr_setup_btn2, '>', right, right, 5%, -35, #FFFFFF, true, null);
set(vr_setup_text_parent, 'vr_setup_m3');
vr_setup_createtext(vr_setup_m31, 'VR头显设备', center, center, 0, -225, #FFFFFF, false);
vr_setup_createtext(vr_setup_fov1, '垂直视域:', center, right, 0, -80, #FFFFFF, true, vr_setup_select('fov') );
vr_setup_createtext(vr_setup_fov2, get(i_fov), center, left, 0, -80, #FFFFFF, true, vr_setup_select('fov') );
vr_setup_createtext(vr_setup_dst1, '扭曲参数:', center, right, 0, -32, #FFFFFF, true, vr_setup_select('dist') );
vr_setup_createtext(vr_setup_dst2, get(i_dist), center, left, 0, -32, #FFFFFF, true, vr_setup_select('dist') );
vr_setup_createtext(vr_setup_d2tx, '附加扭曲参数:', center, right, 0, +16, #FFFFFF, true, vr_setup_select('dist2k1') );
vr_setup_createtext(vr_setup_d2k1, get(i_dist2_k1), center, left, 0, +16, #FFFFFF, true, vr_setup_select('dist2k1') );
vr_setup_createtext(vr_setup_d2k2, get(i_dist2_k2), center, left, +100, +16, #FFFFFF, true, vr_setup_select('dist2k2') );
vr_setup_createtext(vr_setup_d2k3, get(i_dist2_k3), center, left, +200, +16, #FFFFFF, true, vr_setup_select('dist2k3') );
vr_setup_createtext(vr_setup_d2k4, get(i_dist2_k4), center, left, +300, +16, #FFFFFF, true, vr_setup_select('dist2k4') );
vr_setup_createtext(vr_setup_cac1, '色差校正:', center, right, 0, +64, #FFFFFF, true, vr_setup_select('ca') );
vr_setup_createtext(vr_setup_cac2, get(i_ca), center, left, 0, +64, #FFFFFF, true, vr_setup_select('ca') );
vr_setup_createtext(vr_setup_vig1, '镜头晕影:', center, right, 0, +112, #FFFFFF, true, vr_setup_select('vignette') );
vr_setup_createtext(vr_setup_vig2, get(i_vig), center, left, 0, +112, #FFFFFF, true, vr_setup_select('vignette') );
vr_setup_createtext(vr_setup_olp1, '视野重叠:', center, right, 0, +160, #FFFFFF, true, vr_setup_select('overlap') );
vr_setup_createtext(vr_setup_olp2, get(i_overlap), center, left, 0, +160, #FFFFFF, true, vr_setup_select('overlap') );
vr_setup_createtext(vr_setup_m35, '关闭', center, center, 0, +225, #FFFFFF, true, set(background,true), set(background,false), vr_setup_close_sub_menus() );
set(vr_setup_text_parent, 'vr_setup_m2');
vr_setup_createtext(vr_setup_cb1, '陀螺仪', center, center, 0, -225, #FFFFFF, false);
vr_setup_createtext(vr_setup_cb2, '将设备放置在[br]水平面上,点击校准[br]修正陀螺仪偏移.', center, center, 0, -95, #FFFFFF, false, vr_setup_select('screen') );
vr_setup_createtext(vr_setup_cb3, '校准', center, center, 0, +55, #FFFFFF, true, set(background,true), set(background,false), vr_setup_do_calibration() );
vr_setup_createtext(vr_setup_cb4, '恢复默认值', center, center, 0, +125, #FFFFFF, true, set(background,true), set(background,false), webvr.resetcalibration() );
vr_setup_createtext(vr_setup_cb5, '关闭', center, center, 0, +225, #FFFFFF, true, set(background,true), set(background,false), vr_setup_close_sub_menus() );
vr_setup_createtext(vr_setup_cb6, '校准中...', bottom, center, 0, 40, #FFFFFF, false, null );
vr_setup_createtext(vr_setup_cb7, '校准完成.', bottom, center, 0, 40, #FFFFFF, false, null );
vr_setup_createtext(vr_setup_cb8, '校准失败!', bottom, center, 0, 40, #FFFFFF, false, null );
set(layer[vr_setup_cb6].autoalpha, true);
set(layer[vr_setup_cb7].autoalpha, true);
set(layer[vr_setup_cb8].autoalpha, true);
set(layer[vr_setup_cb6].alpha, 0.0);
set(layer[vr_setup_cb7].alpha, 0.0);
set(layer[vr_setup_cb8].alpha, 0.0);
if(known_size == false,
vr_setup_select('screen', true);
,
vr_setup_select('ipd', true);
);
addlayer(%1);
set(layer[%1].parent, get(vr_setup_text_parent));
set(layer[%1].url, '%SWFPATH%/plugins/textfield.swf');
set(layer[%1].css, calc('text-align:%3;color:%7;font-size:'+40*webvr_setup_scale+'px;font-weight:bold;'));
set(layer[%1].padding, calc(0 + ' ' + 8*webvr_setup_scale));
set(layer[%1].roundedge, calc(8*webvr_setup_scale));
set(layer[%1].background, false);
set(layer[%1].backgroundcolor, 0xFFFFFF);
set(layer[%1].backgroundalpha, 0.25);
set(layer[%1].align, %3);
set(layer[%1].edge, %4);
set(layer[%1].x, calc(%5 * webvr_setup_scale));
set(layer[%1].y, calc(%6 * webvr_setup_scale));
set(layer[%1].html, %2);
set(layer[%1].enabled, %8);
set(layer[%1].ondown, %9);
set(layer[%1].onup, %10);
set(layer[%1].onclick, %11);
vr_setup_createtext(%1,%2,%3,%4,%5,%6,%7,%8,%9);
set(layer[%1].css, calc('vertical-align:middle;text-align:center;color:%7;font-size:'+60*webvr_setup_scale+'px;font-weight:bold;'));
set(layer[%1].background, true);
set(layer[%1].padding, 0);
set(layer[%1].roundedge, calc(40 * webvr_setup_scale));
set(layer[%1].width, calc(70 * webvr_setup_scale));
set(layer[%1].height, calc(70 * webvr_setup_scale));
set(layer[%1].vcenter, true);
set(webvr.mobilevr_screensize, 'auto');
copy(i_screensize, webvr.devicesize);
if(i_screensize LE 0, set(i_screensize, 5.0); );
roundval(i_screensize, 1);
set(layer[vr_setup_dvn2].html, get(webvr.devicename));
txtadd(layer[vr_setup_siz2].html, get(i_screensize), ' 英寸');
set(webvr.mobilevr_ipd, 63.5);
copy(i_ipd, webvr.mobilevr_ipd);
roundval(i_ipd, 1);
txtadd(layer[vr_setup_ipd2].html, get(i_ipd), ' 毫米');
set(webvr.mobilevr_lens_fov, 100);
set(webvr.mobilevr_lens_dist, 0.5);
set(webvr.mobilevr_lens_dist2, '1|0|0|0');
set(webvr.mobilevr_lens_vign, 100);
set(webvr.mobilevr_lens_overlap, 1.0);
set(webvr.mobilevr_lens_ca, 0.0);
if(webvr.isfake AND device.desktop,
vr_setup_change_headset(-1);
,
vr_setup_change_headset(+1);
);
vr_setup_select(get(selected_var));
removelayer(vr_setup_bg, true);
set(webvr.vr_cursor_enabled, true);
webvr.saveSettings();
vr_setup_close();
set(layer[vr_setup_bg].bgalpha, 0.1);
set(layer[vr_setup_m1].visible,false);
set(layer[vr_setup_m2].visible,false);
set(layer[vr_setup_m3].visible,true);
set(layer[vr_setup_hmd1].parent, vr_setup_m3);
set(layer[vr_setup_hmd2].parent, vr_setup_m3);
set(layer[vr_setup_btn1].parent, vr_setup_m3);
set(layer[vr_setup_btn2].parent, vr_setup_m3);
set(layer[vr_setup_hmd1].y, calc(-145 * webvr_setup_scale));
set(layer[vr_setup_hmd2].y, calc(-145 * webvr_setup_scale));
copy(old_selection, selected_var);
vr_setup_select('headset');
set(layer[vr_setup_m1].visible,false);
set(layer[vr_setup_m2].visible,true);
set(layer[vr_setup_bg].bgalpha, 0.5);
set(layer[vr_setup_m1].visible,true);
set(layer[vr_setup_m2].visible,false);
set(layer[vr_setup_m3].visible,false);
set(layer[vr_setup_hmd1].parent, vr_setup_m1);
set(layer[vr_setup_hmd2].parent, vr_setup_m1);
set(layer[vr_setup_btn1].parent, vr_setup_m1);
set(layer[vr_setup_btn2].parent, vr_setup_m1);
set(layer[vr_setup_hmd1].y, calc(+35 * webvr_setup_scale));
set(layer[vr_setup_hmd2].y, calc(+35 * webvr_setup_scale));
if(old_selection,
vr_setup_select(get(old_selection));
delete(old_selection);
);
if(!webvr.isfake,
tween(layer[vr_setup_cb6].alpha, 1.0, 0.1);
tween(layer[vr_setup_cb7].alpha, 0.0, 0.1);
tween(layer[vr_setup_cb8].alpha, 0.0, 0.1);
webvr.calibrate(
tween(layer[vr_setup_cb6].alpha, 0.0, 0.1);
tween(layer[vr_setup_cb7].alpha, 1.0, 0.1);
delayedcall(2.0, tween(layer[vr_setup_cb7].alpha, 0.0, 0.25) );
,
tween(layer[vr_setup_cb6].alpha, 0.0, 0.1);
tween(layer[vr_setup_cb8].alpha, 1.0, 0.1);
delayedcall(2.0, tween(layer[vr_setup_cb8].alpha, 0.0, 0.25) );
);
);
txtadd(webvr.mobilevr_lens_dist2, get(i_dist2_k1), '|', calc(i_dist2_k2/10.0), '|', calc(i_dist2_k3/10.0), '|', calc(i_dist2_k4/10.0));
vr_setup_change_headset(0);
set(layer[vr_setup_siz2].background, false);
set(layer[vr_setup_ipd2].background, false);
set(layer[vr_setup_hmd2].background, false);
set(layer[vr_setup_fov2].background, false);
set(layer[vr_setup_dst2].background, false);
set(layer[vr_setup_d2k1].background, false);
set(layer[vr_setup_d2k2].background, false);
set(layer[vr_setup_d2k3].background, false);
set(layer[vr_setup_d2k4].background, false);
set(layer[vr_setup_vig2].background, false);
set(layer[vr_setup_cac2].background, false);
set(layer[vr_setup_olp2].background, false);
set(selected_setting, null);
delete(selected_var_value);
set(layer[vr_setup_btn1].ondown, vr_setup_change_ondown(-1) );
set(layer[vr_setup_btn2].ondown, vr_setup_change_ondown(+1) );
set(selected_var_callback, null);
set(selected_var, %1);
if(selected_var == 'screen',
set(selected_setting, vr_setup_siz2);
set(selected_var_name, 'webvr.mobilevr_screensize');
set(selected_var_postfix, ' 英寸');
copy(selected_var_value, get(selected_var_name));
if(selected_var_value == 'auto', copy(selected_var_value, webvr.devicesize));
if(selected_var_value LE 0, set(selected_var_value, 5.0));
set(selected_var_step, 0.1);
set(selected_var_min, 4);
set(selected_var_max, 10);
set(selected_var_round, 1);
set(selected_var_callback, vr_setup_change_screen() );
);
if(selected_var == 'ipd',
set(selected_setting, vr_setup_ipd2);
set(selected_var_name, 'webvr.mobilevr_ipd');
set(selected_var_postfix, ' 毫米');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.1);
set(selected_var_min, 40);
set(selected_var_max, 80);
set(selected_var_round, 1);
);
if(selected_var == 'headset',
set(selected_setting, vr_setup_hmd2);
set(layer[vr_setup_btn1].ondown, vr_setup_change_headset(-1) );
set(layer[vr_setup_btn2].ondown, vr_setup_change_headset(+1) );
);
if(selected_var == 'fov',
set(selected_setting, vr_setup_fov2);
set(selected_var_name, 'webvr.mobilevr_lens_fov');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.1);
set(selected_var_min, 40);
set(selected_var_max, 179);
set(selected_var_round, 1);
set(selected_var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'dist',
set(selected_setting, vr_setup_dst2);
set(selected_var_name, 'webvr.mobilevr_lens_dist');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, 0);
set(selected_var_max, 5);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'dist2k1',
set(selected_setting, vr_setup_d2k1);
set(selected_var_name, 'i_dist2_k1');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, -9);
set(selected_var_max, +9);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'dist2k2',
set(selected_setting, vr_setup_d2k2);
set(selected_var_name, 'i_dist2_k2');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, -9);
set(selected_var_max, +9);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'dist2k3',
set(selected_setting, vr_setup_d2k3);
set(selected_var_name, 'i_dist2_k3');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, -9);
set(selected_var_max, +9);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'dist2k4',
set(selected_setting, vr_setup_d2k4);
set(selected_var_name, 'i_dist2_k4');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, -9);
set(selected_var_max, +9);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_update_dist2() );
);
if(selected_var == 'vignette',
set(selected_setting, vr_setup_vig2);
set(selected_var_name, 'webvr.mobilevr_lens_vign');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 1);
set(selected_var_min, 10);
set(selected_var_max, 200);
set(selected_var_round, 0);
set(selected_var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'ca',
set(selected_setting, vr_setup_cac2);
set(selected_var_name, 'webvr.mobilevr_lens_ca');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, -1.0);
set(selected_var_max, +1.0);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_change_headset(0) );
);
if(selected_var == 'overlap',
set(selected_setting, vr_setup_olp2);
set(selected_var_name, 'webvr.mobilevr_lens_overlap');
set(selected_var_postfix, '');
copy(selected_var_value, get(selected_var_name));
set(selected_var_step, 0.01);
set(selected_var_min, 0.5);
set(selected_var_max, 2.0);
set(selected_var_round, 2);
set(selected_var_callback, vr_setup_change_headset(0) );
);
if(selected_setting != null,
set(layer[get(selected_setting)].background, true);
if(%2 == true,
set(layer[vr_setup_btn1].y, get(layer[get(selected_setting)].y));
set(layer[vr_setup_btn2].y, get(layer[get(selected_setting)].y));
,
tween(layer[vr_setup_btn1].y, get(layer[get(selected_setting)].y));
tween(layer[vr_setup_btn2].y, get(layer[get(selected_setting)].y));
);
);
set(layer[vr_setup_dvn2].html, '自定义');
set(layer[vr_setup_dvn2].css, calc('color:#FFFFFF;font-size:'+40*webvr_setup_scale+'px;font-weight:bold;'));
set(layer[vr_setup_siz2].css, calc('color:#FFFFFF;font-size:'+40*webvr_setup_scale+'px;font-weight:bold;'));
copy(t0,timertick);
set(t1,0);
asyncloop(pressed,
copy(t2,timertick);
sub(dt,t2,t1);
if(dt GT 100,
copy(t1,t2);
sub(dt,t1,t0);
div(dt,1000);
Math.max(dt,1);
mul(dt,%1);
vr_setup_adjust(get(dt));
);
);
if(selected_setting != null,
mul(change, selected_var_step, %1);
add(selected_var_value, change);
Math.max(selected_var_value, selected_var_min);
Math.min(selected_var_value, selected_var_max);
roundval(selected_var_value, get(selected_var_round));
tween(get(selected_var_name), get(selected_var_value), 0.1);
txtadd(layer[get(selected_setting)].html, get(selected_var_value), get(selected_var_postfix));
if(selected_var_callback != null, selected_var_callback());
);
set(i_headset, '自定义');
if(%1 != 0,
copy(i_fov, webvr.mobilevr_lens_fov);
roundval(i_fov, 1);
copy(i_dist, webvr.mobilevr_lens_dist);
roundval(i_dist, 2);
copy(i_dist2, webvr.mobilevr_lens_dist2);
copy(i_vig, webvr.mobilevr_lens_vign);
roundval(i_vig, 0);
copy(i_ca, webvr.mobilevr_lens_ca);
roundval(i_ca, 3);
copy(i_overlap, webvr.mobilevr_lens_overlap);
roundval(i_overlap, 2);
set(i_hsindex, -1);
copy(i_hscount, vrheadsets.headset.count);
for(set(i,0), i LT i_hscount, inc(i),
copy(hs, vrheadsets.headset[get(i)]);
if(i_overlap == hs.overlap AND i_fov == hs.fov AND i_dist == hs.dist AND i_dist2 == hs.dist2 AND i_ca == hs.ca AND i_vig == hs.vig , copy(i_hsindex, i); copy(i_headset, hs.caption); );
);
if(%1 GT 0,
add(i_hsindex, 1);
if(i_hsindex GE i_hscount, set(i_hsindex,0));
,
sub(i_hsindex, 1);
if(i_hsindex LT 0, sub(i_hsindex,i_hscount,1));
);
copy(hs, vrheadsets.headset[get(i_hsindex)]);
copy(i_headset, hs.caption);
copy(i_overlap, hs.overlap);
copy(i_fov, hs.fov);
copy(i_dist, hs.dist);
copy(i_dist2, hs.dist2);
copy(i_ca, hs.ca);
copy(i_vig, hs.vig);
);
copy(layer[vr_setup_hmd2].html, i_headset);
if(%1 != 0,
copy(webvr.mobilevr_lens_overlap, i_overlap);
copy(webvr.mobilevr_lens_fov, i_fov);
copy(webvr.mobilevr_lens_dist, i_dist);
copy(webvr.mobilevr_lens_dist2, i_dist2);
copy(webvr.mobilevr_lens_ca, i_ca);
copy(webvr.mobilevr_lens_vign, i_vig);
copy(layer[vr_setup_olp2].html, i_overlap);
copy(layer[vr_setup_fov2].html, i_fov);
copy(layer[vr_setup_dst2].html, i_dist);
txtsplit(i_dist2, '|', i_dist2_k1, i_dist2_k2, i_dist2_k3, i_dist2_k4);
mul(i_dist2_k1,1);
mul(i_dist2_k2,10);
mul(i_dist2_k3,10);
mul(i_dist2_k4,10);
roundval(i_dist2_k1,2);
roundval(i_dist2_k2,2);
roundval(i_dist2_k3,2);
roundval(i_dist2_k4,2);
copy(layer[vr_setup_d2k1].html, i_dist2_k1);
copy(layer[vr_setup_d2k2].html, i_dist2_k2);
copy(layer[vr_setup_d2k3].html, i_dist2_k3);
copy(layer[vr_setup_d2k4].html, i_dist2_k4);
copy(layer[vr_setup_cac2].html, i_ca);
copy(layer[vr_setup_vig2].html, i_vig);
);
最终效果: