@@ -6,12 +6,14 @@ import { TextureMappingModeProperty } from "../../properties/TextureMappingModeP
66import { UVTransformProperty } from "../../properties/UVTransformProperty" ;
77import { TextureTypeNode } from "./BaseTextureNode" ;
88import { Script } from '../../export/Script' ;
9+ import { TextureColorSpaceProperty } from '../../properties/TextureColorSpaceProperty' ;
910export class ImageTextureNode extends TextureTypeNode {
1011
1112 private imageProp :TextureProperty ;
1213 private uv :UVTransformProperty ;
1314 private extensionPolicy :TextureExtensionProperty ;
1415 private mappingPolicy :TextureMappingModeProperty ;
16+ private colorSpace :TextureColorSpaceProperty ;
1517
1618 constructor ( ) {
1719 super ( "Image Texture" ,
@@ -21,6 +23,7 @@ export class ImageTextureNode extends TextureTypeNode {
2123 new TextureProperty ( ) ,
2224 new TextureExtensionProperty ( ) ,
2325 new TextureMappingModeProperty ( ) ,
26+ new TextureColorSpaceProperty ( ) ,
2427 new UVTransformProperty ( )
2528 ]
2629 ) ;
@@ -29,6 +32,7 @@ export class ImageTextureNode extends TextureTypeNode {
2932 this . uv = this . getChildOfType ( UVTransformProperty ) ! ;
3033 this . extensionPolicy = this . getChildOfType ( TextureExtensionProperty ) ! ;
3134 this . mappingPolicy = this . getChildOfType ( TextureMappingModeProperty ) ! ;
35+ this . colorSpace = this . getChildOfType ( TextureColorSpaceProperty ) ! ;
3236 }
3337
3438 override writeScript ( script : Script ) : string {
@@ -43,9 +47,10 @@ export class ImageTextureNode extends TextureTypeNode {
4347
4448
4549 texture => `
46- ${ texture } .wrapS = ${ this . extensionPolicy . extensionMode } ;
47- ${ texture } .wrapT = ${ this . extensionPolicy . extensionMode } ;
48- ${ texture } .mapping = ${ this . mappingPolicy . mappingType } ;
50+ ${ texture } .wrapS = ${ this . extensionPolicy . value } ;
51+ ${ texture } .wrapT = ${ this . extensionPolicy . value } ;
52+ ${ texture } .mapping = ${ this . mappingPolicy . value } ;
53+ ${ texture } .colorSpace = ${ this . colorSpace . value } ;
4954${ texture } .flipY = false;
5055 `
5156 ) ;
@@ -60,8 +65,9 @@ ${texture}.flipY = false;
6065 return {
6166 ...super . serialize ( ) ,
6267 src : this . imageProp . isFromDisk ? "" : this . imageProp . imageSrc ,
63- extension : this . extensionPolicy . extensionMode ,
64- mapping : this . mappingPolicy . mappingType
68+ extension : this . extensionPolicy . value ,
69+ mapping : this . mappingPolicy . value ,
70+ colorSpace : this . colorSpace . value
6571 }
6672 }
6773
@@ -71,8 +77,9 @@ ${texture}.flipY = false;
7177 if ( data . src != "" )
7278 this . imageProp . src = data . src ;
7379
74- this . extensionPolicy . extensionMode = data . extension ;
75- this . mappingPolicy . mappingType = data . mapping ;
80+ this . extensionPolicy . value = data . extension ;
81+ this . mappingPolicy . value = data . mapping ;
82+ this . colorSpace . value = data . colorSpace ;
7683 }
7784
7885 override onRemoved ( ) : void {
0 commit comments