浏览代码

Add alpha as an output

Popov72 5 年之前
父节点
当前提交
22d8052231
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts

+ 9 - 0
src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts

@@ -39,6 +39,7 @@ const mapOutputToVariable: { [name: string] : [string, string] } = {
     "refraction":   ["subSurfaceOut.finalRefraction",               "!defined(UNLIT) && defined(SS_REFRACTION)"],
     "lighting":     ["finalColor", ""],
     "shadow":       ["shadow", ""],
+    "alpha":        ["alpha", ""],
 };
 
 /**
@@ -97,6 +98,7 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
         this.registerOutput("refraction", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);
         this.registerOutput("lighting", NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockTargets.Fragment);
         this.registerOutput("shadow", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
+        this.registerOutput("alpha", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);
     }
 
     /**
@@ -503,6 +505,13 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
         return this._outputs[11];
     }
 
+    /**
+     * Gets the alpha output component
+     */
+    public get alpha(): NodeMaterialConnectionPoint {
+        return this._outputs[12];
+    }
+
     public autoConfigure(material: NodeMaterial) {
         if (!this.cameraPosition.isConnected) {
             let cameraPositionInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.CameraPosition);