diff --git a/src/nodes/accessors/UniformArrayNode.js b/src/nodes/accessors/UniformArrayNode.js index 6d6a64f91296a6..7c0d81d442982f 100644 --- a/src/nodes/accessors/UniformArrayNode.js +++ b/src/nodes/accessors/UniformArrayNode.js @@ -46,6 +46,7 @@ class UniformArrayNode extends BufferNode { this.array = value; this.elementType = elementType === null ? getValueType( value[ 0 ] ) : elementType; + this.paddedType = this.getPaddedType(); this.updateType = NodeUpdateType.RENDER; @@ -53,6 +54,12 @@ class UniformArrayNode extends BufferNode { } + getNodeType() { + + return this.paddedType; + + } + getElementType() { return this.elementType; @@ -61,7 +68,8 @@ class UniformArrayNode extends BufferNode { getPaddedType() { - const elementType = this.getElementType(); + const elementType = this.elementType; + let paddedType = 'vec4'; if ( elementType === 'mat2' ) { @@ -90,7 +98,7 @@ class UniformArrayNode extends BufferNode { const { array, value } = this; - const elementType = this.getElementType(); + const elementType = this.elementType; if ( elementType === 'float' || elementType === 'int' || elementType === 'uint' ) { @@ -189,11 +197,11 @@ class UniformArrayNode extends BufferNode { setup( builder ) { const length = this.array.length; + const elementType = this.elementType; - const elementType = this.getElementType(); let arrayType = Float32Array; - const paddedType = this.getPaddedType(); + const paddedType = this.paddedType; const paddedElementLength = builder.getTypeLength( paddedType ); if ( elementType.charAt( 0 ) === 'i' ) arrayType = Int32Array;