misc_uv_tests.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. <style>
  8. body {
  9. background: #ffffff;
  10. color: #000000;
  11. text-align: center;
  12. font-family: sans-serif;
  13. }
  14. h3 {
  15. margin-top: 60px;
  16. margin-bottom: 30px;
  17. font-weight: normal;
  18. }
  19. canvas {
  20. width: 100%;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <script type="module">
  26. import * as THREE from '../build/three.module.js';
  27. import { UVsDebug } from './jsm/utils/UVsDebug.js';
  28. /*
  29. * This is to help debug UVs problems in geometry,
  30. * as well as allow a new user to visualize what UVs are about.
  31. */
  32. function test( name, geometry ) {
  33. const d = document.createElement( 'div' );
  34. d.innerHTML = '<h3>' + name + '</h3>';
  35. d.appendChild( UVsDebug( geometry ) );
  36. document.body.appendChild( d );
  37. }
  38. const points = [];
  39. for ( let i = 0; i < 10; i ++ ) {
  40. points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 15 + 50, ( i - 5 ) * 2 ) );
  41. }
  42. //
  43. test( 'new THREE.PlaneGeometry( 100, 100, 4, 4 )', new THREE.PlaneGeometry( 100, 100, 4, 4 ) );
  44. test( 'new THREE.SphereGeometry( 75, 12, 6 )', new THREE.SphereGeometry( 75, 12, 6 ) );
  45. test( 'new THREE.IcosahedronGeometry( 30, 1 )', new THREE.IcosahedronGeometry( 30, 1 ) );
  46. test( 'new THREE.OctahedronGeometry( 30, 2 )', new THREE.OctahedronGeometry( 30, 2 ) );
  47. test( 'new THREE.CylinderGeometry( 25, 75, 100, 10, 5 )', new THREE.CylinderGeometry( 25, 75, 100, 10, 5 ) );
  48. test( 'new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 )', new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 ) );
  49. test( 'new THREE.LatheGeometry( points, 8 )', new THREE.LatheGeometry( points, 8 ) );
  50. test( 'new THREE.TorusGeometry( 50, 20, 8, 8 )', new THREE.TorusGeometry( 50, 20, 8, 8 ) );
  51. test( 'new THREE.TorusKnotGeometry( 50, 10, 12, 6 )', new THREE.TorusKnotGeometry( 50, 10, 12, 6 ) );
  52. </script>
  53. </body>
  54. </html>