Browse Source

Make the doc checker happy

Popov72 5 years ago
parent
commit
530405b697

+ 21 - 0
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -241,6 +241,10 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         return code;
     }
 
+    /**
+     * Handles the inits for the fragment code path
+     * @param state node material build state
+     */
     public handleFragmentSideInits(state: NodeMaterialBuildState) {
         state.sharedData.blockingBlocks.push(this);
         state.sharedData.textureBlocks.push(this);
@@ -275,6 +279,11 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         this._reflectionCoordsName = state._getFreeVariableName("reflectionCoords");
     }
 
+    /**
+     * Generates the reflection coords code for the fragment code path
+     * @param worldNormalVarName name of the world normal variable
+     * @returns the shader code
+     */
     public handleFragmentSideCodeReflectionCoords(worldNormalVarName: string): string {
         let worldPos = `v_${this.worldPosition.associatedVariableName}`;
         let reflectionMatrix = this._reflectionMatrixName;
@@ -343,6 +352,12 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         return code;
     }
 
+    /**
+     * Generates the reflection color code for the fragment code path
+     * @param lodVarName name of the lod variable
+     * @param swizzleLookupTexture swizzle to use for the final color variable
+     * @returns the shader code
+     */
     public handleFragmentSideCodeReflectionColor(lodVarName?: string, swizzleLookupTexture = ".rgb"): string {
         const colorType = "vec" + (swizzleLookupTexture.length === 0 ? "4" : (swizzleLookupTexture.length - 1));
 
@@ -377,6 +392,12 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
         return code;
     }
 
+    /**
+     * Generates the code corresponding to the connected output points
+     * @param state node material build state
+     * @param varName name of the variable to output
+     * @returns the shader code
+     */
     public writeOutputs(state: NodeMaterialBuildState, varName: string): string {
         let code = "";
 

+ 1 - 1
src/Materials/Node/Blocks/PBR/ambientOcclusionBlock.ts

@@ -88,7 +88,7 @@ export class AmbientOcclusionBlock extends NodeMaterialBlock {
      * @param block instance of an AmbientOcclusionBlock or null if the code must be generated without an active ambient occlusion module
      * @returns the shader code
      */
-    public static getCode(block: Nullable<AmbientOcclusionBlock>): string {
+    public static GetCode(block: Nullable<AmbientOcclusionBlock>): string {
         let code = `ambientOcclusionOutParams aoOut;\r\n`;
 
         const aoTexture = block?.texture.isConnected ? block.texture.associatedVariableName : "vec3(0.)";

+ 5 - 1
src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts

@@ -673,6 +673,10 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
         }
     }
 
+    /**
+     * Gets the code corresponding to the albedo/opacity module
+     * @returns the shader code
+     */
     public getAlbedoOpacityCode(): string {
         let code = `albedoOpacityOutParams albedoOpacityOut;\r\n`;
 
@@ -818,7 +822,7 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
         // _____________________________ AO  _______________________________
         const aoBlock = this.ambientOcclusion.connectedPoint?.ownerBlock as Nullable<AmbientOcclusionBlock>;
 
-        state.compilationString += AmbientOcclusionBlock.getCode(aoBlock);
+        state.compilationString += AmbientOcclusionBlock.GetCode(aoBlock);
 
         if (this.unlit) {
             state.compilationString += `vec3 diffuseBase = vec3(1., 1., 1.);\r\n`;

+ 26 - 2
src/Materials/Node/Blocks/PBR/sheenBlock.ts

@@ -3,13 +3,16 @@ import { NodeMaterialBlockConnectionPointTypes } from '../../Enums/nodeMaterialB
 import { NodeMaterialBuildState } from '../../nodeMaterialBuildState';
 import { NodeMaterialConnectionPoint, NodeMaterialConnectionPointDirection } from '../../nodeMaterialBlockConnectionPoint';
 import { NodeMaterialBlockTargets } from '../../Enums/nodeMaterialBlockTargets';
-//import { Nullable } from "../../../../types";
 import { _TypeStore } from '../../../../Misc/typeStore';
 import { editableInPropertyPage } from "../../nodeMaterialDecorator";
 import { NodeMaterialConnectionPointCustomObject } from "../../nodeMaterialConnectionPointCustomObject";
 
 export class SheenBlock extends NodeMaterialBlock {
 
+    /**
+     * Create a new SheenBlock
+     * @param name defines the block name
+     */
     public constructor(name: string) {
         super(name, NodeMaterialBlockTargets.Fragment);
 
@@ -20,9 +23,15 @@ export class SheenBlock extends NodeMaterialBlock {
         this.registerInput("color", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);
         this.registerInput("roughness", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);
 
-        this.registerOutput("sheen", NodeMaterialBlockConnectionPointTypes.Object, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject("sheen", this, NodeMaterialConnectionPointDirection.Output, SheenBlock, "SheenBlock"));
+        this.registerOutput("sheen", NodeMaterialBlockConnectionPointTypes.Object, NodeMaterialBlockTargets.Fragment,
+            new NodeMaterialConnectionPointCustomObject("sheen", this, NodeMaterialConnectionPointDirection.Output, SheenBlock, "SheenBlock"));
     }
 
+    /**
+     * If true, the sheen effect is layered above the base BRDF with the albedo-scaling technique.
+     * It allows the strength of the sheen effect to not depend on the base color of the material,
+     * making it easier to setup and tweak the effect
+     */
     @editableInPropertyPage("Albedo scaling")
     public albedoScaling: boolean = false;
 
@@ -34,22 +43,37 @@ export class SheenBlock extends NodeMaterialBlock {
         return "SheenBlock";
     }
 
+    /**
+     * Gets the texture input component
+     */
     public get texture(): NodeMaterialConnectionPoint {
         return this._inputs[0];
     }
 
+    /**
+     * Gets the intensity input component
+     */
     public get intensity(): NodeMaterialConnectionPoint {
         return this._inputs[1];
     }
 
+    /**
+     * Gets the color input component
+     */
     public get color(): NodeMaterialConnectionPoint {
         return this._inputs[2];
     }
 
+    /**
+     * Gets the roughness input component
+     */
     public get roughness(): NodeMaterialConnectionPoint {
         return this._inputs[3];
     }
 
+    /**
+     * Gets the sheen object output component
+     */
     public get sheen(): NodeMaterialConnectionPoint {
         return this._outputs[0];
     }

+ 1 - 0
src/Materials/Node/nodeMaterialBlock.ts

@@ -172,6 +172,7 @@ export class NodeMaterialBlock {
      * @param effect defines the effect to bind data to
      * @param nodeMaterial defines the hosting NodeMaterial
      * @param mesh defines the mesh that will be rendered
+     * @param submesh defines the submesh that will be rendered
      */
     public bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh, subMesh?: SubMesh) {
         // Do nothing

+ 31 - 0
src/Materials/Node/nodeMaterialDecorator.ts

@@ -1,33 +1,64 @@
+/**
+ * Enum defining the type of properties that can be edited in the property pages in the NME
+ */
 export enum PropertyTypeForEdition {
+    /** property is a boolean */
     Boolean,
+    /** property is a float */
     Float,
+    /** property is a Vector2 */
     Vector2,
+    /** property is a list of values */
     List,
 }
 
+/**
+ * Interface that defines an option in a variable of type list
+ */
 export interface IEditablePropertyListOption {
+    /** label of the option */
     "label": string;
+    /** value of the option */
     "value": number;
 }
 
+/**
+ * Interface that defines the options available for an editable property
+ */
 export interface IEditablePropertyOption {
+    /** min value */
     "min"?: number;
+    /** max value */
     "max"?: number;
+    /** notifiers: indicates which actions to take when the property is changed */
     "notifiers"?: {
+        /** the material should be rebuilt */
         "rebuild"?: boolean;
+        /** the preview should be updated */
         "update"?: boolean;
     };
     "options"?: IEditablePropertyListOption[];
 }
 
+/**
+ * Interface that describes an editable property
+ */
 export interface IPropertyDescriptionForEdition {
+    /** name of the property */
     "propertyName": string;
+    /** display name of the property */
     "displayName": string;
+    /** type of the property */
     "type": PropertyTypeForEdition;
+    /** group of the property - all properties with the same group value will be displayed in a specific section */
     "groupName": string;
+    /** options for the property */
     "options": IEditablePropertyOption;
 }
 
+/**
+ * Decorator that flags a property in a node material block as being editable
+ */
 export function editableInPropertyPage(displayName: string, propertyType: PropertyTypeForEdition = PropertyTypeForEdition.Boolean, groupName: string = "PROPERTIES", options?: IEditablePropertyOption) {
     return (target: any, propertyKey: string) => {
         let propStore: IPropertyDescriptionForEdition[] = target._propStore;

+ 1 - 0
src/Materials/materialHelper.ts

@@ -31,6 +31,7 @@ export class MaterialHelper {
      * Bind the current view position to an effect.
      * @param effect The effect to be bound
      * @param scene The scene the eyes position is used from
+     * @param variableName name of the shader variable that will hold the eye position
      */
     public static BindEyePosition(effect: Effect, scene: Scene, variableName = "vEyePosition"): void {
         if (scene._forcedViewPosition) {