فهرست منبع

shadow on transparent meshes

Clément Levasseur 11 سال پیش
والد
کامیت
0f62fedca7
1فایلهای تغییر یافته به همراه14 افزوده شده و 1 حذف شده
  1. 14 1
      Babylon/Lights/Shadows/babylon.shadowGenerator.js

+ 14 - 1
Babylon/Lights/Shadows/babylon.shadowGenerator.js

@@ -17,6 +17,9 @@ var BABYLON = BABYLON || {};
 
         // Darkness
         this._darkness = 0.;
+
+        // Darkness
+        this._transparencyShadow = false;        
                 
         // Custom render function
         var that = this;
@@ -45,7 +48,7 @@ var BABYLON = BABYLON || {};
             }
         };
 
-        this._shadowMap.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes) {
+        this._shadowMap.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes) {
             var index;
             
             for (index = 0; index < opaqueSubMeshes.length; index++) {
@@ -55,6 +58,12 @@ var BABYLON = BABYLON || {};
             for (index = 0; index < alphaTestSubMeshes.length; index++) {
                 renderSubMesh(alphaTestSubMeshes.data[index]);
             }
+
+            if (that._transparencyShadow) {
+                for (index = 0; index < transparentSubMeshes.length; index++) {
+                    renderSubMesh(transparentSubMeshes.data[index]);
+                }                
+            }
         };
         
         // Internals
@@ -142,6 +151,10 @@ var BABYLON = BABYLON || {};
             this._darkness = darkness;
     };
 
+    BABYLON.ShadowGenerator.prototype.setTransparencyShadow = function (hasShadow) {
+        this._transparencyShadow = hasShadow;
+    };
+
     BABYLON.ShadowGenerator.prototype.dispose = function() {
         this._shadowMap.dispose();
     };