提交 a918d4ad 编写于 作者: M Mugen87

JSM: Added module and TS file for EXRLoader.

上级 1213ea19
......@@ -114,6 +114,7 @@
<li>BVHLoader</li>
<li>ColladaLoader</li>
<li>DDSLoader</li>
<li>EXRLoader</li>
<li>FBXLoader</li>
<li>GLTFLoader</li>
<li>MTLLoader</li>
......
......@@ -83,14 +83,14 @@ THREE.EXRLoader.prototype = Object.create( THREE.DataTextureLoader.prototype );
THREE.EXRLoader.prototype._parser = function ( buffer ) {
const USHORT_RANGE = (1 << 16);
const BITMAP_SIZE = (USHORT_RANGE >> 3);
const USHORT_RANGE = ( 1 << 16 );
const BITMAP_SIZE = ( USHORT_RANGE >> 3 );
const HUF_ENCBITS = 16; // literal (value) bit length
const HUF_DECBITS = 14; // decoding bit size (>= 8)
const HUF_ENCBITS = 16; // literal (value) bit length
const HUF_DECBITS = 14; // decoding bit size (>= 8)
const HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1; // encoding table size
const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size
const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
const HUF_DECMASK = HUF_DECSIZE - 1;
const SHORT_ZEROCODE_RUN = 59;
......@@ -157,6 +157,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
getBitsReturn.l = ( c >> lc ) & ( ( 1 << nBits ) - 1 );
getBitsReturn.c = c;
getBitsReturn.lc = lc;
}
const hufTableBuffer = new Array( 59 );
......@@ -249,9 +250,17 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
}
function hufLength( code ) { return code & 63; }
function hufLength( code ) {
return code & 63;
}
function hufCode( code ) { return code >> 6; }
function hufCode( code ) {
return code >> 6;
}
function hufBuildDecTable( hcode, im, iM, hdecod ) {
......@@ -355,7 +364,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
lc -= 8;
var cs = ( c >> lc );
var cs = new Uint8Array([cs])[0];
var cs = new Uint8Array( [ cs ] )[ 0 ];
if ( outBufferOffset.value + cs > outBufferEndOffset ) {
......@@ -365,7 +374,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
var s = outBuffer[ outBufferOffset.value - 1 ];
while ( cs-- > 0 ) {
while ( cs -- > 0 ) {
outBuffer[ outBufferOffset.value ++ ] = s;
......@@ -805,7 +814,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
function parseUint32( dataView, offset ) {
var Uint32 = dataView.getUint32(offset.value, true);
var Uint32 = dataView.getUint32( offset.value, true );
offset.value = offset.value + INT32_SIZE;
......@@ -815,7 +824,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
function parseUint8Array( uInt8Array, offset ) {
var Uint8 = uInt8Array[offset.value];
var Uint8 = uInt8Array[ offset.value ];
offset.value = offset.value + INT8_SIZE;
......@@ -825,7 +834,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
function parseUint8( dataView, offset ) {
var Uint8 = dataView.getUint8(offset.value);
var Uint8 = dataView.getUint8( offset.value );
offset.value = offset.value + INT8_SIZE;
......@@ -835,7 +844,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
function parseFloat32( dataView, offset ) {
var float = dataView.getFloat32(offset.value, true);
var float = dataView.getFloat32( offset.value, true );
offset.value += FLOAT32_SIZE;
......@@ -873,7 +882,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
function parseFloat16( buffer, offset ) {
return decodeFloat16( parseUint16( buffer, offset) );
return decodeFloat16( parseUint16( buffer, offset ) );
}
......@@ -1021,8 +1030,8 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
}
var bufferDataView = new DataView(buffer);
var uInt8Array = new Uint8Array(buffer);
var bufferDataView = new DataView( buffer );
var uInt8Array = new Uint8Array( buffer );
var EXRHeader = {};
......
import {
LoadingManager,
DataTextureLoader,
TextureDataType,
PixelFormat
} from '../../../src/Three';
export interface EXR {
header: object;
width: number;
height: number;
data: Float32Array;
format: PixelFormat;
type: TextureDataType;
}
export class EXRLoader extends DataTextureLoader {
constructor(manager?: LoadingManager);
parse(buffer: ArrayBuffer) : EXR;
}
此差异已折叠。
......@@ -35,6 +35,7 @@ var files = [
{ path: 'loaders/BVHLoader.js', dependencies: [], ignoreList: [ 'Bones' ] },
{ path: 'loaders/ColladaLoader.js', dependencies: [ { name: 'TGALoader', path: 'loaders/TGALoader.js' } ], ignoreList: [] },
{ path: 'loaders/DDSLoader.js', dependencies: [], ignoreList: [] },
{ path: 'loaders/EXRLoader.js', dependencies: [], ignoreList: [] },
{ path: 'loaders/FBXLoader.js', dependencies: [ { name: 'TGALoader', path: 'loaders/TGALoader.js' }, { name: 'NURBSCurve', path: 'curves/NURBSCurve.js' } ], ignoreList: [] },
{ path: 'loaders/GLTFLoader.js', dependencies: [], ignoreList: [ 'NoSide', 'Matrix2', 'DDSLoader' ] },
{ path: 'loaders/MTLLoader.js', dependencies: [], ignoreList: [ 'BackSide', 'DoubleSide', 'ClampToEdgeWrapping', 'MirroredRepeatWrapping' ] },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册