panorama.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <title>VR</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  11. <meta name="format-detection" content="telephone=no">
  12. <script src="{% static '/lib/js/three.js' %}"></script>
  13. <script src="{% static '/lib/js/mxreality.js' %}"></script>
  14. <style type="text/css">
  15. /*#example {
  16. position: absolute;
  17. width: 100%;
  18. height: 100%;
  19. left:0px;
  20. top:0px;
  21. overflow: hidden;
  22. }*/
  23. </style>
  24. </head>
  25. <body>
  26. <div id="example"></div>
  27. <input type="text" id="imgpath" value="{{img}}">
  28. <script>
  29. window.onload=function () {
  30. init();
  31. }
  32. function init() {
  33. var scene, renderer;
  34. var container;
  35. renderer = new THREE.WebGLRenderer();
  36. container = document.getElementById('example');
  37. container.appendChild(renderer.domElement);
  38. scene = new THREE.Scene();
  39. var vr=new VR(scene,renderer,container,{'fov':60});
  40. vr.vrbox.radius=10;
  41. vr.asteroidConfig.enable=true;
  42. //vr.asteroidConfig.asteroidTop=-1;
  43. //vr.effect.separation=5;
  44. vr.init();
  45. //vr.controls.object.position.set(0,-7,0);
  46. //vr.camera.lookAt(0,0,0)
  47. if(!AVR.isCrossScreen()) {
  48. vr.useGyroscope = false;
  49. }
  50. vr.loadProgressManager.onLoad=function () {
  51. vr.VRObject.getObjectByName("__panoContainer").visible = true;
  52. vr.asteroidForward(function () {
  53. vr.controls.autoRotate=true;
  54. });
  55. }
  56. window.addEventListener("click",function () {
  57. //vr.controls.object.position.z=0.0001;
  58. });
  59. /*setInterval(function () {
  60. //console.log(vr.controls.object.position.z);
  61. vr.controls.object.position.z=0.0001;
  62. },36)*/
  63. var imgpath = document.getElementById('imgpath').value;
  64. vr.playPanorama(imgpath);
  65. }
  66. </script>
  67. </body>
  68. </html>