The website of the KaosCube
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.0 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <?php
  4. $lang=$_GET['lang'];
  5. if ( in_array ($lang, array('en-US'))){
  6. $loc = "$lang".".utf8";
  7. $loc1 = $lang;
  8. }
  9. else {
  10. $loc = "de-DE";
  11. $loc1 = "de-DE";
  12. }
  13. include "Spyc.php";
  14. $localeYaml = Spyc::YAMLLoad('locale.yaml');
  15. $domain = "messages";
  16. setlocale(LC_MESSAGES, $loc);
  17. setlocale(LC_ALL, $loc);
  18. $results = putenv("LC_ALL=$loc");
  19. $results = putenv("LC_MESSAGES=$loc");
  20. ?>
  21. <head>
  22. <meta charset="utf-8">
  23. <title><?php echo $localeYaml['title'][$loc1]?></title>
  24. <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
  25. <link rel="stylesheet" href="index.css">
  26. <style>
  27. body { margin: 0; background-color: deeppink;}
  28. .grid-container {
  29. display: grid;
  30. grid-template-columns: auto;
  31. @media only screen and (max-width: 500px) {
  32. .grid-container {
  33. display: grid;
  34. grid-template-columns: auto;
  35. }
  36. [class*="model0"] {
  37. width: 90vw;
  38. height: 40vh;
  39. }
  40. [class*="model1"] {
  41. width: 90vw;
  42. height: 40vh;
  43. }
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. <center>
  49. <header style="height: 10 vh;">
  50. <center>
  51. <a href="/" style="text-decoration:none; color:black;"><img style="height: 15vh;" src="static/KaosCubeLogo.png" alt="logo"></a>
  52. </center>
  53. </header>
  54. </center>
  55. <center>
  56. <div class="grid-container">
  57. <h1 style="background-color:white; height: 5vh; font-size:3vh; justify-self: center; width: 90vw;"> Die STL Files zum Download gibt es <a href=""> hier </a> </h1>
  58. <div class="model1" id="model1" style="width: 80vw; height: 80vh; justify-self: center; background-color: white;"> </div>
  59. <div style="height: 5vh; background-color:deeppink;"></div>
  60. <div class="model0" id="model0" style="width: 80vw; height: 80vh; justify-self: center; background-color: white;"> </div>
  61. </div>
  62. </center>
  63. </body>
  64. </html>
  65. <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js"></script>
  66. <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/controls/OrbitControls.js"></script>
  67. <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/loaders/STLLoader.js"></script>
  68. <script type="text/javascript">
  69. function STLViewer(model, elementID) {
  70. var elem = document.getElementById(elementID)
  71. var camera = new THREE.PerspectiveCamera(70,
  72. elem.clientWidth/elem.clientHeight, 1, 1000);
  73. var renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
  74. renderer.setSize(elem.clientWidth, elem.clientHeight);
  75. elem.appendChild(renderer.domElement);
  76. window.addEventListener('resize', function () {
  77. renderer.setSize(elem.clientWidth, elem.clientHeight);
  78. camera.aspect = elem.clientWidth/elem.clientHeight;
  79. camera.updateProjectionMatrix();
  80. }, false);
  81. var controls = new THREE.OrbitControls(camera, renderer.domElement);
  82. controls.enableDamping = true;
  83. controls.rotateSpeed = 2;
  84. controls.dampingFactor = 0.1;
  85. controls.enableZoom = true;
  86. controls.autoRotate = true;
  87. controls.autoRotateSpeed = .75;
  88. var scene = new THREE.Scene();
  89. scene.add(new THREE.HemisphereLight(0xffffff, 1.5));
  90. (new THREE.STLLoader()).load(model, function (geometry) {
  91. var material = new THREE.MeshPhongMaterial({
  92. color: 0xff1493,
  93. specular: 100,
  94. shininess: 100 });
  95. var mesh = new THREE.Mesh(geometry, material);
  96. scene.add(mesh);
  97. var middle = new THREE.Vector3();
  98. geometry.computeBoundingBox();
  99. geometry.boundingBox.getCenter(middle);
  100. mesh.geometry.applyMatrix(new THREE.Matrix4().makeTranslation(
  101. -middle.x, -middle.y, -middle.z ) );
  102. var largestDimension = Math.max(geometry.boundingBox.max.x,
  103. geometry.boundingBox.max.y,
  104. geometry.boundingBox.max.z)
  105. camera.position.z = largestDimension * 2.5;
  106. var animate = function () {
  107. requestAnimationFrame(animate);
  108. controls.update();
  109. renderer.render(scene, camera);
  110. };
  111. animate();
  112. });
  113. }
  114. window.onload = function() {
  115. STLViewer("KaosCubeTopThick2mm_cut_joints.stl", "model0")
  116. STLViewer("KaosCube_support_cable.stl", "model1")
  117. }
  118. </script>