Skip to content

Latest commit

 

History

History

pgm-loader

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

PGM Loader

A class in the same form as the three.js loaders for loading and parsing PGM images (ref 1, ref 2).

Use

const loader = new PGMLoader();
loader.load( 'path/to/file.pgm', array => {

    // ... loaded data ...

} );

API

PGMResult

.data

data : Uint16Array | Uint8Array

The PGM laid out in an array in row major order where each row has a stride of width.

.width

width : Number

The width of the pgm file in pixels.

.height

height : Number

The height of the pgm file in pixels.

.maxValue

maxValue : Number

The maximum gray value in the file.

PGMLoaderBase

Class for loading and parsing PGM image files

.fetchOptions

fetchOptions : Object = { credentials: 'same-origin' }

Fetch options for loading the file.

.load

load( url : String ) : Promise<PGMResult>

Loads and parses the PGM file. The promise resolves with the returned data from the parse function.

.parse

parse( buffer : ArrayBuffer ) : PGMResult

Parses the contents of the given PGM and returns an object describing the telemetry.

PGMLoader

Three.js implementation of PGMLoaderBase.

extends PGMLoaderBase

.manager

manager : LoadingManager = DefaultLoadingManager

.constructor

constructor( manager : LoadingManager = DefaultLoadingManager ) : void

.load

load( url : String, texture : DataTexture = new DataTexture() ) : Promise<DataTexture>

Loads and parses the PGM file and returns a DataTexture. If a DataTexture is passed into the function the data is applied to it.

.parse

parse( buffer : Uint8Array | ArrayBuffer, texture : DataTexture = new DataTexture() ) : DataTexture

Parses the contents of the given PGM file and returns a texture with the contents.