misc_uv_tests.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 * as THREE from '../build/three.module.js';
  11. import { UVsDebug } from './jsm/utils/UVsDebug.js';
  12. /*
  13. * This is to help debug UVs problems in geometry,
  14. * as well as allow a new user to visualize what UVs are about.
  15. */
  16. function test( name, geometry ) {
  17. var d = document.createElement( 'div' );
  18. d.innerHTML = '<br><br>' + name + '<br>';
  19. d.appendChild( UVsDebug( geometry ) );
  20. document.body.appendChild( d );
  21. }
  22. var points = [];
  23. for ( var i = 0; i < 10; i ++ ) {
  24. points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 15 + 50, ( i - 5 ) * 2 ) );
  25. }
  26. //
  27. test( 'new THREE.PlaneBufferGeometry( 100, 100, 4, 4 )', new THREE.PlaneBufferGeometry( 100, 100, 4, 4 ) );
  28. test( 'new THREE.SphereBufferGeometry( 75, 12, 6 )', new THREE.SphereBufferGeometry( 75, 12, 6 ) );
  29. test( 'new THREE.IcosahedronBufferGeometry( 30, 1 )', new THREE.IcosahedronBufferGeometry( 30, 1 ) );
  30. test( 'new THREE.OctahedronBufferGeometry( 30, 2 )', new THREE.OctahedronBufferGeometry( 30, 2 ) );
  31. test( 'new THREE.CylinderBufferGeometry( 25, 75, 100, 10, 5 )', new THREE.CylinderBufferGeometry( 25, 75, 100, 10, 5 ) );
  32. test( 'new THREE.BoxBufferGeometry( 100, 100, 100, 4, 4, 4 )', new THREE.BoxBufferGeometry( 100, 100, 100, 4, 4, 4 ) );
  33. test( 'new THREE.LatheBufferGeometry( points, 8 )', new THREE.LatheBufferGeometry( points, 8 ) );
  34. test( 'new THREE.TorusBufferGeometry( 50, 20, 8, 8 )', new THREE.TorusBufferGeometry( 50, 20, 8, 8 ) );
  35. test( 'new THREE.TorusKnotBufferGeometry( 50, 10, 12, 6 )', new THREE.TorusKnotBufferGeometry( 50, 10, 12, 6 ) );
  36. </script>
  37. </body>
  38. </html>