Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Mar 19, 2023
1 parent d48ae4d commit 0923c2e
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions examples/jsm/nodes/shadernode/ShaderNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ConvertNode from '../utils/ConvertNode.js';
import JoinNode from '../utils/JoinNode.js';
import SplitNode from '../utils/SplitNode.js';
import ConstNode from '../core/ConstNode.js';
import { getValueFromType } from '../core/NodeUtils.js';
import { getValueFromType, getValueType } from '../core/NodeUtils.js';

const NodeElements = new Map(); // @TODO: Currently only a few nodes are added, probably also add others

Expand Down Expand Up @@ -255,20 +255,6 @@ const getAutoTypedConstNode = ( value ) => {

};

const getTypeFromInputNode = ( node ) => {

if ( node.isInputNode !== true || node.value === null ) return;

const value = node.value;

if ( value.isVector3 === true ) return 'vec3';
if ( value.isVector4 === true ) return 'vec4';
if ( value.isColor === true ) return 'color';
if ( value.isMatrix3 === true ) return 'mat3';
if ( value.isMatrix4 === true ) return 'mat4';

};

const ConvertType = function ( type, cacheMap = null ) {

return ( ...params ) => {
Expand All @@ -295,7 +281,7 @@ const ConvertType = function ( type, cacheMap = null ) {

if ( nodes.length === 1 ) {

return nodeObject( nodes[ 0 ].nodeType === type || getTypeFromInputNode( nodes[ 0 ] ) === type ? nodes[ 0 ] : new ConvertNode( nodes[ 0 ], type ) );
return nodeObject( nodes[ 0 ].nodeType === type || getValueType( nodes[ 0 ].value ) === type ? nodes[ 0 ] : new ConvertNode( nodes[ 0 ], type ) );

}

Expand Down

0 comments on commit 0923c2e

Please sign in to comment.