未验证 提交 6ccadd10 编写于 作者: L LeviPesin 提交者: GitHub

Add type conversions in ShaderNode (#23544)

* Add type conversions to float, int, and color

* update code style
Co-authored-by: Nsunag <jcdeconto@igalia.com>
上级 31df72c8
......@@ -195,18 +195,36 @@ export const nodeObject = ( val ) => {
export const float = ( val ) => {
if ( val?.isNode === true ) {
return nodeObject( new ConvertNode( val, 'float' ) );
}
return nodeObject( new FloatNode( val ).setConst( true ) );
};
export const int = ( val ) => {
if ( val?.isNode === true ) {
return nodeObject( new ConvertNode( val, 'int' ) );
}
return nodeObject( new IntNode( val ).setConst( true ) );
};
export const color = ( ...params ) => {
if ( params[ 0 ]?.isNode === true ) {
return nodeObject( new ConvertNode( params[0], 'color' ) );
}
return nodeObject( new ColorNode( new Color( ...params ) ).setConst( true ) );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册