webvr.xml文件下载地址,下载后直接放在plugins文件夹下覆盖原文件。或者复制代码后覆盖webvr.xml。
1.19 pr8 webvr文件汉化以及注释
链接:http://pan.baidu.com/s/1hsec8D2 密码:wq22
下载后把文件名改为webvr.xml。
点击代码窗口最右侧按钮,在新窗口打开后复制代码
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
<krpano> <!-- 加载WebVR插件,将插件指定到名为'webvr'的变量便于使用 --> <plugin name="WebVR" devices="html5" keep="true" url="webvr.js" onloaded="copy(webvr, plugin[WebVR]);" mousespeed="0.00125" multireslock="true" fullscreen_mirroring="true" mobilevr_support="true" mobilevr_ipd="63.5" mobilevr_screensize="auto" mobilevr_lens_overlap="1.0" mobilevr_lens_fov="96" mobilevr_lens_dist="0.6" mobilevr_lens_dist2="1|0|0|0" mobilevr_lens_ca="0.0" mobilevr_lens_vign="100" mobilevr_wakelock="true" mobilevr_sensor_mode="3" mobilevr_autocalibration="false" mobilevr_touch_support="true" mobilevr_fake_support="false" vr_cursor="hotspot[vr_cursor]" vr_cursor_enabled="true" vr_cursor_onover="if(handcursor, tween(hotspot[vr_cursor].scale,0.4,0.1); vr_auto_click(get(vr_timeout)); );" vr_cursor_onout="tween(hotspot[vr_cursor].scale,0.3,0.1);" onavailable="webvr_onavailable();" onunavailable="" onunknowndevice="webvr_onunknowndevice();" onentervr="webvr_onentervr();" onexitvr="webvr_onexitvr();" /> <!-- 支持VR头戴设备的自定义xml数据 --> <vrheadsets> <headset name="cb1" caption="Cardboard A" overlap="1.10" fov="96.0" dist="1.00" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="cb2" caption="Cardboard B" overlap="1.00" fov="96.0" dist="0.60" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="gvr" caption="GearVR" overlap="1.00" fov="112.0" dist="0.95" dist2="1|0|0|0" ca="0.090" vig="100" /> <headset name="hom" caption="HOMiDO" overlap="1.00" fov="101.0" dist="1.10" dist2="1|0|0|0" ca="0.075" vig="100" /> <headset name="one" caption="VR ONE" overlap="1.00" fov="109.9" dist="0.00" dist2="1.139|0.093|0.018|0.207" ca="0.090" vig="35" /> <headset name="ccr" caption="ColorCross VR" overlap="1.00" fov="70.0" dist="0.65" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="nod" caption="无扭曲变形" overlap="1.00" fov="96.0" dist="0.00" dist2="1|0|0|0" ca="0.000" vig="100" /> </vrheadsets> <!-- VR光标热点 --> <hotspot name="vr_cursor" keep="true" url="webvr_cursor_80x80_17f.png" visible="false" enabled="false" distorted="true" crop="0|0|80|80" scale="0.3" depth="1000" /> <!-- vr_auto_click() - 当VR光标悬停在热点上时经过若干时间后执行自动点击。 --> <action name="vr_auto_click"> 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'); <!-- 在动画结束后100毫秒执行点击动作。 --> sub(dt, 100); if(dt GT vr_aclk_timeout, set(vr_aclk_waiting,false); set(hotspot[vr_cursor].crop,'0|0|80|80'); <!-- 执行点击动作 --> onclick(); ); ); ); ); </action> <!-- 点击空格键,可在Oculus Rift中回到中心位置 --> <events name="webvr_events" devices="html5" keep="true" onkeydown="if(webvr AND webvr.isenabled AND keycode==32, webvr.resetSensor() );" onmousedown="if(webvr AND webvr.isenabled, webvr_showbuttons() );" /> <!-- 当WebVR支持可用时,显示进入VR的按钮 --> <action name="webvr_onavailable"> webvr.loadsettings(); delayedcall(0.5, tween(layer[webvr_enterbutton].alpha,1.0); ); </action> <action name="webvr_onunknowndevice"> 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); ); </action> <action name="webvr_onentervr"> tween(layer[webvr_enterbutton].alpha,0,0); webvr_showbuttons(); webvr_hide_all_non_vr_layers(); <!-- 当屏幕尺寸未知也没有设置自定义尺寸时,在进入VR模式时进入到设置菜单 --> 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); ); </action> <action name="webvr_onexitvr"> 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(); </action> <action name="webvr_hide_all_non_vr_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); ); ); </action> <action name="webvr_restore_layers"> 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); ); ); </action> <action name="webvr_show_fakemode_info"> 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); ); </action> <!-- 确保手机端缩放是相同的(忽略mobilescale的设置) --> <krpano webvr_setup_scale="calc:(1.0 + 1.0*(device.mobile AND stagescale LT 1.0)) / (1.0 + 1.0*device.mobile)" webvr_button_scale.normal="1.0" webvr_button_scale.mobile="1.6" /> <!-- 进入VR/推出VR 和 VR设置的按钮 --> <style name="webvr_button_style" url="%SWFPATH%/plugins/textfield.swf" backgroundcolor="0x000000" backgroundalpha="0.5" roundedge="calc:9*webvr_setup_scale*webvr_button_scale" css="calc:'color:#FFFFFF;font-size:' + 20*webvr_setup_scale*webvr_button_scale + 'px;'" padding="calc:6*webvr_setup_scale*webvr_button_scale + ' ' + 10*webvr_setup_scale*webvr_button_scale" /> <layer name="webvr_enterbutton" keep="true" vr="true" style="webvr_button_style" html="进入VR模式" align="top" y="24" autoalpha="true" alpha="0.0" onclick="webvr.enterVR();" /> <layer name="webvr_exitbutton" keep="true" vr="true" style="webvr_button_style" html="退出VR模式" align="top" y="24" autoalpha="true" alpha="0.0" onclick="webvr.exitVR();" /> <layer name="webvr_setupbutton" keep="true" vr="true" style="webvr_button_style" html="VR模式设置" align="bottom" y="24" autoalpha="true" alpha="0.0" onclick="vr_setup()" /> <action name="webvr_showbuttons"> 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); ); ); </action> <!-- VR 设置 --> <action name="vr_setup"> <!-- 屏蔽光标 --> set(webvr.vr_cursor_enabled, false); <!-- 隐藏VR按钮 --> 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') ); if(i_devicename == 'Unknown',vr_setup_createtext(vr_setup_dvn2, '未知', 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); ); </action> <action name="vr_setup_createtext"> <!-- %1 = name %2 = text %3 = align %4 = edge %5 = x %6 = y %7 = color %8 = enabled %9 = ondown %10 = onup %11 = onclick --> 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); </action> <action name="vr_setup_createbutton"> 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); </action> <action name="vr_setup_reset"> <!-- 恢复到默认设置 --> 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)); if(layer[vr_setup_dvn2].html == 'Unknown',set(layer[vr_setup_dvn2].html, '未知');) 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), ' 毫米'); <!-- 设置模拟自定义镜头设置执行'next' 头显切换到默认 'Cardboard' 设置 --> 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); , <!-- 为Mobile-VR应用选择 'Cardboard A'头显 --> vr_setup_change_headset(+1); ); vr_setup_select(get(selected_var)); </action> <action name="vr_setup_close"> <!-- 第二个参数设置为true时,也就是同时移除子元素 --> removelayer(vr_setup_bg, true); <!-- 开启光标 --> set(webvr.vr_cursor_enabled, true); </action> <action name="vr_setup_save"> webvr.saveSettings(); vr_setup_close(); </action> <action name="vr_setup_customize_headset"> 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'); </action> <action name="vr_setup_calibration"> set(layer[vr_setup_m1].visible,false); set(layer[vr_setup_m2].visible,true); </action> <action name="vr_setup_close_sub_menus"> 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); ); </action> <action name="vr_setup_do_calibration"> 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) ); ); ); </action> <action name="vr_setup_update_dist2"> 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); </action> <action name="vr_setup_select"> <!-- 选择设置进行调整 --> 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)); ); ); </action> <action name="vr_setup_change_screen"> 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;')); </action> <action name="vr_setup_change_ondown"> 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)); ); ); </action> <action name="vr_setup_adjust"> 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()); ); </action> <action name="vr_setup_change_headset"> 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); ); </action> </krpano> |
1.19 pr6 webvr文件汉化
点击代码窗口最右侧按钮,在新窗口打开后复制代码
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
<krpano> <!-- load the WebVR plugin and assign it to a 'webvr' variable for easier usage --> <plugin name="WebVR" devices="html5" keep="true" url="webvr.js" onloaded="copy(webvr, plugin[WebVR]);" mousespeed="0.00125" multireslock="true" fullscreen_mirroring="true" mobilevr_support="true" mobilevr_ipd="63.5" mobilevr_screensize="auto" mobilevr_lens_overlap="1.0" mobilevr_lens_fov="96" mobilevr_lens_dist="0.6" mobilevr_lens_dist2="1|0|0|0" mobilevr_lens_ca="0.0" mobilevr_lens_vign="100" mobilevr_wakelock="true" mobilevr_sensor_mode="3" mobilevr_autocalibration="false" mobilevr_touch_support="true" mobilevr_fake_support="false" vr_cursor="hotspot[vr_cursor]" vr_cursor_enabled="true" vr_cursor_onover="if(handcursor, tween(hotspot[vr_cursor].scale,0.4,0.1); vr_auto_click(get(vr_timeout)); );" vr_cursor_onout="tween(hotspot[vr_cursor].scale,0.3,0.1);" onavailable="webvr_onavailable();" onunavailable="" onunknowndevice="webvr_onunknowndevice();" onentervr="webvr_onentervr();" onexitvr="webvr_onexitvr();" /> <!-- a custom xml data structure with the supported VR headsets --> <vrheadsets> <headset name="cb1" caption="Cardboard A" overlap="1.10" fov="96.0" dist="1.00" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="cb2" caption="Cardboard B" overlap="1.00" fov="96.0" dist="0.60" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="gvr" caption="GearVR" overlap="1.00" fov="112.0" dist="0.95" dist2="1|0|0|0" ca="0.090" vig="100" /> <headset name="hom" caption="HOMiDO" overlap="1.00" fov="101.0" dist="1.10" dist2="1|0|0|0" ca="0.075" vig="100" /> <headset name="one" caption="VR ONE" overlap="1.00" fov="109.9" dist="0.00" dist2="1.139|0.093|0.018|0.207" ca="0.090" vig="35" /> <headset name="ccr" caption="ColorCross VR" overlap="1.00" fov="70.0" dist="0.65" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="nod" caption="无扭曲" overlap="1.00" fov="96.0" dist="0.00" dist2="1|0|0|0" ca="0.000" vig="100" /> </vrheadsets> <!-- the VR cursor hotspot --> <hotspot name="vr_cursor" keep="true" url="webvr_cursor_80x80_17f.png" visible="false" enabled="false" distorted="true" crop="0|0|80|80" scale="0.3" depth="1000" /> <!-- vr_auto_click() - call this action in the onover event of a hotspot to trigger automatically a click after some time. --> <action name="vr_auto_click"> 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'); <!-- wait another 100ms delay after finishing the animation before doing the click --> sub(dt, 100); if(dt GT vr_aclk_timeout, set(vr_aclk_waiting,false); set(hotspot[vr_cursor].crop,'0|0|80|80'); <!-- call onclick --> onclick(); ); ); ); ); </action> <!-- by pressing SPACE the Oculus Rift could be re-centered --> <events name="webvr_events" devices="html5" keep="true" onkeydown="if(webvr AND webvr.isenabled AND keycode==32, webvr.resetSensor() );" onmousedown="if(webvr AND webvr.isenabled, webvr_showbuttons() );" /> <!-- when WebVR support is available show an EnterVR button --> <action name="webvr_onavailable"> webvr.loadsettings(); delayedcall(0.5, tween(layer[webvr_enterbutton].alpha,1.0); ); </action> <action name="webvr_onunknowndevice"> if(webvr.isfake AND device.desktop AND webvr.havesettings == false, <!-- set the 'no distortion' headset for fake desktop usage --> 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); ); </action> <action name="webvr_onentervr"> tween(layer[webvr_enterbutton].alpha,0,0); webvr_showbuttons(); webvr_hide_all_non_vr_layers(); <!-- when the screen size is unknown an no custom size is set, open the setup screen on entering the VR mode --> 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); ); </action> <action name="webvr_onexitvr"> 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(); </action> <action name="webvr_hide_all_non_vr_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); ); ); </action> <action name="webvr_restore_layers"> 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); ); ); </action> <action name="webvr_show_fakemode_info"> 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); ); </action> <!-- ensure the same scaling on mobiles (regardless if mobilescale is 0.5 or 1.0) --> <krpano webvr_setup_scale="calc:(1.0 + 1.0*(device.mobile AND stagescale LT 1.0)) / (1.0 + 1.0*device.mobile)" webvr_button_scale.normal="1.0" webvr_button_scale.mobile="1.6" /> <!-- the EnterVR/ExitVR and SetupVR buttons --> <style name="webvr_button_style" url="%SWFPATH%/plugins/textfield.swf" backgroundcolor="0x000000" backgroundalpha="0.5" roundedge="calc:9*webvr_setup_scale*webvr_button_scale" css="calc:'color:#FFFFFF;font-size:' + 20*webvr_setup_scale*webvr_button_scale + 'px;'" padding="calc:6*webvr_setup_scale*webvr_button_scale + ' ' + 10*webvr_setup_scale*webvr_button_scale" /> <layer name="webvr_enterbutton" keep="true" vr="true" style="webvr_button_style" html="进入VR模式" align="top" y="24" autoalpha="true" alpha="0.0" onclick="webvr.enterVR();" /> <layer name="webvr_exitbutton" keep="true" vr="true" style="webvr_button_style" html="退出VR模式" align="top" y="24" autoalpha="true" alpha="0.0" onclick="webvr.exitVR();" /> <layer name="webvr_setupbutton" keep="true" vr="true" style="webvr_button_style" html="VR模式设置" align="bottom" y="24" autoalpha="true" alpha="0.0" onclick="vr_setup()" /> <action name="webvr_showbuttons"> 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); ); ); </action> <!-- VR Setup --> <action name="vr_setup"> <!-- disable cursor --> set(webvr.vr_cursor_enabled, false); <!-- hide VR buttons --> tween(layer[webvr_exitbutton].alpha,0); tween(layer[webvr_setupbutton].alpha,0); <!-- create background layer --> 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); <!-- get and prepare device infos and settings --> 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)); ); <!-- when the screen size is unknown, mark it red --> 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, '自定义'); ); ); <!-- create layer for the main menu --> 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%); <!-- create layer for the headset customization menu --> 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); <!-- create layer for the calibration menu --> 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); <!-- create the text elements --> 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') ); if(i_devicename == 'Unknown',vr_setup_createtext(vr_setup_dvn2, '未知', 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() ); <!-- and the adjusting buttons --> 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); <!-- create the customize_headset text elements --> 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() ); <!-- create the calibration text elements --> 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); <!-- pre-select the screen size for adjusting when it is unknown, otherwise the IPD --> if(known_size == false, vr_setup_select('screen', true); , vr_setup_select('ipd', true); ); </action> <action name="vr_setup_createtext"> <!-- %1 = name %2 = text %3 = align %4 = edge %5 = x %6 = y %7 = color %8 = enabled %9 = ondown %10 = onup %11 = onclick --> 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); </action> <action name="vr_setup_createbutton"> 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); </action> <action name="vr_setup_reset"> <!-- reset to the defaults --> 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)); if(layer[vr_setup_dvn2].html == 'Unknown',set(layer[vr_setup_dvn2].html, '未知');) 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 fake custom lens settings and call 'next' headset to switch to the default 'Cardboard' settings --> 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, <!-- select 'no distortion' headset for fake desktop usage --> vr_setup_change_headset(-1); , <!-- select 'Cardboard A' headset for Mobile-VR usage --> vr_setup_change_headset(+1); ); vr_setup_select(get(selected_var)); </action> <action name="vr_setup_close"> <!-- 2. parameter == true => remove children elements too --> removelayer(vr_setup_bg, true); <!-- enable cursor --> set(webvr.vr_cursor_enabled, true); </action> <action name="vr_setup_save"> webvr.saveSettings(); vr_setup_close(); </action> <action name="vr_setup_customize_headset"> 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'); </action> <action name="vr_setup_calibration"> set(layer[vr_setup_m1].visible,false); set(layer[vr_setup_m2].visible,true); </action> <action name="vr_setup_close_sub_menus"> 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); ); </action> <action name="vr_setup_do_calibration"> 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) ); ); ); </action> <action name="vr_setup_update_dist2"> 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); </action> <action name="vr_setup_select"> <!-- select a setting for adjusting --> 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)); ); ); </action> <action name="vr_setup_change_screen"> 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;')); </action> <action name="vr_setup_change_ondown"> 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)); ); ); </action> <action name="vr_setup_adjust"> 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()); ); </action> <action name="vr_setup_change_headset"> 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, <!-- loop right --> add(i_hsindex, 1); if(i_hsindex GE i_hscount, set(i_hsindex,0)); , <!-- loop left --> 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); ); </action> </krpano> |
1.19 pr5版本 文本汉化
链接:http://pan.baidu.com/s/1mh7PBZE 密码:u6cm
高亮部分为修改部分:
点击代码窗口最右侧按钮,在新窗口打开后复制代码
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
<krpano> <!-- load the WebVR plugin and assign it to a 'webvr' variable for easier usage --> <plugin name="WebVR" devices="html5" keep="true" url="webvr.js" onloaded="copy(webvr, plugin[WebVR]);" mousespeed="0.00125" multireslock="true" mobilevr_support="true" mobilevr_ipd="63.5" mobilevr_screensize="auto" mobilevr_lens_overlap="1.0" mobilevr_lens_fov="96" mobilevr_lens_dist="0.6" mobilevr_lens_dist2="1|0|0|0" mobilevr_lens_ca="0.0" mobilevr_lens_vign="100" mobilevr_wakelock="true" mobilevr_sensor_mode="3" mobilevr_autocalibration="false" mobilevr_touch_support="true" mobilevr_fake_support="false" vr_cursor="hotspot[vr_cursor]" vr_cursor_enabled="true" vr_cursor_onover="if(handcursor, tween(hotspot[vr_cursor].scale,0.4,0.1); vr_auto_click(get(vr_timeout)); );" vr_cursor_onout="tween(hotspot[vr_cursor].scale,0.3,0.1);" onavailable="webvr_onavailable();" onunavailable="" onunknowndevice="webvr_onunknowndevice();" onentervr="webvr_onentervr();" onexitvr="webvr_onexitvr();" /> <!-- a custom xml data structure with the supported VR headsets --> <vrheadsets> <headset name="cb1" caption="Cardboard A" overlap="1.10" fov="96.0" dist="1.00" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="cb2" caption="Cardboard B" overlap="1.00" fov="96.0" dist="0.60" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="gvr" caption="GearVR" overlap="1.00" fov="112.0" dist="0.95" dist2="1|0|0|0" ca="0.090" vig="100" /> <headset name="hom" caption="HOMiDO" overlap="1.00" fov="101.0" dist="1.10" dist2="1|0|0|0" ca="0.075" vig="100" /> <headset name="one" caption="VR ONE" overlap="1.00" fov="109.9" dist="0.00" dist2="1.139|0.093|0.018|0.207" ca="0.090" vig="35" /> <headset name="ccr" caption="ColorCross VR" overlap="1.00" fov="70.0" dist="0.65" dist2="1|0|0|0" ca="0.000" vig="100" /> <headset name="nod" caption="无扭曲" overlap="1.00" fov="96.0" dist="0.00" dist2="1|0|0|0" ca="0.000" vig="100" /> </vrheadsets> <!-- the VR cursor hotspot --> <hotspot name="vr_cursor" keep="true" url="webvr_cursor_80x80_17f.png" visible="false" enabled="false" distorted="true" crop="0|0|80|80" scale="0.3" depth="1000" /> <!-- vr_auto_click() - call this action in the onover event of a hotspot to trigger automatically a click after some time. --> <action name="vr_auto_click"> 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'); <!-- wait another 100ms delay after finishing the animation before doing the click --> sub(dt, 100); if(dt GT vr_aclk_timeout, set(vr_aclk_waiting,false); set(hotspot[vr_cursor].crop,'0|0|80|80'); <!-- call onclick --> onclick(); ); ); ); ); </action> <!-- by pressing SPACE the Oculus Rift could be re-centered --> <events name="webvr_events" devices="html5" keep="true" onkeydown="if(webvr AND webvr.isenabled AND keycode==32, webvr.resetSensor() );" onmousedown="if(webvr AND webvr.isenabled, webvr_showbuttons() );" /> <!-- when WebVR support is available show an EnterVR button --> <action name="webvr_onavailable"> webvr.loadsettings(); delayedcall(0.5, tween(layer[webvr_enterbutton].alpha,1.0); ); </action> <action name="webvr_onunknowndevice"> if(webvr.isfake AND device.desktop AND webvr.havesettings == false, <!-- set the 'no distortion' headset for fake desktop usage --> 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); ); </action> <action name="webvr_onentervr"> tween(layer[webvr_enterbutton].alpha,0,0); webvr_showbuttons(); webvr_hide_all_non_vr_layers(); <!-- when the screen size is unknown an no custom size is set, open the setup screen on entering the VR mode --> 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); ); </action> <action name="webvr_onexitvr"> 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(); </action> <action name="webvr_hide_all_non_vr_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); ); ); </action> <action name="webvr_restore_layers"> 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); ); ); </action> <action name="webvr_show_fakemode_info"> 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); ); </action> <!-- ensure the same scaling on mobiles (regardless if mobilescale is 0.5 or 1.0) --> <krpano webvr_setup_scale="calc:(1.0 + 1.0*(device.mobile AND stagescale LT 1.0)) / (1.0 + 1.0*device.mobile)" webvr_button_scale.normal="1.0" webvr_button_scale.mobile="1.6" /> <!-- the EnterVR/ExitVR and SetupVR buttons --> <style name="webvr_button_style" url="%SWFPATH%/plugins/textfield.swf" backgroundcolor="0x000000" backgroundalpha="0.5" roundedge="calc:9*webvr_setup_scale*webvr_button_scale" css="calc:'color:#FFFFFF;font-size:' + 20*webvr_setup_scale*webvr_button_scale + 'px;'" padding="calc:6*webvr_setup_scale*webvr_button_scale + ' ' + 10*webvr_setup_scale*webvr_button_scale" /> <layer name="webvr_enterbutton" keep="true" vr="true" style="webvr_button_style" html="进入VR模式" align="top" y="24" autoalpha="true" alpha="0.0" onclick="webvr.enterVR();" /> <layer name="webvr_exitbutton" keep="true" vr="true" style="webvr_button_style" html="退出VR模式" align="top" y="24" autoalpha="true" alpha="0.0" onclick="webvr.exitVR();" /> <layer name="webvr_setupbutton" keep="true" vr="true" style="webvr_button_style" html="VR模式设置" align="bottom" y="24" autoalpha="true" alpha="0.0" onclick="vr_setup()" /> <action name="webvr_showbuttons"> 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); ); ); </action> <!-- VR Setup --> <action name="vr_setup"> <!-- disable cursor --> set(webvr.vr_cursor_enabled, false); <!-- hide VR buttons --> tween(layer[webvr_exitbutton].alpha,0); tween(layer[webvr_setupbutton].alpha,0); <!-- create background layer --> 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); <!-- get and prepare device infos and settings --> 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)); ); <!-- when the screen size is unknown, mark it red --> 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, '自定义'); ); ); <!-- create layer for the main menu --> 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%); <!-- create layer for the headset customization menu --> 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); <!-- create layer for the calibration menu --> 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); <!-- create the text elements --> 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') ); if(i_devicename == 'Unknown',vr_setup_createtext(vr_setup_dvn2, '未知', 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() ); <!-- and the adjusting buttons --> 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); <!-- create the customize_headset text elements --> 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() ); <!-- create the calibration text elements --> 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); <!-- pre-select the screen size for adjusting when it is unknown, otherwise the IPD --> if(known_size == false, vr_setup_select('screen', true); , vr_setup_select('ipd', true); ); </action> <action name="vr_setup_createtext"> <!-- %1 = name %2 = text %3 = align %4 = edge %5 = x %6 = y %7 = color %8 = enabled %9 = ondown %10 = onup %11 = onclick --> 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); </action> <action name="vr_setup_createbutton"> 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); </action> <action name="vr_setup_reset"> <!-- reset to the defaults --> 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)); if(layer[vr_setup_dvn2].html == 'Unknown',set(layer[vr_setup_dvn2].html, '未知');) 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 fake custom lens settings and call 'next' headset to switch to the default 'Cardboard' settings --> 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, <!-- select 'no distortion' headset for fake desktop usage --> vr_setup_change_headset(-1); , <!-- select 'Cardboard A' headset for Mobile-VR usage --> vr_setup_change_headset(+1); ); vr_setup_select(get(selected_var)); </action> <action name="vr_setup_close"> <!-- 2. parameter == true => remove children elements too --> removelayer(vr_setup_bg, true); <!-- enable cursor --> set(webvr.vr_cursor_enabled, true); </action> <action name="vr_setup_save"> webvr.saveSettings(); vr_setup_close(); </action> <action name="vr_setup_customize_headset"> 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'); </action> <action name="vr_setup_calibration"> set(layer[vr_setup_m1].visible,false); set(layer[vr_setup_m2].visible,true); </action> <action name="vr_setup_close_sub_menus"> 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); ); </action> <action name="vr_setup_do_calibration"> 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) ); ); ); </action> <action name="vr_setup_update_dist2"> 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); </action> <action name="vr_setup_select"> <!-- select a setting for adjusting --> 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)); ); ); </action> <action name="vr_setup_change_screen"> 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;')); </action> <action name="vr_setup_change_ondown"> 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)); ); ); </action> <action name="vr_setup_adjust"> 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()); ); </action> <action name="vr_setup_change_headset"> 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, <!-- loop right --> add(i_hsindex, 1); if(i_hsindex GE i_hscount, set(i_hsindex,0)); , <!-- loop left --> 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); ); </action> </krpano> |