Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.js 1.6KB

il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
il y a 8 ans
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var controls, renderer, raycaster, scene, selection, camera;
  2. var mouseprevpos = {};
  3. // Run on startup
  4. window.onload = init;
  5. // Clear the whole scene
  6. function makeScene() {
  7. var myScene = new THREE.Scene();
  8. var grid = new THREE.GridHelper(10, 1);
  9. grid.rotation.x = Math.PI / 2;
  10. grid.setColors(0xdddddd, 0xeeeeee);
  11. myScene.add(grid);
  12. return myScene;
  13. }
  14. // Render the current frame to the screen
  15. function render() {
  16. requestAnimationFrame(function() {
  17. renderer.render(scene, camera);
  18. });
  19. }
  20. // Someone resized the window
  21. function onWindowResize(evt) {
  22. camera.aspect = window.innerWidth / window.innerHeight;
  23. camera.updateProjectionMatrix();
  24. renderer.setSize(window.innerWidth, window.innerHeight);
  25. render();
  26. }
  27. // Called on startup
  28. function init() {
  29. // Renderer
  30. renderer = new THREE.WebGLRenderer({
  31. "antialias": true
  32. });
  33. renderer.setSize(window.innerWidth, window.innerHeight);
  34. renderer.setClearColor(0xffffff, 1);
  35. document.querySelector("body").appendChild(renderer.domElement);
  36. window.addEventListener("resize", onWindowResize, false);
  37. // Time to load the materials
  38. loadMaterials();
  39. // Camera, controls, raycaster
  40. camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.3, 1000);
  41. controls = new THREE.OrbitControls(camera);
  42. controls.center.set(0, 0, 0);
  43. controls.rotateSpeed = 0.2;
  44. controls.addEventListener("change", render);
  45. camera.position.set(0, 0, 20);
  46. // Run
  47. scene = makeScene();
  48. connectToServer();
  49. render();
  50. }