misc_uv_tests.html 2.4 KB

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