|
| 1 | +import { |
| 2 | + ClampToEdgeWrapping, |
| 3 | + MirroredRepeatWrapping, |
| 4 | + RepeatWrapping, |
| 5 | + UVMapping, |
| 6 | + Vector2 |
| 7 | + } from 'three'; |
| 8 | +import {App} from '../../core'; |
| 9 | + |
| 10 | +/** |
| 11 | + * Texture properties |
| 12 | + */ |
| 13 | +interface TextureParams { |
| 14 | + |
| 15 | + /** |
| 16 | + * The path to the texture (e.g URL) |
| 17 | + */ |
| 18 | + url: string, |
| 19 | + |
| 20 | + /** |
| 21 | + * The type of map (e.g bumpMap) |
| 22 | + * Default is map |
| 23 | + */ |
| 24 | + type?: string, |
| 25 | + |
| 26 | + /** |
| 27 | + * Offset of the texture. |
| 28 | + * Default is Vector2(0, 0) |
| 29 | + */ |
| 30 | + offset?: Vector2, |
| 31 | + |
| 32 | + /** |
| 33 | + * Repeat |
| 34 | + * Default is Vector2(1, 1) |
| 35 | + */ |
| 36 | + repeat?: Vector2, |
| 37 | + |
| 38 | + /** |
| 39 | + * Sets wrapS and wrapT. |
| 40 | + * This defines how the texture is wrapped horizontally and vertically, corresponds to UV mapping. |
| 41 | + * Default is RepeatWrapping. |
| 42 | + */ |
| 43 | + wrap?: ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping | any[], |
| 44 | + |
| 45 | + /** |
| 46 | + * How the image is applied to the object. |
| 47 | + * An object type of THREE.UVMapping is the default, where the U,V coordinates are used to apply the map. |
| 48 | + */ |
| 49 | + mapping?: UVMapping, |
| 50 | + |
| 51 | + /** |
| 52 | + * Function to set more granular parameters |
| 53 | + * e.g const fix = texture => { |
| 54 | + * texture.anisotropy = 2; |
| 55 | + * texture.magFilter = THREE.LinearFilter; |
| 56 | + * texture.minFilter = THREE.LinearMipMapLinearFilter; |
| 57 | + * return texture; |
| 58 | + * }; |
| 59 | + */ |
| 60 | + fix?: Function |
| 61 | +} |
| 62 | + |
| 63 | +export class TextureModule { |
| 64 | + |
| 65 | + /** |
| 66 | + * @constructor Creates a texture module. |
| 67 | + * @param textures the texture(s) properties |
| 68 | + */ |
| 69 | + constructor(textures: TextureParams | TextureParams[]); |
| 70 | +} |
0 commit comments