misc_uv_tests.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>three.js - uv mapping tests</title>
  5. <meta charset=utf-8 />
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. </head>
  8. <body>
  9. <script type="module">
  10. import {
  11. BoxBufferGeometry,
  12. CylinderBufferGeometry,
  13. IcosahedronBufferGeometry,
  14. PlaneBufferGeometry,
  15. LatheBufferGeometry,
  16. OctahedronBufferGeometry,
  17. SphereBufferGeometry,
  18. TorusBufferGeometry,
  19. TorusKnotBufferGeometry,
  20. Vector2
  21. } from "../build/three.module.js";
  22. import { UVsDebug } from './jsm/utils/UVsDebug.js';
  23. /*
  24. * This is to help debug UVs problems in geometry,
  25. * as well as allow a new user to visualize what UVs are about.
  26. */
  27. function test( name, geometry ) {
  28. var d = document.createElement( 'div' );
  29. d.innerHTML = '<br><br>' + name + '<br>';
  30. d.appendChild( UVsDebug( geometry ) );
  31. document.body.appendChild( d );
  32. }
  33. var points = [];
  34. for ( var i = 0; i < 10; i ++ ) {
  35. points.push( new Vector2( Math.sin( i * 0.2 ) * 15 + 50, ( i - 5 ) * 2 ) );
  36. }
  37. //
  38. test( 'new THREE.PlaneBufferGeometry( 100, 100, 4, 4 )', new PlaneBufferGeometry( 100, 100, 4, 4 ) );
  39. test( 'new THREE.SphereBufferGeometry( 75, 12, 6 )', new SphereBufferGeometry( 75, 12, 6 ) );
  40. test( 'new THREE.IcosahedronBufferGeometry( 30, 1 )', new IcosahedronBufferGeometry( 30, 1 ) );
  41. test( 'new THREE.OctahedronBufferGeometry( 30, 2 )', new OctahedronBufferGeometry( 30, 2 ) );
  42. test( 'new THREE.CylinderBufferGeometry( 25, 75, 100, 10, 5 )', new CylinderBufferGeometry( 25, 75, 100, 10, 5 ) );
  43. test( 'new THREE.BoxBufferGeometry( 100, 100, 100, 4, 4, 4 )', new BoxBufferGeometry( 100, 100, 100, 4, 4, 4 ) );
  44. test( 'new THREE.LatheBufferGeometry( points, 8 )', new LatheBufferGeometry( points, 8 ) );
  45. test( 'new THREE.TorusBufferGeometry( 50, 20, 8, 8 )', new TorusBufferGeometry( 50, 20, 8, 8 ) );
  46. test( 'new THREE.TorusKnotBufferGeometry( 50, 10, 12, 6 )', new TorusKnotBufferGeometry( 50, 10, 12, 6 ) );
  47. </script>
  48. </body>
  49. </html>