1 | import THREE from './Three';
|
2 | import loadAsync from './loadAsync';
|
3 | import parseAssetCallback from './loaders/parseAssetCallback';
|
4 | export default class CubeTexture extends THREE.CubeTexture {
|
5 | static format = {
|
6 | direct_s: ['lf', 'rt', 'up', 'dn', 'ft', 'bk'],
|
7 | coord_s: ['px', 'nx', 'py', 'ny', 'pz', 'nz'],
|
8 | coord_m: ['xpos', 'xneg', 'ypos', 'yneg', 'zpos', 'zneg'],
|
9 | };
|
10 | loadAsync = async (options) => {
|
11 | const nextDirections = options.directions || CubeTexture.format.coord_s;
|
12 | for (let direction of nextDirections) {
|
13 | const asset = await parseAssetCallback(direction, options.assetForDirection);
|
14 | const texture = await loadAsync(asset);
|
15 | this.images.push(texture);
|
16 | }
|
17 | this.needsUpdate = true;
|
18 | };
|
19 | }
|
20 |
|
\ | No newline at end of file |