Ver código fonte

Add support for double-sided materials

Gary Hsu 8 anos atrás
pai
commit
1504969450

+ 5 - 0
loaders/src/glTF/babylon.glTFFileLoader.ts

@@ -966,6 +966,11 @@ module BABYLON {
                     material.babylonMaterial.emissiveTexture = babylonTexture;
                 }, () => Tools.Warn("Failed to load normal texture"));
             }
+
+            if (material.doubleSided) {
+                material.babylonMaterial.backFaceCulling = false;
+                material.babylonMaterial.twoSidedLighting = true;
+            }
         }
 
         public static LoadAlphaProperties(runtime: IGLTFRuntime, material: IGLTFMaterial): void {

+ 1 - 0
loaders/src/glTF/babylon.glTFFileLoaderInterfaces.ts

@@ -212,6 +212,7 @@ module BABYLON {
         emissiveFactor?: number[];
         alphaMode?: string;
         alphaCutoff: number;
+        doubleSided?: boolean;
 
         // Babylon.js values (optimize)
         babylonMaterial?: PBRMaterial;