Przeglądaj źródła

Merge pull request #9699 from jasonsturges/doc/lights

Lights documentation
sebavan 4 lat temu
rodzic
commit
af4f3bb2db

+ 18 - 18
src/Lights/Shadows/shadowGenerator.ts

@@ -47,7 +47,7 @@ export interface ICustomShaderOptions {
     attributes?: string[];
 
     /**
-     * The list of unifrom names used in the shader
+     * The list of uniform names used in the shader
      */
     uniforms?: string[];
 
@@ -75,9 +75,9 @@ export interface IShadowGenerator {
     getShadowMap(): Nullable<RenderTargetTexture>;
 
     /**
-     * Determine wheter the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).
+     * Determine whether the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).
      * @param subMesh The submesh we want to render in the shadow map
-     * @param useInstances Defines wether will draw in the map using instances
+     * @param useInstances Defines whether will draw in the map using instances
      * @param isTransparent Indicates that isReady is called for a transparent subMesh
      * @returns true if ready otherwise, false
      */
@@ -92,14 +92,14 @@ export interface IShadowGenerator {
     /**
      * Binds the shadow related information inside of an effect (information like near, far, darkness...
      * defined in the generator but impacting the effect).
-     * It implies the unifroms available on the materials are the standard BJS ones.
+     * It implies the uniforms available on the materials are the standard BJS ones.
      * @param lightIndex Index of the light in the enabled light list of the material owning the effect
-     * @param effect The effect we are binfing the information for
+     * @param effect The effect we are binding the information for
      */
     bindShadowLight(lightIndex: string, effect: Effect): void;
     /**
      * Gets the transformation matrix used to project the meshes into the map from the light point of view.
-     * (eq to shadow prjection matrix * light transform matrix)
+     * (eq to shadow projection matrix * light transform matrix)
      * @returns The transform matrix used to create the shadow map
      */
     getTransformMatrix(): Matrix;
@@ -111,14 +111,14 @@ export interface IShadowGenerator {
     recreateShadowMap(): void;
 
     /**
-     * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.
+     * Forces all the attached effect to compile to enable rendering only once ready vs. lazily compiling effects.
      * @param onCompiled Callback triggered at the and of the effects compilation
      * @param options Sets of optional options forcing the compilation with different modes
      */
     forceCompilation(onCompiled?: (generator: IShadowGenerator) => void, options?: Partial<{ useInstances: boolean }>): void;
 
     /**
-     * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.
+     * Forces all the attached effect to compile to enable rendering only once ready vs. lazily compiling effects.
      * @param options Sets of optional options forcing the compilation with different modes
      * @returns A promise that resolves when the compilation completes
      */
@@ -269,13 +269,13 @@ export class ShadowGenerator implements IShadowGenerator {
 
     protected _normalBias = 0;
     /**
-     * Gets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle).
+     * Gets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportional to the light/normal angle).
      */
     public get normalBias(): number {
         return this._normalBias;
     }
     /**
-     * Sets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle).
+     * Sets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportional to the light/normal angle).
      */
     public set normalBias(normalBias: number) {
         this._normalBias = normalBias;
@@ -908,7 +908,7 @@ export class ShadowGenerator implements IShadowGenerator {
         // Custom render function.
         this._shadowMap.customRenderFunction = this._renderForShadowMap.bind(this);
 
-        // Force the mesh is ready funcion to true as we are double checking it
+        // Force the mesh is ready function to true as we are double checking it
         // in the custom render function. Also it prevents side effects and useless
         // shader variations in DEPTHPREPASS mode.
         this._shadowMap.customIsReadyFunction = (m: AbstractMesh, r: number) => {
@@ -931,7 +931,7 @@ export class ShadowGenerator implements IShadowGenerator {
             this._scene.setTransformMatrix(this._viewMatrix, this._projectionMatrix);
         });
 
-        // Blur if required afer render.
+        // Blur if required after render.
         this._shadowMap.onAfterUnbindObservable.add(() => {
             this._scene.updateTransformMatrix(); // restore the view/projection matrices of the active camera
 
@@ -1222,7 +1222,7 @@ export class ShadowGenerator implements IShadowGenerator {
     }
 
     /**
-     * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.
+     * Forces all the attached effect to compile to enable rendering only once ready vs. lazily compiling effects.
      * @param onCompiled Callback triggered at the and of the effects compilation
      * @param options Sets of optional options forcing the compilation with different modes
      */
@@ -1282,7 +1282,7 @@ export class ShadowGenerator implements IShadowGenerator {
     }
 
     /**
-     * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.
+     * Forces all the attached effect to compile to enable rendering only once ready vs. lazily compiling effects.
      * @param options Sets of optional options forcing the compilation with different modes
      * @returns A promise that resolves when the compilation completes
      */
@@ -1322,9 +1322,9 @@ export class ShadowGenerator implements IShadowGenerator {
     }
 
     /**
-     * Determine wheter the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).
+     * Determine whether the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).
      * @param subMesh The submesh we want to render in the shadow map
-     * @param useInstances Defines wether will draw in the map using instances
+     * @param useInstances Defines whether will draw in the map using instances
      * @param isTransparent Indicates that isReady is called for a transparent subMesh
      * @returns true if ready otherwise, false
      */
@@ -1593,7 +1593,7 @@ export class ShadowGenerator implements IShadowGenerator {
      * Binds the shadow related information inside of an effect (information like near, far, darkness...
      * defined in the generator but impacting the effect).
      * @param lightIndex Index of the light in the enabled light list of the material owning the effect
-     * @param effect The effect we are binfing the information for
+     * @param effect The effect we are binding the information for
      */
     public bindShadowLight(lightIndex: string, effect: Effect): void {
         const light = this._light;
@@ -1638,7 +1638,7 @@ export class ShadowGenerator implements IShadowGenerator {
 
     /**
      * Gets the transformation matrix used to project the meshes into the map from the light point of view.
-     * (eq to shadow prjection matrix * light transform matrix)
+     * (eq to shadow projection matrix * light transform matrix)
      * @returns The transform matrix used to create the shadow map
      */
     public getTransformMatrix(): Matrix {

+ 1 - 1
src/Lights/Shadows/shadowGeneratorSceneComponent.ts

@@ -27,7 +27,7 @@ AbstractScene.AddParser(SceneComponentConstants.NAME_SHADOWGENERATOR, (parsedDat
  */
 export class ShadowGeneratorSceneComponent implements ISceneSerializableComponent {
     /**
-     * The component name helpfull to identify the component in the list of scene components.
+     * The component name helpful to identify the component in the list of scene components.
      */
     public readonly name = SceneComponentConstants.NAME_SHADOWGENERATOR;
 

+ 8 - 8
src/Lights/light.ts

@@ -117,7 +117,7 @@ export abstract class Light extends Node {
     public specular = new Color3(1.0, 1.0, 1.0);
 
     /**
-     * Defines the falloff type for this light. This lets overrriding how punctual light are
+     * Defines the falloff type for this light. This lets overriding how punctual light are
      * falling off base on range or angle.
      * This can be set to any values in Light.FALLOFF_x.
      *
@@ -207,14 +207,14 @@ export abstract class Light extends Node {
     @serialize("shadowEnabled")
     private _shadowEnabled: boolean = true;
     /**
-     * Gets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
+     * Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
      * the current shadow generator.
      */
     public get shadowEnabled(): boolean {
         return this._shadowEnabled;
     }
     /**
-     * Sets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
+     * Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching
      * the current shadow generator.
      */
     public set shadowEnabled(value: boolean) {
@@ -313,7 +313,7 @@ export abstract class Light extends Node {
     }
 
     /**
-     * Shadow generator associted to the light.
+     * Shadow generator associated to the light.
      * @hidden Internal use only.
      */
     public _shadowGenerator: Nullable<IShadowGenerator>;
@@ -329,7 +329,7 @@ export abstract class Light extends Node {
     public _includedOnlyMeshesIds = new Array<string>();
 
     /**
-     * The current light unifom buffer.
+     * The current light uniform buffer.
      * @hidden Internal use only.
      */
     public _uniformBuffer: UniformBuffer;
@@ -339,7 +339,7 @@ export abstract class Light extends Node {
     /**
      * Creates a Light object in the scene.
      * Documentation : https://doc.babylonjs.com/babylon101/lights
-     * @param name The firendly name of the light
+     * @param name The friendly name of the light
      * @param scene The scene the light belongs too
      */
     constructor(name: string, scene: Scene) {
@@ -534,7 +534,7 @@ export abstract class Light extends Node {
      */
     public static CompareLightsPriority(a: Light, b: Light): number {
         //shadow-casting lights have priority over non-shadow-casting lights
-        //the renderPrioirty is a secondary sort criterion
+        //the renderPriority is a secondary sort criterion
         if (a.shadowEnabled !== b.shadowEnabled) {
             return (b.shadowEnabled ? 1 : 0) - (a.shadowEnabled ? 1 : 0);
         }
@@ -845,7 +845,7 @@ export abstract class Light extends Node {
                 break;
 
             case Light.LIGHTTYPEID_HEMISPHERICLIGHT:
-                // No fall off in hemisperic light.
+                // No fall off in hemispheric light.
                 photometricScale = 1.0;
                 break;
         }

+ 1 - 1
src/Lights/pointLight.ts

@@ -95,7 +95,7 @@ export class PointLight extends ShadowLight {
     }
 
     /**
-     * Specifies wether or not the shadowmap should be a cube texture.
+     * Specifies whether or not the shadowmap should be a cube texture.
      * @returns true if the shadowmap needs to be a cube texture.
      */
     public needCube(): boolean {

+ 6 - 6
src/Lights/shadowLight.ts

@@ -7,16 +7,16 @@ import { Light } from "./light";
 import { Axis } from '../Maths/math.axis';
 /**
  * Interface describing all the common properties and methods a shadow light needs to implement.
- * This helps both the shadow generator and materials to genrate the corresponding shadow maps
+ * This helps both the shadow generator and materials to generate the corresponding shadow maps
  * as well as binding the different shadow properties to the effects.
  */
 export interface IShadowLight extends Light {
     /**
-     * The light id in the scene (used in scene.findLighById for instance)
+     * The light id in the scene (used in scene.findLightById for instance)
      */
     id: string;
     /**
-     * The position the shdow will be casted from.
+     * The position the shadow will be casted from.
      */
     position: Vector3;
     /**
@@ -64,7 +64,7 @@ export interface IShadowLight extends Light {
 
     /**
      * Sets the shadow projection matrix in parameter to the generated projection matrix.
-     * @param matrix The materix to updated with the projection information
+     * @param matrix The matrix to updated with the projection information
      * @param viewMatrix The transform matrix of the light
      * @param renderList The list of mesh to render in the map
      * @returns The current light
@@ -118,7 +118,7 @@ export interface IShadowLight extends Light {
 
 /**
  * Base implementation IShadowLight
- * It groups all the common behaviour in order to reduce dupplication and better follow the DRY pattern.
+ * It groups all the common behaviour in order to reduce duplication and better follow the DRY pattern.
  */
 export abstract class ShadowLight extends Light implements IShadowLight {
 
@@ -374,7 +374,7 @@ export abstract class ShadowLight extends Light implements IShadowLight {
 
     /**
      * Sets the shadow projection matrix in parameter to the generated projection matrix.
-     * @param matrix The materix to updated with the projection information
+     * @param matrix The matrix to updated with the projection information
      * @param viewMatrix The transform matrix of the light
      * @param renderList The list of mesh to render in the map
      * @returns The current light

+ 2 - 2
src/Lights/spotLight.ts

@@ -104,7 +104,7 @@ export class SpotLight extends ShadowLight {
 
     private _projectionTextureMatrix = Matrix.Zero();
     /**
-    * Allows reading the projecton texture
+    * Allows reading the projection texture
     */
     public get projectionTextureMatrix(): Matrix {
         return this._projectionTextureMatrix;
@@ -368,7 +368,7 @@ export class SpotLight extends ShadowLight {
     }
 
     /**
-     * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
+     * Sets the passed Effect object with the SpotLight transformed position (or position if not parented) and normalized direction.
      * @param effect The effect to update
      * @param lightIndex The index of the light in the effect to update
      * @returns The spot light

+ 12 - 12
src/Meshes/abstractMesh.ts

@@ -46,8 +46,8 @@ class _FacetDataStorage {
     public facetNormals: Vector3[];               // facet local normals
     public facetPartitioning: number[][];         // partitioning array of facet index arrays
     public facetNb: number = 0;                   // facet number
-    public partitioningSubdivisions: number = 10; // number of subdivisions per axis in the partioning space
-    public partitioningBBoxRatio: number = 1.01;  // the partioning array space is by default 1% bigger than the bounding box
+    public partitioningSubdivisions: number = 10; // number of subdivisions per axis in the partitioning space
+    public partitioningBBoxRatio: number = 1.01;  // the partitioning array space is by default 1% bigger than the bounding box
     public facetDataEnabled: boolean = false;     // is the facet data feature enabled on this mesh ?
     public facetParameters: any = {};             // keep a reference to the object parameters to avoid memory re-allocation
     public bbSize: Vector3 = Vector3.Zero();      // bbox size approximated for facet data
@@ -98,11 +98,11 @@ class _InternalAbstractMeshDataInfo {
 export class AbstractMesh extends TransformNode implements IDisposable, ICullable, IGetSetVerticesData {
     /** No occlusion */
     public static OCCLUSION_TYPE_NONE = 0;
-    /** Occlusion set to optimisitic */
+    /** Occlusion set to optimistic */
     public static OCCLUSION_TYPE_OPTIMISTIC = 1;
     /** Occlusion set to strict */
     public static OCCLUSION_TYPE_STRICT = 2;
-    /** Use an accurante occlusion algorithm */
+    /** Use an accurate occlusion algorithm */
     public static OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;
     /** Use a conservative occlusion algorithm */
     public static OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;
@@ -198,7 +198,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         return this._internalAbstractMeshDataInfo._facetData.facetNb;
     }
     /**
-     * Gets or set the number (integer) of subdivisions per axis in the partioning space
+     * Gets or set the number (integer) of subdivisions per axis in the partitioning space
      * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning
      */
     public get partitioningSubdivisions(): number {
@@ -208,8 +208,8 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = nb;
     }
     /**
-     * The ratio (float) to apply to the bouding box size to set to the partioning space.
-     * Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box
+     * The ratio (float) to apply to the bounding box size to set to the partitioning space.
+     * Ex : 1.01 (default) the partitioning space is 1% bigger than the bounding box
      * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata#tweaking-the-partitioning
      */
     public get partitioningBBoxRatio(): number {
@@ -668,7 +668,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
     public _transformMatrixTexture: Nullable<RawTexture> = null;
 
     /**
-     * Gets or sets a skeleton to apply skining transformations
+     * Gets or sets a skeleton to apply skinning transformations
      * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons
      */
     public set skeleton(value: Nullable<Skeleton>) {
@@ -700,7 +700,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
     public onRebuildObservable = new Observable<AbstractMesh>();
 
     /**
-     * The current mesh unifom buffer.
+     * The current mesh uniform buffer.
      * @hidden Internal use only.
      */
     public _uniformBuffer: UniformBuffer;
@@ -950,7 +950,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
 
     /**
      * Returns a positive integer : the total number of indices in this mesh geometry.
-     * @returns the numner of indices or zero if the mesh has no geometry.
+     * @returns the number of indices or zero if the mesh has no geometry.
      */
     public getTotalIndices(): number {
         return 0;
@@ -1987,7 +1987,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
     }
 
     /**
-     * Returns the facetLocalPartioning array
+     * Returns the facetLocalPartitioning array
      * @returns an array of array of numbers
      * @see https://doc.babylonjs.com/how_to/how_to_use_facetdata
      */
@@ -2093,7 +2093,7 @@ export class AbstractMesh extends TransformNode implements IDisposable, ICullabl
         Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, invMat, invVect);  // transform (x,y,z) to coordinates in the mesh local space
         var closest = this.getClosestFacetAtLocalCoordinates(invVect.x, invVect.y, invVect.z, projected, checkFace, facing);
         if (projected) {
-            // tranform the local computed projected vector to world coordinates
+            // transform the local computed projected vector to world coordinates
             Vector3.TransformCoordinatesFromFloatsToRef(projected.x, projected.y, projected.z, world, projected);
         }
         return closest;