Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UniformArrayNode: Fix getNodeType() #30058

Merged
merged 6 commits into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/nodes/accessors/UniformArrayNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,20 @@ class UniformArrayNode extends BufferNode {

this.array = value;
this.elementType = elementType === null ? getValueType( value[ 0 ] ) : elementType;
this.paddedType = this.getPaddedType();

this.updateType = NodeUpdateType.RENDER;

this.isArrayBufferNode = true;

}

getNodeType() {

return this.paddedType;

}

getElementType() {

return this.elementType;
Expand All @@ -61,7 +68,8 @@ class UniformArrayNode extends BufferNode {

getPaddedType() {

const elementType = this.getElementType();
const elementType = this.elementType;

let paddedType = 'vec4';

if ( elementType === 'mat2' ) {
Expand Down Expand Up @@ -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' ) {

Expand Down Expand Up @@ -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;
Expand Down
Loading