Parcourir la source

Fix name of defines

Popov72 il y a 5 ans
Parent
commit
6d4a437896

+ 22 - 10
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -22,22 +22,34 @@ import { Texture } from '../../../Textures/texture';
  * Block used to read a reflection texture from a sampler
  */
 export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
+    /** @hidden */
     public _define3DName: string;
-    protected _defineCubicName: string;
-    protected _defineExplicitName: string;
-    protected _defineProjectionName: string;
-    protected _defineLocalCubicName: string;
-    protected _defineSphericalName: string;
-    protected _definePlanarName: string;
-    protected _defineEquirectangularName: string;
-    protected _defineMirroredEquirectangularFixedName: string;
-    protected _defineEquirectangularFixedName: string;
-    protected _defineSkyboxName: string;
+    /** @hidden */
+    public _defineCubicName: string;
+    /** @hidden */
+    public _defineExplicitName: string;
+    /** @hidden */
+    public _defineProjectionName: string;
+    /** @hidden */
+    public _defineLocalCubicName: string;
+    /** @hidden */
+    public _defineSphericalName: string;
+    /** @hidden */
+    public _definePlanarName: string;
+    /** @hidden */
+    public _defineEquirectangularName: string;
+    /** @hidden */
+    public _defineMirroredEquirectangularFixedName: string;
+    /** @hidden */
+    public _defineEquirectangularFixedName: string;
+    /** @hidden */
+    public _defineSkyboxName: string;
     protected _cubeSamplerName: string;
     protected _2DSamplerName: string;
     protected _positionUVWName: string;
     protected _directionWName: string;
     protected _reflectionVectorName: string;
+    /** @hidden */
     public _reflectionCoordsName: string;
     protected _reflectionMatrixName: string;
     protected _reflectionColorName: string;

+ 12 - 2
src/Materials/Node/Blocks/Fragment/PBR/pbrMetallicRoughnessBlock.ts

@@ -649,7 +649,12 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
         state.compilationString += (this.reflectivityParams.connectedPoint?.ownerBlock as Nullable<ReflectivityBlock>)?.getCode(aoIntensity) ?? "";
 
         // _____________________________ Geometry info _________________________________
-        state.compilationString += state._emitCodeFromInclude("pbrBlockGeometryInfo", comments);
+        state.compilationString += state._emitCodeFromInclude("pbrBlockGeometryInfo", comments, {
+            replaceStrings: [
+                { search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
+                { search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
+            ]
+        });
 
         // _____________________________ Anisotropy _______________________________________
         const anisotropyBlock = this.anisotropyParams.isConnected ? this.anisotropyParams.connectedPoint?.ownerBlock as AnisotropyBlock : null;
@@ -707,7 +712,12 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
             #endif\r\n`;
 
         // _________________________ Specular Environment Reflectance __________________________
-        state.compilationString += state._emitCodeFromInclude("pbrBlockReflectance", comments);
+        state.compilationString += state._emitCodeFromInclude("pbrBlockReflectance", comments, {
+            replaceStrings: [
+                { search: /REFLECTIONMAP_SKYBOX/g, replace: reflectionBlock?._defineSkyboxName ?? "REFLECTIONMAP_SKYBOX" },
+                { search: /REFLECTIONMAP_3D/g, replace: reflectionBlock?._define3DName ?? "REFLECTIONMAP_3D" },
+            ]
+        });
 
         // ___________________________________ SubSurface ______________________________________
         state.compilationString += `subSurfaceOutParams subSurfaceOut;