@@ -3,7 +3,7 @@ import test from 'tape-promise/tape';
3
3
import { VertexFormat , getDataTypeFromTypedArray , getTypedArrayFromDataType , getVertexFormatFromAttribute } from '@luma.gl/core' ;
4
4
import type { TypedArray , TypedArrayConstructor } from '@luma.gl/core' ;
5
5
6
- const TEST_CASES : { typedArray : TypedArray , size ?: number , result ?: VertexFormat , error ?: string } [ ] = [
6
+ const TEST_CASES : { typedArray : TypedArray , size ?: number , normalized ?: boolean , result ?: VertexFormat , error ?: string } [ ] = [
7
7
{ typedArray : new Uint8Array ( ) , size : 4 , result : 'uint8x4' } ,
8
8
{ typedArray : new Uint8ClampedArray ( ) , size : 2 , result : 'uint8x2' } ,
9
9
{ typedArray : new Int8Array ( ) , size : 4 , result : 'sint8x4' } ,
@@ -15,6 +15,12 @@ const TEST_CASES: {typedArray: TypedArray, size?: number, result?: VertexFormat,
15
15
{ typedArray : new Float32Array ( ) , size : 3 , result : 'float32x3' } ,
16
16
{ typedArray : new Float32Array ( ) , size : 4 , result : 'float32x4' } ,
17
17
18
+ { typedArray : new Uint8Array ( ) , size : 2 , normalized : true , result : 'unorm8x2' } ,
19
+ { typedArray : new Uint8ClampedArray ( ) , size : 4 , normalized : true , result : 'unorm8x4' } ,
20
+ { typedArray : new Int8Array ( ) , size : 2 , normalized : true , result : 'snorm8x2' } ,
21
+ { typedArray : new Uint16Array ( ) , size : 2 , normalized : true , result : 'unorm16x2' } ,
22
+ { typedArray : new Int16Array ( ) , size : 4 , normalized : true , result : 'snorm16x4' } ,
23
+
18
24
{ typedArray : new Float32Array ( ) , size : 5 , error : 'Invalid attribute size 5' } ,
19
25
{ typedArray : new Int32Array ( ) , error : 'Missing attribute size' } ,
20
26
{ typedArray : new Uint8Array ( ) , size : 1 , error : 'Bad 16 bit alignment' } ,
@@ -23,9 +29,9 @@ const TEST_CASES: {typedArray: TypedArray, size?: number, result?: VertexFormat,
23
29
] ;
24
30
25
31
test ( 'api#getVertexFormatFromAttribute' , t => {
26
- for ( const { typedArray, size, result, error} of TEST_CASES ) {
32
+ for ( const { typedArray, size, normalized , result, error} of TEST_CASES ) {
27
33
if ( result ) {
28
- const vertexFormat = getVertexFormatFromAttribute ( typedArray , size ) ;
34
+ const vertexFormat = getVertexFormatFromAttribute ( typedArray , size , normalized ) ;
29
35
t . deepEqual (
30
36
vertexFormat ,
31
37
result ,
0 commit comments