Class JSONLoader

A loader for loading objects in JSON format.

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(showStatus?: boolean): JSONLoader

Parameters

  • showStatus?: boolean optional

Returns

JSONLoader

Properties

public crossOrigin: string

default — null. If set, assigns the crossOrigin attribute of the image to the value of crossOrigin, prior to starting the load.

public onLoadComplete: () => void

Will be called when load completes. The default is a function with empty body.

public onLoadProgress: () => void

Will be called while load progresses. The default is a function with empty body.

public onLoadStart: () => void

Will be called when load starts. The default is a function with empty body.

public showStatus: boolean

If true, show loading status in the statusDomElement.

public statusDomElement: HTMLElement

This is the recipient of status messages.

public withCredentials: boolean

Methods

public addStatusElement(): HTMLElement

Returns

HTMLElement

public createMaterial(m: Material, texturePath: string): boolean

Parameters

Returns

boolean

public extractUrlBase(url: string): string

Parameters

  • url: string

Returns

string

public initMaterials(materials: Material[], texturePath: string): Material[]

Parameters

  • materials: Material[]
  • texturePath: string

Returns

Material[]

public load(url: string, callback: (geometry: THREE.Geometry, materials: THREE.Material[]) => void, texturePath?: string)

Parameters

  • url: string
  • callback: (geometry: THREE.Geometry, materials: THREE.Material[]) => void
  • texturePath?: string optional

    If not specified, textures will be assumed to be in the same folder as the Javascript model file.

public loadAjaxJSON(context: JSONLoader, url: string, callback: (geometry: THREE.Geometry, materials: THREE.Material[]) => void, texturePath?: string, callbackProgress?: (progress: THREE.Progress) => void)

Parameters

  • context: JSONLoader
  • url: string
  • callback: (geometry: THREE.Geometry, materials: THREE.Material[]) => void
  • texturePath?: string optional
  • callbackProgress?: (progress: THREE.Progress) => void optional

public needsTangents(materials: Material[]): boolean

Parameters

Returns

boolean

public parse(json: string, texturePath: string): any

Parameters

  • json: string
  • texturePath: string

Returns

any

public updateProgress(progress: Progress)

Parameters