@@ -6,7 +6,7 @@ import { InputOrValue } from '../../properties/InputOrValue';
66import { WinNode } from '../WinNode' ;
77import { Script } from '../../export/Script' ;
88import { Output } from '../../properties/Output' ;
9- import { DataType } from '../../core/IOutlet' ;
9+ import { DataType , IDataType } from '../../core/IOutlet' ;
1010
1111export class NormalMapNode extends WinNode {
1212 protected typeCombo : ComboBox ;
@@ -47,11 +47,15 @@ export class NormalMapNode extends WinNode {
4747 this . update ( ) ;
4848 }
4949
50+ override get nodeDataType ( ) : IDataType | undefined {
51+ return DataType . vec2 ;
52+ }
53+
5054 protected override writeNodeScript ( script : Script ) : string {
5155 script . importModule ( 'normalMap' ) ;
5256
53- let map = this . color . writeScript ( script ) ;
54- let strength = this . strength . value ;
57+ const map = this . color . writeScript ( script ) ;
58+ const strength = this . strength . value ;
5559
5660 let node = `
5761const normalNode = normalMap( ${ map } , ${ strength } );
@@ -73,4 +77,20 @@ normalNode.normalMapType = THREE.ObjectSpaceNormalMap;
7377 true ,
7478 ) ;
7579 }
80+
81+ override serialize ( ) : Record < string , any > {
82+ return {
83+ ...super . serialize ( ) ,
84+ normalType : this . typeCombo . index ,
85+ strength : this . strength . value ,
86+ color : this . color . baseColor . getHex ( )
87+ }
88+ }
89+
90+ override unserialize ( data : Record < string , any > ) : void {
91+ super . unserialize ( data ) ;
92+ this . typeCombo . index = data . normalType ;
93+ this . strength . value = data . strength ;
94+ this . color . baseColor = new Color ( data . color ) ;
95+ }
7696}
0 commit comments