@gov.nasa.jpl.honeycomb/sgi-loader
v0.0.6
Published
0.0.5-alpha.5
Readme
SGI Loader
A class in the same form as the three.js loaders for loading and parsing SGI images.
!> Note that RLE parsing for 2 byte per channel images is untested.
Use
import { SGILoader } from '@gov.nasa.jpl.honeycomb/sgi-loader';
const loader = new SGILoader();
loader
.load( 'path/to/file.rgb' )
.then( texture => {
// ... loaded three.js texture ...
} );API
SGIResult
name
name : StringThe image name embedded in the file.
rle
rle : BooleanWhether the file is run length encoded or not.
dimension
dimension : NumberThe number of dimensions to the stored data.
width
width : NumberThe width of the sgi file in pixels.
height
height : NumberThe height of the sgi file in pixels.
channels
channels : NumberThe number of color channels stored in the image.
minValue
minValue : NumberThe minimum channel value in the file.
maxValue
maxValue : NumberThe maximum channel value in the file.
bytesPerChannel
bytesPerChannel : NumberThe amount of bytes used to represent a single color channel.
data
data : Uint16Array | Uint8ArrayThe SGI laid out in an array in row major order where each row has a stride
of width * channels * bytesPerChannel.
SGILoaderBase
Class for loading Silicon Graphics Image files
fetchOptions
fetchOptions : Object = { credentials: 'same-origin' }Fetch options for loading the file.
load
load( url : String ) : Promise<SGIResult>Loads and parses the SGI file. The promise resolves with the returned data from the parse function.
parse
parse( buffer : ArrayBuffer | Uint8Array ) : SGIResultParses the contents of the given SGI contents and returns an object describing the telemetry.
SGILoader
A three.js implementation of SGILoader that returns a data texture rather than raw results.
extends SGILoaderBase
manager
manager : LoadingManager = DefaultLoadingManagerconstructor
constructor( manager : LoadingManager = DefaultLoadingManager ) : voidload
load( url : String, texture : DataTexture = new DataTexture() ) : DataTextureLoads and parses the SGI file and returns a DataTexture. If a DataTexture is passed into the function the data is applied to it.
parse
parse( buffer : ArrayBuffer | Uint8Array, texture : DataTexture = new DataTexture() ) : DataTextureParses the contents of the given SGI contents and returns a texture.
