import { DataTexture } from 'three'; import { Data3DTexture } from 'three'; import { DataArrayTexture } from 'three'; import { DepthTexture } from 'three'; import { Texture } from 'three'; import { Vector2 } from 'three'; import { RGBAFormat } from 'three'; import { UnsignedByteType } from 'three'; ; const data = new Uint8Array([255, 0, 0, 255, 0, 255, 0, 255]); const texture = new DataTexture(data, 2, 1, RGBAFormat, UnsignedByteType); texture.needsUpdate = true; console.log('data', texture.image.width, texture.image.data[4], texture.version, texture.source.version); texture.offset.set(0.25, 0.5); texture.repeat.set(2, 2); texture.updateMatrix(); const uv = new Vector2(0.2, 0.2); texture.transformUv(uv); console.log('uv', uv.x.toFixed(3), uv.y.toFixed(3)); const clone = texture.clone(); console.log('clone', clone !== texture, clone.source === texture.source, clone.image.data === texture.image.data); console.log('3d', new Data3DTexture(new Uint8Array(8), 2, 2, 2).image.depth, new DataArrayTexture(new Uint8Array(8), 2, 2, 2).image.depth, new DepthTexture(2, 3).image.height); const depth = new DepthTexture(); console.log('default depth', depth.image.width, depth.image.height, depth.image.depth);