You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					96 lines
				
				2.3 KiB
			
		
		
			
		
	
	
					96 lines
				
				2.3 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								<!DOCTYPE html>
							 | 
						||
| 
								 | 
							
								<html lang="en">
							 | 
						||
| 
								 | 
							
									<head>
							 | 
						||
| 
								 | 
							
										<title>three.js - uv mapping tests</title>
							 | 
						||
| 
								 | 
							
										<meta charset=utf-8 />
							 | 
						||
| 
								 | 
							
										<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
							 | 
						||
| 
								 | 
							
										<style>
							 | 
						||
| 
								 | 
							
											body {
							 | 
						||
| 
								 | 
							
												background: #ffffff;
							 | 
						||
| 
								 | 
							
												color: #000000;
							 | 
						||
| 
								 | 
							
												text-align: center;
							 | 
						||
| 
								 | 
							
												font-family: sans-serif;
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
											h3 {
							 | 
						||
| 
								 | 
							
												margin-top: 60px;
							 | 
						||
| 
								 | 
							
												margin-bottom: 30px;
							 | 
						||
| 
								 | 
							
												font-weight: normal;
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
											canvas {
							 | 
						||
| 
								 | 
							
												width: 100%;
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
										</style>
							 | 
						||
| 
								 | 
							
									</head>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									<body>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										<!-- Import maps polyfill -->
							 | 
						||
| 
								 | 
							
										<!-- Remove this when import maps will be widely supported -->
							 | 
						||
| 
								 | 
							
										<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										<script type="importmap">
							 | 
						||
| 
								 | 
							
											{
							 | 
						||
| 
								 | 
							
												"imports": {
							 | 
						||
| 
								 | 
							
													"three": "../build/three.module.js",
							 | 
						||
| 
								 | 
							
													"three/addons/": "./jsm/"
							 | 
						||
| 
								 | 
							
												}
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
										</script>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										<script type="module">
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											import * as THREE from 'three';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											import { UVsDebug } from 'three/addons/utils/UVsDebug.js';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											/*
							 | 
						||
| 
								 | 
							
											 * This is to help debug UVs problems in geometry,
							 | 
						||
| 
								 | 
							
											 * as well as allow a new user to visualize what UVs are about.
							 | 
						||
| 
								 | 
							
											 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											function test( name, geometry ) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
												const d = document.createElement( 'div' );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
												d.innerHTML = '<h3>' + name + '</h3>';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
												d.appendChild( UVsDebug( geometry ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
												document.body.appendChild( d );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											const points = [];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											for ( let i = 0; i < 10; i ++ ) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
												points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 15 + 50, ( i - 5 ) * 2 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											//
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.PlaneGeometry( 100, 100, 4, 4 )', new THREE.PlaneGeometry( 100, 100, 4, 4 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.SphereGeometry( 75, 12, 6 )', new THREE.SphereGeometry( 75, 12, 6 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.IcosahedronGeometry( 30, 1 )', new THREE.IcosahedronGeometry( 30, 1 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.OctahedronGeometry( 30, 2 )', new THREE.OctahedronGeometry( 30, 2 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.CylinderGeometry( 25, 75, 100, 10, 5 )', new THREE.CylinderGeometry( 25, 75, 100, 10, 5 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 )', new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.LatheGeometry( points, 8 )', new THREE.LatheGeometry( points, 8 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.TorusGeometry( 50, 20, 8, 8 )', new THREE.TorusGeometry( 50, 20, 8, 8 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
											test( 'new THREE.TorusKnotGeometry( 50, 10, 12, 6 )', new THREE.TorusKnotGeometry( 50, 10, 12, 6 ) );
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										</script>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									</body>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								</html>
							 |