@gov.nasa.jpl.honeycomb/pgm-loader
v0.0.6
Published
Loader and parser for the PGM image format for three.js.
Downloads
3
Readme
PGM Loader
A class in the same form as the three.js loaders for loading and parsing PGM images.
Use
import { PGMLoader } from '@gov.nasa.jpl.honeycomb/pgm-loader';
const loader = new PGMLoader();
loader.load('path/to/file.pgm', array => {
// ... loaded data ...
});API
PGMResult
data
data : Uint16Array | Uint8ArrayThe PGM laid out in an array in row major order where each row has a stride of width.
width
width : NumberThe width of the pgm file in pixels.
height
height : NumberThe height of the pgm file in pixels.
maxValue
maxValue : NumberThe 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 ) : PGMResultParses the contents of the given PGM and returns an object describing the telemetry.
PGMLoader
Three.js implementation of PGMLoaderBase.
extends PGMLoaderBase
manager
manager : LoadingManager = DefaultLoadingManagerconstructor
constructor( manager : LoadingManager = DefaultLoadingManager ) : voidload
load( url : String, texture : DataTexture = new DataTexture() ) : DataTextureLoads 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() ) : DataTextureParses the contents of the given PGM file and returns a texture with the contents.
