Pārlūkot izejas kodu

light .lightmapMode

0 = deafult lightmap mode
1 = exclude light from lightmap, use lightmap as diffuse light. blends
dynamic shadows with shadows on lightmap + ligt specular
2 = same as 1 plus no lspecular. no light calculation, only the lightmap
+ dynamic shadows.
László Matuska 9 gadi atpakaļ
vecāks
revīzija
0d0c14bb92
2 mainītis faili ar 15 papildinājumiem un 20 dzēšanām
  1. 1 4
      src/Lights/babylon.light.ts
  2. 14 16
      src/Materials/babylon.materialHelper.ts

+ 1 - 4
src/Lights/babylon.light.ts

@@ -43,10 +43,7 @@
         public excludeWithLayerMask = 0;
 
         @serialize()
-        public lightmapExcluded = false;
-
-        @serialize()
-        public lightmapNoSpecular = false;
+        public lightmapMode = 0;
 
         // PBR Properties.
         @serialize()

+ 14 - 16
src/Materials/babylon.materialHelper.ts

@@ -5,7 +5,7 @@
             var needNormals = false;
             var needRebuild = false;
             var needShadows = false;
-            var lightmapExcluded = false;
+            var lightmapMode = false;
 
             for (var index = 0; index < scene.lights.length; index++) {
                 var light = scene.lights[index];
@@ -104,21 +104,19 @@
                     }
                 }
 
-                //lightmapExcluded
-                if (defines["LIGHTMAPEXCLUDED" + lightIndex] === undefined) {
-                    needRebuild = true;
-                }
-                defines["LIGHTMAPEXCLUDED" + lightIndex] = light.lightmapExcluded;
-                if (light.lightmapExcluded) {
-                    lightmapExcluded = true;
-                }
-
-                //lightmapNoSpecular
-                if (defines["LIGHTMAPNOSPECULAR" + lightIndex] === undefined) {
-                    needRebuild = true;
+                if (light.lightmapMode != 0 ) {
+                    lightmapMode = true;
+                    if (defines["LIGHTMAPEXCLUDED" + lightIndex] === undefined) {
+                        needRebuild = true;
+                    }
+                    if (defines["LIGHTMAPNOSPECULAR" + lightIndex] === undefined) {
+                        needRebuild = true;
+                    }
+                    defines["LIGHTMAPEXCLUDED" + lightIndex] = true;
+                    if (light.lightmapMode == 2) {
+                        defines["LIGHTMAPNOSPECULAR" + lightIndex] = true;
+                    }
                 }
-                defines["LIGHTMAPNOSPECULAR" + lightIndex] = light.lightmapNoSpecular;
-
 
                 lightIndex++;
                 if (lightIndex === maxSimultaneousLights)
@@ -137,7 +135,7 @@
             if (defines["LIGHTMAPEXCLUDED"] === undefined) {
                 needRebuild = true;
             }
-            if (lightmapExcluded) {
+            if (lightmapMode) {
                 defines["LIGHTMAPEXCLUDED"] = true;
             }