浏览代码

Fix nme UI

David Catuhe 5 年之前
父节点
当前提交
a93c254985

+ 6 - 6
nodeEditor/src/diagram/properties/texturePropertyTabComponent.tsx

@@ -183,6 +183,12 @@ export class TexturePropertyTabComponent extends React.Component<IPropertyCompon
                         this.props.globalState.onUpdateRequiredObservable.notifyObservers();
                     }}/> 
                     {
+                        texture && !isInReflectionMode &&
+                        <CheckBoxLineComponent label="Convert to gamma space" propertyName="convertToGammaSpace" target={this.props.block} onValueChanged={() => {                        
+                            this.props.globalState.onUpdateRequiredObservable.notifyObservers();
+                        }}/>
+                    }
+                    {
                         texture && isInReflectionMode &&
                         <OptionsLineComponent label="Reflection mode" options={reflectionModeOptions} target={texture} propertyName="coordinatesMode" onSelect={(value: any) => {
                             texture.coordinatesMode = value;
@@ -192,12 +198,6 @@ export class TexturePropertyTabComponent extends React.Component<IPropertyCompon
                     }                    
                     {
                         texture && !isInReflectionMode &&
-                        <CheckBoxLineComponent label="Gamma space" propertyName="gammaSpace" target={texture} onValueChanged={() => {                        
-                            this.props.globalState.onUpdateRequiredObservable.notifyObservers();
-                        }}/>
-                    }
-                    {
-                        texture && !isInReflectionMode &&
                         <CheckBoxLineComponent label="Clamp U" isSelected={() => texture.wrapU === Texture.CLAMP_ADDRESSMODE} onSelect={(value) => {
                             texture.wrapU = value ? Texture.CLAMP_ADDRESSMODE : Texture.WRAP_ADDRESSMODE;
                             this.props.globalState.onUpdateRequiredObservable.notifyObservers();

+ 7 - 2
src/Materials/Node/Blocks/Dual/textureBlock.ts

@@ -35,6 +35,11 @@ export class TextureBlock extends NodeMaterialBlock {
     public texture: Nullable<Texture>;
 
     /**
+     * Gets or sets a boolean indicating if content needs to be converted to gamma space
+     */
+    public convertToGammaSpace = false;
+
+    /**
      * Create a new TextureBlock
      * @param name defines the block name
      */
@@ -183,7 +188,7 @@ export class TextureBlock extends NodeMaterialBlock {
             return;
         }
 
-        defines.setValue(this._linearDefineName, !this.texture.gammaSpace);
+        defines.setValue(this._linearDefineName, this.convertToGammaSpace);
         if (this._isMixed) {
             if (!this.texture.getTextureMatrix().isIdentityAs3x2()) {
                 defines.setValue(this._defineName, true);
@@ -381,7 +386,7 @@ export class TextureBlock extends NodeMaterialBlock {
         codeString += `${this._codeVariableName}.texture.vOffset = ${this.texture.vOffset};\r\n`;
         codeString += `${this._codeVariableName}.texture.uScale = ${this.texture.uScale};\r\n`;
         codeString += `${this._codeVariableName}.texture.vScale = ${this.texture.vScale};\r\n`;
-        codeString += `${this._codeVariableName}.texture.gammaSpace = ${this.texture.gammaSpace};\r\n`;
+        codeString += `${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\r\n`;
 
         return codeString;
     }