Pārlūkot izejas kodu

Merge pull request #9550 from Popov72/fix-nodemat-pbr

NME: fix serialization of textures that are render target
David Catuhe 4 gadi atpakaļ
vecāks
revīzija
c1f3de6c00

+ 1 - 1
src/Materials/Node/Blocks/Dual/currentScreenBlock.ts

@@ -282,7 +282,7 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
 
         serializationObject.convertToGammaSpace = this.convertToGammaSpace;
         serializationObject.convertToLinearSpace = this.convertToLinearSpace;
-        if (this.texture) {
+        if (this.texture && !this.texture.isRenderTarget) {
             serializationObject.texture = this.texture.serialize();
         }
 

+ 1 - 1
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -440,7 +440,7 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
     public serialize(): any {
         let serializationObject = super.serialize();
 
-        if (this.texture) {
+        if (this.texture && !this.texture.isRenderTarget) {
             serializationObject.texture = this.texture.serialize();
         }
 

+ 1 - 1
src/Materials/Node/Blocks/PBR/reflectionBlock.ts

@@ -428,7 +428,7 @@ export class ReflectionBlock extends ReflectionTextureBaseBlock {
         let codeString: string = super._dumpPropertiesCode();
 
         if (this.texture) {
-            codeString += `${this._codeVariableName}.texture.gammaSpace = ${this.texture.gammaSpace});\r\n`;
+            codeString += `${this._codeVariableName}.texture.gammaSpace = ${this.texture.gammaSpace};\r\n`;
         }
         codeString += `${this._codeVariableName}.useSphericalHarmonics = ${this.useSphericalHarmonics};\r\n`;
         codeString += `${this._codeVariableName}.forceIrradianceInFragment = ${this.forceIrradianceInFragment};\r\n`;

+ 1 - 1
src/Materials/Node/Blocks/PBR/refractionBlock.ts

@@ -324,7 +324,7 @@ export class RefractionBlock extends NodeMaterialBlock {
     public serialize(): any {
         let serializationObject = super.serialize();
 
-        if (this.texture) {
+        if (this.texture && !this.texture.isRenderTarget) {
             serializationObject.texture = this.texture.serialize();
         }
 

+ 1 - 1
src/Materials/Node/Blocks/Particle/particleTextureBlock.ts

@@ -200,7 +200,7 @@ export class ParticleTextureBlock extends NodeMaterialBlock {
 
         serializationObject.convertToGammaSpace = this.convertToGammaSpace;
         serializationObject.convertToLinearSpace = this.convertToLinearSpace;
-        if (this.texture) {
+        if (this.texture && !this.texture.isRenderTarget) {
             serializationObject.texture = this.texture.serialize();
         }