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.
		
		
		
		
		
			
		
			
				
					
					
						
							117 lines
						
					
					
						
							3.8 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							117 lines
						
					
					
						
							3.8 KiB
						
					
					
				
								<!DOCTYPE html>
							 | 
						|
								<html lang="it">
							 | 
						|
									<head>
							 | 
						|
										<meta charset="utf-8" />
							 | 
						|
										<base href="../../../" />
							 | 
						|
										<script src="page.js"></script>
							 | 
						|
										<link type="text/css" rel="stylesheet" href="page.css" />
							 | 
						|
									</head>
							 | 
						|
									<body>
							 | 
						|
										[page:Texture] →
							 | 
						|
								
							 | 
						|
										<h1>[name]</h1>
							 | 
						|
								
							 | 
						|
										<p class="desc">Crea una texture direttamente da dati grezzi, larghezza e altezza.</p>
							 | 
						|
								
							 | 
						|
										<h2>Costruttore</h2>
							 | 
						|
								
							 | 
						|
										<h3>[name]( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding )</h3>
							 | 
						|
										<p>
							 | 
						|
											L'argomento data deve essere un [link:https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView ArrayBufferView].
							 | 
						|
											Ulteriori parametri corrispondono alle proprietà ereditate da [page:Texture], dove sia magFilter che minFilter per impostazione predefinita sono THREE.NearestFilter. 
							 | 
						|
										</p>
							 | 
						|
										<p>
							 | 
						|
											L'interpretazione dei dati dipende dal tipo e dal formato:
							 | 
						|
											Se il tipo è THREE.UnsignedByteType, un Uint8Array sarà utile per indirizzare i dati texel.
							 | 
						|
											Se il formato è THREE.RGBAFormat, i dati necessitano di quattro valori per un texel; Rosso, Verde, Blu e Alfa (tipicamente l'opacità).<br />
							 | 
						|
								
							 | 
						|
											Per i tipi compressi, THREE.UnsignedShort4444Type e THREE.UnsignedShort5551Type tutti i componenti di colore di un texel possono essere 
							 | 
						|
											indirizzati come campi di bit all'interno di un elemento intero di un Uint16Array.<br />
							 | 
						|
								
							 | 
						|
											Per utilizzare i tipi THREE.FloatType e THREE.HalfFloatType, l'implementazione WebGL deve supportare le 
							 | 
						|
											rispettive estensioni OES_texture_float e OES_texture_half_float. 
							 | 
						|
											Per utilizzare THREE.LinearFilter per l'interpolazione bilineare component-wise dei texel basati
							 | 
						|
											su questi tipi, devono essere presenti anche le estensioni WebGL OES_texture_float_linear o OES_texture_half_float_linear.
							 | 
						|
										</p>
							 | 
						|
								
							 | 
						|
										<h2>Codice di Esempio</h2>
							 | 
						|
								
							 | 
						|
										<code>
							 | 
						|
										// crea un buffer con i dati del colore
							 | 
						|
								
							 | 
						|
										const width = 512;
							 | 
						|
										const height = 512;
							 | 
						|
								
							 | 
						|
										const size = width * height;
							 | 
						|
										const data = new Uint8Array( 4 * size );
							 | 
						|
										const color = new THREE.Color( 0xffffff );
							 | 
						|
								
							 | 
						|
										const r = Math.floor( color.r * 255 );
							 | 
						|
										const g = Math.floor( color.g * 255 );
							 | 
						|
										const b = Math.floor( color.b * 255 );
							 | 
						|
								
							 | 
						|
										for ( let i = 0; i < size; i ++ ) {
							 | 
						|
								
							 | 
						|
											const stride = i * 4;
							 | 
						|
								
							 | 
						|
											data[ stride ] = r;
							 | 
						|
											data[ stride + 1 ] = g;
							 | 
						|
											data[ stride + 2 ] = b;
							 | 
						|
											data[ stride + 3 ] = 255;
							 | 
						|
								
							 | 
						|
										}
							 | 
						|
								
							 | 
						|
										// utilizza il buffer per creare un [name]
							 | 
						|
								
							 | 
						|
										const texture = new THREE.DataTexture( data, width, height );
							 | 
						|
										texture.needsUpdate = true;
							 | 
						|
										</code>
							 | 
						|
								
							 | 
						|
										<h2>Proprietà</h2>
							 | 
						|
								
							 | 
						|
										<p>
							 | 
						|
								    	Vedi la classe base [page:Texture Texture] per le proprietà comuni.
							 | 
						|
								    </p>
							 | 
						|
								
							 | 
						|
										<h3>[property:Boolean flipY]</h3>
							 | 
						|
										<p>
							 | 
						|
										Se impostato a `true`, la texture viene capovolta lungo l'asse verticale quando viene caricata sulla GPU. L'impostazione predefinita è `false`.
							 | 
						|
										</p>
							 | 
						|
								
							 | 
						|
										<h3>[property:Boolean generateMipmaps]</h3>
							 | 
						|
										<p>
							 | 
						|
											Indica se generare mipmap (se possibile) per una texture. Falso per impostazione predefinita.
							 | 
						|
										</p>
							 | 
						|
								
							 | 
						|
										<h3>[property:Image image]</h3>
							 | 
						|
										<p>
							 | 
						|
											Sostituito con un tipo di record contenente dati, larghezza, altezza e profondità.
							 | 
						|
										</p>
							 | 
						|
								
							 | 
						|
										<h3>[property:Boolean isDataTexture]</h3>
							 | 
						|
										<p>
							 | 
						|
											Flag di sola lettura per verificare se l'oggetto dato è di tipo [name].
							 | 
						|
										</p>
							 | 
						|
								
							 | 
						|
										<h3>[property:number unpackAlignment]</h3>
							 | 
						|
										<p>
							 | 
						|
										1 per impostazione predefinita. Specifica i requisiti di allineamento per l'inizio di ogni riga di pixel in memoria.
							 | 
						|
										I valori consentiti sono 1 (allineamento byte), 2 (righe allineate a byte pari), 4 (allineamento delle parole) e 8
							 | 
						|
										(le righe iniziano su limiti di parole doppie).
							 | 
						|
										Vedi [link:http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml glPixelStorei]
							 | 
						|
										per maggiori informazioni.
							 | 
						|
										</p>
							 | 
						|
								
							 | 
						|
										<h2>Metodi</h2>
							 | 
						|
								
							 | 
						|
								    <p>
							 | 
						|
											Vedi la classe base [page:Texture Texture] per i metodi comuni.
							 | 
						|
								    </p>
							 | 
						|
								
							 | 
						|
										<h2>Source</h2>
							 | 
						|
								
							 | 
						|
										<p>
							 | 
						|
											[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
							 | 
						|
										</p>
							 | 
						|
									</body>
							 | 
						|
								</html>
							 | 
						|
								
							 |