Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BufferGeometryLoader

A loader for loading a BufferGeometry. This uses the FileLoader internally for loading files.

Code Example

// instantiate a loader
const loader = new THREE.BufferGeometryLoader();
// load a resource
loader.load(
'models/json/pressure.json', // resource URL
function ( geometry ) { // onLoad callback
const material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
const object = new THREE.Mesh( geometry, material );
scene.add( object );
},
function ( xhr ) { // onProgress callback
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
function ( err ) { // onError callback
console.log( 'An error happened' );
}
);

Examples

WebGL / performance

Hierarchy

Index

Constructors

constructor

Properties

crossOrigin

crossOrigin: string

The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. Default is anonymous.

default

'anonymous'

manager

The loadingManager the loader is using. Default is DefaultLoadingManager.

path

path: string

The base path from which the asset will be loaded. Default is the empty string.

default

''

requestHeader

requestHeader: {}

The request header used in HTTP request. See .setRequestHeader. Default is empty object.

default

{}

Type declaration

  • [header: string]: string

resourcePath

resourcePath: string

The base path from which additional resources like textures will be loaded. Default is the empty string.

default

''

withCredentials

withCredentials: boolean

Whether the XMLHttpRequest uses credentials. See .setWithCredentials. Default is false.

default:

false

Methods

load

loadAsync

  • Begin loading from url and call onLoad with the parsed response content.

    Parameters

    • url: string

      Will be called when load completes. The argument will be the loaded BufferGeometry.

    • Optional onProgress: (event: ProgressEvent<EventTarget>) => void

      Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .total and .loaded bytes. If the server does not set the Content-Length header; .total will be 0.

        • (event: ProgressEvent<EventTarget>): void
        • Parameters

          • event: ProgressEvent<EventTarget>

          Returns void

    Returns Promise<I3JS.BufferGeometry | I3JS.InstancedBufferGeometry>

parse

setCrossOrigin

setPath

setRequestHeader

setResourcePath

setWithCredentials

Generated using TypeDoc