Methods
imageTexture
- imageTexture(url: string, options?: TextureLoaderOptions): Promise<ImageTexture>
-
Parameters
-
url: string
-
Default value options: TextureLoaderOptions = {}
loadImageTexture
- loadImageTexture(url: string, onLoad: (texture: ImageTexture) => any, onError?: () => any, options?: TextureLoaderOptions): void
-
Parameters
-
url: string
-
onLoad: (texture: ImageTexture) => any
-
Optional onError: () => any
-
Default value options: TextureLoaderOptions = {}
Returns void
A utility for loading Texture resources from a URL.
const loader = new EIGHT.TextureLoader(engine) loader.loadImageTexture('img/textures/solar-system/2k_earth_daymap.jpg', function(texture) { texture.minFilter = EIGHT.TextureMinFilter.NEAREST; const geometry = new EIGHT.SphereGeometry(engine, {azimuthSegments: 64, elevationSegments: 32}) const material = new EIGHT.HTMLScriptsMaterial(engine, ['vs', 'fs']) sphere = new EIGHT.Mesh(geometry, material, engine) geometry.release() material.release() sphere.texture = texture texture.release() scene.add(sphere) })