浏览代码

Add getShaderName Function

This will allow PBRMaterial subclasses to specify custom pbr shaders by overriding getShaderName
MackeyK24 6 年之前
父节点
当前提交
31b1f35f5a
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/Materials/PBR/pbrBaseMaterial.ts

+ 8 - 1
src/Materials/PBR/pbrBaseMaterial.ts

@@ -775,6 +775,13 @@ export abstract class PBRBaseMaterial extends PushMaterial {
     }
 
     /**
+     * Gets the name of the material shader.
+     */
+    public getShaderName(): string {
+        return "pbr";
+    }
+
+    /**
      * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.
      */
     @serialize()
@@ -1215,7 +1222,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
         });
 
         var join = defines.toString();
-        return engine.createEffect("pbr", <EffectCreationOptions>{
+        return engine.createEffect(this.getShaderName(), <EffectCreationOptions>{
             attributes: attribs,
             uniformsNames: uniforms,
             uniformBuffersNames: uniformBuffers,