Skip to content

TSL: UniformNode Support Int/Uint #28667

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

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/jsm/nodes/accessors/BufferAttributeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BufferAttributeNode extends InputNode {

getHash( builder ) {

if ( this.bufferStride === 0 && this.bufferOffset === 0) {
if ( this.bufferStride === 0 && this.bufferOffset === 0 ) {

let bufferData = builder.globalCache.getData( this.value );

Expand Down
10 changes: 5 additions & 5 deletions examples/jsm/nodes/core/NodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createNodeMaterialFromType, default as NodeMaterial } from '../material
import { NodeUpdateType, defaultBuildStages, shaderStages } from './constants.js';

import {
FloatNodeUniform, Vector2NodeUniform, Vector3NodeUniform, Vector4NodeUniform,
NumberNodeUniform, Vector2NodeUniform, Vector3NodeUniform, Vector4NodeUniform,
ColorNodeUniform, Matrix3NodeUniform, Matrix4NodeUniform
} from '../../renderers/common/nodes/NodeUniform.js';

Expand Down Expand Up @@ -1181,10 +1181,10 @@ class NodeBuilder {

getNodeUniform( uniformNode, type ) {

if ( type === 'float' ) return new FloatNodeUniform( uniformNode );
if ( type === 'vec2' ) return new Vector2NodeUniform( uniformNode );
if ( type === 'vec3' ) return new Vector3NodeUniform( uniformNode );
if ( type === 'vec4' ) return new Vector4NodeUniform( uniformNode );
if ( type === 'float' || type === 'int' || type === 'uint' ) return new NumberNodeUniform( uniformNode );
if ( type === 'vec2' || type === 'ivec2' || type === 'uvec2' ) return new Vector2NodeUniform( uniformNode );
if ( type === 'vec3' || type === 'ivec3' || type === 'uvec3' ) return new Vector3NodeUniform( uniformNode );
if ( type === 'vec4' || type === 'ivec4' || type === 'uvec4' ) return new Vector4NodeUniform( uniformNode );
if ( type === 'color' ) return new ColorNodeUniform( uniformNode );
if ( type === 'mat3' ) return new Matrix3NodeUniform( uniformNode );
if ( type === 'mat4' ) return new Matrix4NodeUniform( uniformNode );
Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/renderers/common/Uniform.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class Uniform {

}

class FloatUniform extends Uniform {
class NumberUniform extends Uniform {

constructor( name, value = 0 ) {

super( name, value );

this.isFloatUniform = true;
this.isNumberUniform = true;

this.boundary = 4;
this.itemSize = 1;
Expand Down Expand Up @@ -134,7 +134,7 @@ class Matrix4Uniform extends Uniform {
}

export {
FloatUniform,
NumberUniform,
Vector2Uniform, Vector3Uniform, Vector4Uniform, ColorUniform,
Matrix3Uniform, Matrix4Uniform
};
2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/UniformsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class UniformsGroup extends UniformBuffer {

updateByType( uniform ) {

if ( uniform.isFloatUniform ) return this.updateNumber( uniform );
if ( uniform.isNumberUniform ) return this.updateNumber( uniform );
if ( uniform.isVector2Uniform ) return this.updateVector2( uniform );
if ( uniform.isVector3Uniform ) return this.updateVector3( uniform );
if ( uniform.isVector4Uniform ) return this.updateVector4( uniform );
Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/renderers/common/nodes/NodeUniform.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
FloatUniform, Vector2Uniform, Vector3Uniform, Vector4Uniform,
NumberUniform, Vector2Uniform, Vector3Uniform, Vector4Uniform,
ColorUniform, Matrix3Uniform, Matrix4Uniform
} from '../Uniform.js';

class FloatNodeUniform extends FloatUniform {
class NumberNodeUniform extends NumberUniform {

constructor( nodeUniform ) {

Expand Down Expand Up @@ -130,6 +130,6 @@ class Matrix4NodeUniform extends Matrix4Uniform {
}

export {
FloatNodeUniform, Vector2NodeUniform, Vector3NodeUniform, Vector4NodeUniform,
NumberNodeUniform, Vector2NodeUniform, Vector3NodeUniform, Vector4NodeUniform,
ColorNodeUniform, Matrix3NodeUniform, Matrix4NodeUniform
};