Browse Source

Trigonometry shortcuts #6012

David Catuhe 6 years ago
parent
commit
d8987e2630

+ 4 - 0
Playground/babylon.d.txt

@@ -58336,6 +58336,10 @@ declare module BABYLON {
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */

+ 4 - 0
dist/preview release/babylon.d.ts

@@ -59199,6 +59199,10 @@ declare module BABYLON {
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 59 - 52
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 8 - 0
dist/preview release/babylon.module.d.ts

@@ -62287,6 +62287,10 @@ declare module "babylonjs/PostProcesses/RenderPipeline/Pipelines/standardRenderi
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */
@@ -124105,6 +124109,10 @@ declare module BABYLON {
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */

+ 4 - 0
dist/preview release/documentation.d.ts

@@ -59199,6 +59199,10 @@ declare module BABYLON {
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */

File diff suppressed because it is too large
+ 6 - 6
dist/preview release/nodeEditor/babylon.nodeEditor.js


+ 42 - 2
dist/preview release/nodeEditor/babylon.nodeEditor.max.js

@@ -62211,6 +62211,46 @@ var BlockTools = /** @class */ (function () {
                 return new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["SubtractBlock"]("Subtract");
             case "StepBlock":
                 return new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["StepBlock"]("Step");
+            case "CosBlock": {
+                var cosBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Cos");
+                cosBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Cos;
+                return cosBlock;
+            }
+            case "SinBlock": {
+                var sinBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Sin");
+                sinBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Sin;
+                return sinBlock;
+            }
+            case "AbsBlock": {
+                var absBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Abs");
+                absBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Abs;
+                return absBlock;
+            }
+            case "ExpBlock": {
+                var expBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Exp");
+                expBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Exp;
+                return expBlock;
+            }
+            case "Exp2Block": {
+                var exp2Block = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Exp2");
+                exp2Block.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Exp2;
+                return exp2Block;
+            }
+            case "RoundBlock": {
+                var roundBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Round");
+                roundBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Round;
+                return roundBlock;
+            }
+            case "CeilingBlock": {
+                var ceilingBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Ceiling");
+                ceilingBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Ceiling;
+                return ceilingBlock;
+            }
+            case "FloorBlock": {
+                var floorBlock = new babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlock"]("Floor");
+                floorBlock.operation = babylonjs_Materials_Node_Blocks_Fragment_alphaTestBlock__WEBPACK_IMPORTED_MODULE_0__["TrigonometryBlockOperations"].Floor;
+                return floorBlock;
+            }
         }
         return null;
     };
@@ -64422,10 +64462,10 @@ var NodeListComponent = /** @class */ (function (_super) {
             Output_Blocks: ["VertexOutputBlock", "FragmentOutputBlock", "AlphaTestBlock"],
             Interpolation: ["LerpBlock"],
             Range: ["ClampBlock", "RemapBlock", "NormalizeBlock"],
-            Round: ["StepBlock"],
+            Round: ["StepBlock", "RoundBlock", "CeilingBlock", "FloorBlock"],
             Vector_Math: ["CrossBlock", "DotBlock", "TransformBlock", "FresnelBlock"],
             Basic_Math: ["AddBlock", "DivideBlock", "MultiplyBlock", "ScaleBlock", "SubtractBlock"],
-            Trigonometry: [],
+            Trigonometry: ["CosBlock", "SinBlock", "AbsBlock", "ExpBlock", "Exp2Block"],
             Conversion_Blocks: ["ColorMergerBlock", "ColorSplitterBlock", "VectorMergerBlock", "VectorSplitterBlock"],
             Mesh_Attributes: ["InstancesBlock"],
             Matrices: ["Matrix"],

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/nodeEditor/babylon.nodeEditor.max.js.map


+ 2 - 2
dist/preview release/serializers/babylon.glTF2Serializer.js

@@ -1215,7 +1215,7 @@ var _Exporter = /** @class */ (function () {
         this._samplers = [];
         this._animations = [];
         this._imageData = {};
-        this._convertToRightHandedSystem = this._babylonScene.useRightHandedSystem ? false : true;
+        this._convertToRightHandedSystem = !this._babylonScene.useRightHandedSystem;
         this._options = options || {};
         this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
         this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_1__["_GLTFMaterialExporter"](this);
@@ -2159,7 +2159,7 @@ var _Exporter = /** @class */ (function () {
                         meshPrimitive.indices = this._accessors.length - 1;
                     }
                     if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
-                        var sideOrientation = bufferMesh.overrideMaterialSideOrientation || babylonMaterial.sideOrientation;
+                        var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
                         // Only reverse the winding if we have a clockwise winding
                         if (sideOrientation === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Material"].ClockWiseSideOrientation) {
                             var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


+ 2 - 2
dist/preview release/serializers/babylonjs.serializers.js

@@ -1393,7 +1393,7 @@ var _Exporter = /** @class */ (function () {
         this._samplers = [];
         this._animations = [];
         this._imageData = {};
-        this._convertToRightHandedSystem = this._babylonScene.useRightHandedSystem ? false : true;
+        this._convertToRightHandedSystem = !this._babylonScene.useRightHandedSystem;
         this._options = options || {};
         this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
         this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_1__["_GLTFMaterialExporter"](this);
@@ -2337,7 +2337,7 @@ var _Exporter = /** @class */ (function () {
                         meshPrimitive.indices = this._accessors.length - 1;
                     }
                     if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
-                        var sideOrientation = bufferMesh.overrideMaterialSideOrientation || babylonMaterial.sideOrientation;
+                        var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
                         // Only reverse the winding if we have a clockwise winding
                         if (sideOrientation === babylonjs_Maths_math__WEBPACK_IMPORTED_MODULE_0__["Material"].ClockWiseSideOrientation) {
                             var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.js.map


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


+ 8 - 0
dist/preview release/viewer/babylon.module.d.ts

@@ -62287,6 +62287,10 @@ declare module "babylonjs/PostProcesses/RenderPipeline/Pipelines/standardRenderi
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */
@@ -124105,6 +124109,10 @@ declare module BABYLON {
          */
         lensFlareDistortionStrength: number;
         /**
+         * Configures the blur intensity used for for lens flare (halo)
+         */
+        lensFlareBlurWidth: number;
+        /**
          * Lens star texture must be used to simulate rays on the flares and is available
          * in the documentation
          */

File diff suppressed because it is too large
+ 6 - 6
dist/preview release/viewer/babylon.viewer.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 42 - 2
nodeEditor/src/blockTools.ts

@@ -17,7 +17,7 @@ import { FragmentOutputBlock } from 'babylonjs/Materials/Node/Blocks/Fragment/fr
 import { NormalizeBlock } from 'babylonjs/Materials/Node/Blocks/normalizeBlock';
 import { AddBlock } from 'babylonjs/Materials/Node/Blocks/addBlock';
 import { ScaleBlock } from 'babylonjs/Materials/Node/Blocks/scaleBlock';
-import { TrigonometryBlock } from 'babylonjs/Materials/Node/Blocks/trigonometryBlock';
+import { TrigonometryBlock, TrigonometryBlockOperations } from 'babylonjs/Materials/Node/Blocks/trigonometryBlock';
 import { ClampBlock } from 'babylonjs/Materials/Node/Blocks/clampBlock';
 import { CrossBlock } from 'babylonjs/Materials/Node/Blocks/crossBlock';
 import { DotBlock } from 'babylonjs/Materials/Node/Blocks/dotBlock';
@@ -92,7 +92,47 @@ export class BlockTools {
             case "SubtractBlock":
                 return new SubtractBlock("Subtract"); 
             case "StepBlock":
-                return new StepBlock("Step");                                
+                return new StepBlock("Step");        
+            case "CosBlock": {
+                let cosBlock = new TrigonometryBlock("Cos");
+                cosBlock.operation = TrigonometryBlockOperations.Cos;
+                return cosBlock;
+            }
+            case "SinBlock": {
+                let sinBlock = new TrigonometryBlock("Sin");
+                sinBlock.operation = TrigonometryBlockOperations.Sin;
+                return sinBlock;
+            }
+            case "AbsBlock": {
+                let absBlock = new TrigonometryBlock("Abs");
+                absBlock.operation = TrigonometryBlockOperations.Abs;
+                return absBlock;
+            }
+            case "ExpBlock": {
+                let expBlock = new TrigonometryBlock("Exp");
+                expBlock.operation = TrigonometryBlockOperations.Exp;
+                return expBlock;
+            }
+            case "Exp2Block": {
+                let exp2Block = new TrigonometryBlock("Exp2");
+                exp2Block.operation = TrigonometryBlockOperations.Exp2;
+                return exp2Block;
+            }
+            case "RoundBlock": {
+                let roundBlock = new TrigonometryBlock("Round");
+                roundBlock.operation = TrigonometryBlockOperations.Round;
+                return roundBlock;
+            }
+            case "CeilingBlock": {
+                let ceilingBlock = new TrigonometryBlock("Ceiling");
+                ceilingBlock.operation = TrigonometryBlockOperations.Ceiling;
+                return ceilingBlock;
+            }     
+            case "FloorBlock": {
+                let floorBlock = new TrigonometryBlock("Floor");
+                floorBlock.operation = TrigonometryBlockOperations.Floor;
+                return floorBlock;
+            }                                    
         }
 
         return null;

+ 2 - 2
nodeEditor/src/components/nodeList/nodeListComponent.tsx

@@ -29,10 +29,10 @@ export class NodeListComponent extends React.Component<INodeListComponentProps,
             Output_Blocks: ["VertexOutputBlock", "FragmentOutputBlock", "AlphaTestBlock"],
             Interpolation: ["LerpBlock"],
             Range: ["ClampBlock", "RemapBlock", "NormalizeBlock"],
-            Round: ["StepBlock"],
+            Round: ["StepBlock", "RoundBlock", "CeilingBlock", "FloorBlock"],
             Vector_Math: ["CrossBlock", "DotBlock", "TransformBlock", "FresnelBlock"],
             Basic_Math: ["AddBlock",  "DivideBlock", "MultiplyBlock", "ScaleBlock", "SubtractBlock"],
-            Trigonometry: [],
+            Trigonometry: ["CosBlock", "SinBlock", "AbsBlock", "ExpBlock", "Exp2Block"],
             Conversion_Blocks: ["ColorMergerBlock", "ColorSplitterBlock", "VectorMergerBlock", "VectorSplitterBlock"],
             Mesh_Attributes: ["InstancesBlock"],
             Matrices: ["Matrix"],

+ 2 - 2
serializers/src/glTF/2.0/glTFExporter.ts

@@ -226,7 +226,7 @@ export class _Exporter {
         this._samplers = [];
         this._animations = [];
         this._imageData = {};
-        this._convertToRightHandedSystem = this._babylonScene.useRightHandedSystem ? false : true;
+        this._convertToRightHandedSystem = !this._babylonScene.useRightHandedSystem;
         this._options = options || {};
         this._animationSampleRate = options && options.animationSampleRate ? options.animationSampleRate : 1 / 60;
 
@@ -1184,7 +1184,7 @@ export class _Exporter {
                         meshPrimitive.indices = this._accessors.length - 1;
                     }
                     if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
-                        let sideOrientation = bufferMesh.overrideMaterialSideOrientation || babylonMaterial.sideOrientation;
+                        let sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
 
                         // Only reverse the winding if we have a clockwise winding
                         if (sideOrientation === Material.ClockWiseSideOrientation) {