How to use the FileLoader function from three

Find comprehensive JavaScript three.FileLoader code examples handpicked from public code repositorys.

18
19
20
21
22
23
24
25
26
27

var scope = this;

var path = (scope.path === '') ? THREE.LoaderUtils.extractUrlBase(url) : scope.path;

var loader = new THREE.FileLoader(scope.manager);
loader.setPath(scope.path);
loader.load(url, function (text) {

        try {
fork icon278
star icon0
watch icon1

+ 15 other calls in file

41
42
43
44
45
46
47
48
49

var self = this;

var path = ( self.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : self.path;

var loader = new THREE.FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' );

loader.load( url, function ( buffer ) {
fork icon18
star icon229
watch icon9

+ 21 other calls in file

7
8
9
10
11
12
13
14
15
16

function ZipTools(path, vue) {
    this.zip = new JSZip();
    this.vue = vue;

    this.fileLoader = new THREE.FileLoader();
    this.fileLoader.setPath(path);
    this.fileLoader.setResponseType('arraybuffer');

    this.zipContent = null;
fork icon13
star icon28
watch icon7

1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
this.primitiveCache = {};

this.textureLoader = new THREE.TextureLoader(this.options.manager);
this.textureLoader.setCrossOrigin(this.options.crossOrigin);

this.fileLoader = new THREE.FileLoader(this.options.manager);
this.fileLoader.setResponseType("arraybuffer");

if (this.options.crossOrigin === "use-credentials") {
  this.fileLoader.setWithCredentials(true);
fork icon3
star icon7
watch icon0

+ 29 other calls in file

110
111
112
113
114
115
116
117
118
119
    scope.manager.itemError( url );
    scope.manager.itemEnd( url );

};

const loader = new THREE.FileLoader( this.manager );
loader.setPath( this.path );
loader.setResponseType( 'arraybuffer' );
loader.setRequestHeader( this.requestHeader );
loader.setWithCredentials( this.withCredentials );
fork icon2
star icon10
watch icon0

+ 3 other calls in file

573
574
575
576
577
578
579
580
581
582
/**
 * @param {string} src
 * @return {Promise}
 */
THREE.DRACOLoader._loadArrayBuffer = function (src) {
  var loader = new THREE.FileLoader();
  loader.setResponseType("arraybuffer");
  return new Promise(function (resolve, reject) {
    loader.load(src, resolve, undefined, reject);
  });
fork icon3
star icon7
watch icon0

+ 29 other calls in file

24
25
26
27
28
29
30
31
32
33

load: function ( url, onLoad, onProgress, onError ) {

        var scope = this;

        var loader = new THREE.FileLoader( scope.manager );
        loader.setPath( scope.path );
        loader.load( url, function ( text ) {

                onLoad( scope.parse( text ) );
fork icon3
star icon3
watch icon1

+ 5 other calls in file

62
63
64
65
66
67
68
69
70
71
const jsLoader = new three_1.FileLoader(this.manager);
jsLoader.setPath(this.transcoderPath);
jsLoader.setWithCredentials(this.withCredentials);
const jsContent = jsLoader.loadAsync('basis_transcoder.js');
// Load transcoder WASM binary.
const binaryLoader = new three_1.FileLoader(this.manager);
binaryLoader.setPath(this.transcoderPath);
binaryLoader.setResponseType('arraybuffer');
binaryLoader.setWithCredentials(this.withCredentials);
const binaryContent = binaryLoader.loadAsync('basis_transcoder.wasm');
fork icon1
star icon3
watch icon0

+ 26 other calls in file

36
37
38
39
40
41
42
43
44
45
 * @param {THREE.LoadingManager} manager
 */
class MMDLoader extends three_1.Loader {
    constructor(manager) {
        super(manager);
        this.loader = new three_1.FileLoader(this.manager);
        this.parser = null; // lazy generation
        this.meshBuilder = new MeshBuilder(this.manager);
        this.animationBuilder = new AnimationBuilder();
    }
fork icon1
star icon3
watch icon0

+ 4 other calls in file

320
321
322
323
324
325
326
327
328
329
const manager = new THREE.LoadingManager(function () {
    const zipped = fflate_module_1.zipSync(toZip, { level: 9 });
    const blob = new Blob([zipped.buffer], { type: 'application/zip' });
    save(blob, (title !== '' ? title : 'untitled') + '.zip');
});
const loader = new THREE.FileLoader(manager);
loader.load('js/libs/app/index.html', function (content) {
    content = content.replace('<!-- title -->', title);
    const includes = [];
    content = content.replace('<!-- includes -->', includes.join('\n\t\t'));
fork icon1
star icon3
watch icon0

+ 2 other calls in file

6
7
8
9
10
11
12
13
14
15
16
var Vector4 = THREE.Vector4;
var Color = THREE.Color;
var Vector2 = THREE.Vector2;
var Face3 = require('../three/Geometry').Face3;
var Geometry = require('../three/Geometry').Geometry;
var FileLoader = THREE.FileLoader;
var DefaultLoadingManager = THREE.DefaultLoadingManager;
var VideoHandler = require('../videoHandler').VideoHandler;


/**
fork icon10
star icon3
watch icon3

+ 23 other calls in file

26
27
28
29
30
31
32
33
34
35
    url: './static/id.png',
    loader: THREE.TextureLoader
  }, {
    key: 'file-vs',
    url: './glsl/vert.glsl',
    loader: THREE.FileLoader
}, {
    key: 'file-fs',
    url: './glsl/frag.glsl',
    loader: THREE.FileLoader
fork icon1
star icon1
watch icon0

+ 3 other calls in file

713
714
715
716
717
718
719
720
721
722
if (shader.extensions && shader.extensions[EXTENSIONS.KHR_BINARY_GLTF]) {
  return extensions[EXTENSIONS.KHR_BINARY_GLTF].loadShader(shader, dependencies.bufferViews);
}

return new Promise(function (resolve) {
  var loader = new THREE.FileLoader(options.manager);
  loader.setResponseType('text');
  loader.load(resolveURL(shader.uri, options.path), function (shaderText) {
    resolve(shaderText);
  });
fork icon0
star icon1
watch icon0

+ 29 other calls in file

98
99
100
101
102
103
104
105
106
107

  scope.manager.itemError(url);
  scope.manager.itemEnd(url);
};

var loader = new _three.FileLoader(this.manager);
loader.setPath(this.path);
loader.setResponseType('arraybuffer');
loader.setRequestHeader(this.requestHeader);
loader.setWithCredentials(this.withCredentials);
fork icon0
star icon1
watch icon0

+ 3 other calls in file

34
35
36
37
38
39
40
41
42
43
44
    });
};
prefLoader.setPath(PREFAB_PATH);


// scene 数据加载器
const sceneLoader = new THREE.FileLoader();
sceneLoader.oldLoad = sceneLoader.load;
sceneLoader.parse = (data) => JSON.parse(data);
sceneLoader.load = function (path, callback) {
    sceneLoader.oldLoad(path, (data) => {
fork icon1
star icon0
watch icon1

53
54
55
56
57
58
59
60
61
62
var loader, cubeMapLoader, vert, frag, cubeMap, scene, renderer, camera, quad, _a, _b, _c;
var _d, _e, _f;
return __generator(this, function (_g) {
    switch (_g.label) {
        case 0:
            loader = new three_1.FileLoader();
            cubeMapLoader = new three_1.CubeTextureLoader();
            vert = loader.loadAsync("shaders/spheretracing/vert.3se");
            frag = loader.loadAsync("shaders/spheretracing/frag.glsl");
            cubeMap = cubeMapLoader
fork icon0
star icon0
watch icon0

41
42
43
44
45
46
47
48
49
50
var path =
  self.path === undefined
    ? THREE.LoaderUtils.extractUrlBase(url)
    : self.path;

var loader = new THREE.FileLoader(this.manager);
loader.setResponseType('arraybuffer');

loader.load(
  url,
fork icon0
star icon0
watch icon0

21
22
23
24
25
26
27
28
29
function OBJLoader2( manager ) {
        console.log( "Using THREE.OBJLoader2 version: " + OBJLOADER2_VERSION );
        this.manager = Validator.verifyInput( manager, THREE.DefaultLoadingManager );

        this.path = '';
        this.fileLoader = new THREE.FileLoader( this.manager );

        this.meshCreator = new MeshCreator();
        this.parser = new Parser( this.meshCreator );
fork icon0
star icon0
watch icon3

+ 3 other calls in file

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)