@babylonjs/core 6.41.1 → 6.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Class for generating 2D Halton sequences.
3
+ * From https://observablehq.com/@jrus/halton
4
+ */
5
+ export declare class Halton2DSequence {
6
+ private _curIndex;
7
+ private _sequence;
8
+ private _numSamples;
9
+ private _width;
10
+ private _height;
11
+ private _baseX;
12
+ private _baseY;
13
+ /**
14
+ * The x coordinate of the current sample.
15
+ */
16
+ readonly x = 0;
17
+ /**
18
+ * The y coordinate of the current sample.
19
+ */
20
+ readonly y = 0;
21
+ /**
22
+ * Creates a new Halton2DSequence.
23
+ * @param numSamples Number of samples in the sequence.
24
+ * @param baseX The base for the x coordinate (default: 2).
25
+ * @param baseY The base for the y coordinate (default: 3).
26
+ * @param width Factor to scale the x coordinate by (default: 1). The scaling factor is 1/width.
27
+ * @param height Factor to scale the y coordinate by (default: 1). The scaling factor is 1/height.
28
+ */
29
+ constructor(numSamples: number, baseX?: number, baseY?: number, width?: number, height?: number);
30
+ /**
31
+ * Regenerates the sequence with a new number of samples.
32
+ * @param numSamples Number of samples in the sequence.
33
+ */
34
+ regenerate(numSamples: number): void;
35
+ /**
36
+ * Sets the dimensions of the sequence.
37
+ * @param width Factor to scale the x coordinate by. The scaling factor is 1/width.
38
+ * @param height Factor to scale the y coordinate by. The scaling factor is 1/height.
39
+ */
40
+ setDimensions(width: number, height: number): void;
41
+ /**
42
+ * Advances to the next sample in the sequence.
43
+ */
44
+ next(): void;
45
+ private _generateSequence;
46
+ private _halton;
47
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Class for generating 2D Halton sequences.
3
+ * From https://observablehq.com/@jrus/halton
4
+ */
5
+ export class Halton2DSequence {
6
+ /**
7
+ * Creates a new Halton2DSequence.
8
+ * @param numSamples Number of samples in the sequence.
9
+ * @param baseX The base for the x coordinate (default: 2).
10
+ * @param baseY The base for the y coordinate (default: 3).
11
+ * @param width Factor to scale the x coordinate by (default: 1). The scaling factor is 1/width.
12
+ * @param height Factor to scale the y coordinate by (default: 1). The scaling factor is 1/height.
13
+ */
14
+ constructor(numSamples, baseX = 2, baseY = 3, width = 1, height = 1) {
15
+ this._curIndex = 0;
16
+ this._sequence = [];
17
+ this._numSamples = 0;
18
+ /**
19
+ * The x coordinate of the current sample.
20
+ */
21
+ this.x = 0;
22
+ /**
23
+ * The y coordinate of the current sample.
24
+ */
25
+ this.y = 0;
26
+ this._width = width;
27
+ this._height = height;
28
+ this._baseX = baseX;
29
+ this._baseY = baseY;
30
+ this._generateSequence(numSamples);
31
+ this.next();
32
+ }
33
+ /**
34
+ * Regenerates the sequence with a new number of samples.
35
+ * @param numSamples Number of samples in the sequence.
36
+ */
37
+ regenerate(numSamples) {
38
+ this._generateSequence(numSamples);
39
+ this.next();
40
+ }
41
+ /**
42
+ * Sets the dimensions of the sequence.
43
+ * @param width Factor to scale the x coordinate by. The scaling factor is 1/width.
44
+ * @param height Factor to scale the y coordinate by. The scaling factor is 1/height.
45
+ */
46
+ setDimensions(width, height) {
47
+ this._width = width;
48
+ this._height = height;
49
+ }
50
+ /**
51
+ * Advances to the next sample in the sequence.
52
+ */
53
+ next() {
54
+ this.x = this._sequence[this._curIndex] / this._width;
55
+ this.y = this._sequence[this._curIndex + 1] / this._height;
56
+ this._curIndex += 2;
57
+ if (this._curIndex >= this._numSamples * 2) {
58
+ this._curIndex = 0;
59
+ }
60
+ }
61
+ _generateSequence(numSamples) {
62
+ this._sequence = [];
63
+ this._curIndex = 0;
64
+ this._numSamples = numSamples;
65
+ for (let i = 1; i <= numSamples; ++i) {
66
+ this._sequence.push(this._halton(i, this._baseX) - 0.5, this._halton(i, this._baseY) - 0.5);
67
+ }
68
+ }
69
+ _halton(index, base) {
70
+ let fraction = 1;
71
+ let result = 0;
72
+ while (index > 0) {
73
+ fraction /= base;
74
+ result += fraction * (index % base);
75
+ index = ~~(index / base); // floor division
76
+ }
77
+ return result;
78
+ }
79
+ }
80
+ //# sourceMappingURL=halton2DSequence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"halton2DSequence.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/halton2DSequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAmBzB;;;;;;;OAOG;IACH,YAAY,UAAkB,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC;QA1BnE,cAAS,GAAG,CAAC,CAAC;QACd,cAAS,GAAa,EAAE,CAAC;QACzB,gBAAW,GAAG,CAAC,CAAC;QAMxB;;WAEG;QACa,MAAC,GAAG,CAAC,CAAC;QAEtB;;WAEG;QACa,MAAC,GAAG,CAAC,CAAC;QAWlB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,UAAkB;QAChC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,KAAa,EAAE,MAAc;QAC9C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,IAAI;QACN,IAAI,CAAC,CAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACjE,IAAI,CAAC,CAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QAEvE,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC;QAEpB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE;YACxC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;SACtB;IACL,CAAC;IAEO,iBAAiB,CAAC,UAAkB;QACxC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,EAAE,CAAC,EAAE;YAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;SAC/F;IACL,CAAC;IAEO,OAAO,CAAC,KAAa,EAAE,IAAY;QACvC,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,OAAO,KAAK,GAAG,CAAC,EAAE;YACd,QAAQ,IAAI,IAAI,CAAC;YACjB,MAAM,IAAI,QAAQ,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;YACpC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,iBAAiB;SAC9C;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["/**\r\n * Class for generating 2D Halton sequences.\r\n * From https://observablehq.com/@jrus/halton\r\n */\r\nexport class Halton2DSequence {\r\n private _curIndex = 0;\r\n private _sequence: number[] = [];\r\n private _numSamples = 0;\r\n private _width: number;\r\n private _height: number;\r\n private _baseX;\r\n private _baseY;\r\n\r\n /**\r\n * The x coordinate of the current sample.\r\n */\r\n public readonly x = 0;\r\n\r\n /**\r\n * The y coordinate of the current sample.\r\n */\r\n public readonly y = 0;\r\n\r\n /**\r\n * Creates a new Halton2DSequence.\r\n * @param numSamples Number of samples in the sequence.\r\n * @param baseX The base for the x coordinate (default: 2).\r\n * @param baseY The base for the y coordinate (default: 3).\r\n * @param width Factor to scale the x coordinate by (default: 1). The scaling factor is 1/width.\r\n * @param height Factor to scale the y coordinate by (default: 1). The scaling factor is 1/height.\r\n */\r\n constructor(numSamples: number, baseX = 2, baseY = 3, width = 1, height = 1) {\r\n this._width = width;\r\n this._height = height;\r\n this._baseX = baseX;\r\n this._baseY = baseY;\r\n\r\n this._generateSequence(numSamples);\r\n this.next();\r\n }\r\n\r\n /**\r\n * Regenerates the sequence with a new number of samples.\r\n * @param numSamples Number of samples in the sequence.\r\n */\r\n public regenerate(numSamples: number) {\r\n this._generateSequence(numSamples);\r\n this.next();\r\n }\r\n\r\n /**\r\n * Sets the dimensions of the sequence.\r\n * @param width Factor to scale the x coordinate by. The scaling factor is 1/width.\r\n * @param height Factor to scale the y coordinate by. The scaling factor is 1/height.\r\n */\r\n public setDimensions(width: number, height: number) {\r\n this._width = width;\r\n this._height = height;\r\n }\r\n\r\n /**\r\n * Advances to the next sample in the sequence.\r\n */\r\n public next() {\r\n (this.x as number) = this._sequence[this._curIndex] / this._width;\r\n (this.y as number) = this._sequence[this._curIndex + 1] / this._height;\r\n\r\n this._curIndex += 2;\r\n\r\n if (this._curIndex >= this._numSamples * 2) {\r\n this._curIndex = 0;\r\n }\r\n }\r\n\r\n private _generateSequence(numSamples: number) {\r\n this._sequence = [];\r\n this._curIndex = 0;\r\n this._numSamples = numSamples;\r\n\r\n for (let i = 1; i <= numSamples; ++i) {\r\n this._sequence.push(this._halton(i, this._baseX) - 0.5, this._halton(i, this._baseY) - 0.5);\r\n }\r\n }\r\n\r\n private _halton(index: number, base: number) {\r\n let fraction = 1;\r\n let result = 0;\r\n while (index > 0) {\r\n fraction /= base;\r\n result += fraction * (index % base);\r\n index = ~~(index / base); // floor division\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
package/Maths/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from "./math.functions";
3
3
  export * from "./math.polar";
4
4
  export * from "./math";
5
5
  export * from "./sphericalPolynomial";
6
+ export * from "./halton2DSequence";
package/Maths/index.js CHANGED
@@ -3,4 +3,5 @@ export * from "./math.functions.js";
3
3
  export * from "./math.polar.js";
4
4
  export * from "./math.js";
5
5
  export * from "./sphericalPolynomial.js";
6
+ export * from "./halton2DSequence.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./math.scalar\";\r\nexport * from \"./math.functions\";\r\nexport * from \"./math.polar\";\r\nexport * from \"./math\";\r\nexport * from \"./sphericalPolynomial\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./math.scalar\";\r\nexport * from \"./math.functions\";\r\nexport * from \"./math.polar\";\r\nexport * from \"./math\";\r\nexport * from \"./sphericalPolynomial\";\r\nexport * from \"./halton2DSequence\";\r\n"]}
@@ -13,40 +13,40 @@ export declare enum GeometryTrigonometryBlockOperations {
13
13
  Abs = 2,
14
14
  /** Exp */
15
15
  Exp = 3,
16
- /** Exp2 */
17
- Exp2 = 4,
18
16
  /** Round */
19
- Round = 5,
17
+ Round = 4,
20
18
  /** Floor */
21
- Floor = 6,
19
+ Floor = 5,
22
20
  /** Ceiling */
23
- Ceiling = 7,
21
+ Ceiling = 6,
24
22
  /** Square root */
25
- Sqrt = 8,
23
+ Sqrt = 7,
26
24
  /** Log */
27
- Log = 9,
25
+ Log = 8,
28
26
  /** Tangent */
29
- Tan = 10,
27
+ Tan = 9,
30
28
  /** Arc tangent */
31
- ArcTan = 11,
29
+ ArcTan = 10,
32
30
  /** Arc cosinus */
33
- ArcCos = 12,
31
+ ArcCos = 11,
34
32
  /** Arc sinus */
35
- ArcSin = 13,
33
+ ArcSin = 12,
36
34
  /** Sign */
37
- Sign = 14,
35
+ Sign = 13,
38
36
  /** Negate */
39
- Negate = 15,
37
+ Negate = 14,
40
38
  /** OneMinus */
41
- OneMinus = 16,
39
+ OneMinus = 15,
42
40
  /** Reciprocal */
43
- Reciprocal = 17,
41
+ Reciprocal = 16,
44
42
  /** ToDegrees */
45
- ToDegrees = 18,
43
+ ToDegrees = 17,
46
44
  /** ToRadians */
47
- ToRadians = 19,
45
+ ToRadians = 18,
48
46
  /** Fract */
49
- Fract = 20
47
+ Fract = 19,
48
+ /** Exp2 */
49
+ Exp2 = 20
50
50
  }
51
51
  /**
52
52
  * Block used to apply trigonometry operation to floats
@@ -17,40 +17,40 @@ export var GeometryTrigonometryBlockOperations;
17
17
  GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Abs"] = 2] = "Abs";
18
18
  /** Exp */
19
19
  GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Exp"] = 3] = "Exp";
20
- /** Exp2 */
21
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Exp2"] = 4] = "Exp2";
22
20
  /** Round */
23
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Round"] = 5] = "Round";
21
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Round"] = 4] = "Round";
24
22
  /** Floor */
25
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Floor"] = 6] = "Floor";
23
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Floor"] = 5] = "Floor";
26
24
  /** Ceiling */
27
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Ceiling"] = 7] = "Ceiling";
25
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Ceiling"] = 6] = "Ceiling";
28
26
  /** Square root */
29
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Sqrt"] = 8] = "Sqrt";
27
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Sqrt"] = 7] = "Sqrt";
30
28
  /** Log */
31
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Log"] = 9] = "Log";
29
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Log"] = 8] = "Log";
32
30
  /** Tangent */
33
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Tan"] = 10] = "Tan";
31
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Tan"] = 9] = "Tan";
34
32
  /** Arc tangent */
35
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ArcTan"] = 11] = "ArcTan";
33
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ArcTan"] = 10] = "ArcTan";
36
34
  /** Arc cosinus */
37
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ArcCos"] = 12] = "ArcCos";
35
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ArcCos"] = 11] = "ArcCos";
38
36
  /** Arc sinus */
39
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ArcSin"] = 13] = "ArcSin";
37
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ArcSin"] = 12] = "ArcSin";
40
38
  /** Sign */
41
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Sign"] = 14] = "Sign";
39
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Sign"] = 13] = "Sign";
42
40
  /** Negate */
43
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Negate"] = 15] = "Negate";
41
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Negate"] = 14] = "Negate";
44
42
  /** OneMinus */
45
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["OneMinus"] = 16] = "OneMinus";
43
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["OneMinus"] = 15] = "OneMinus";
46
44
  /** Reciprocal */
47
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Reciprocal"] = 17] = "Reciprocal";
45
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Reciprocal"] = 16] = "Reciprocal";
48
46
  /** ToDegrees */
49
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ToDegrees"] = 18] = "ToDegrees";
47
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ToDegrees"] = 17] = "ToDegrees";
50
48
  /** ToRadians */
51
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ToRadians"] = 19] = "ToRadians";
49
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["ToRadians"] = 18] = "ToRadians";
52
50
  /** Fract */
53
- GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Fract"] = 20] = "Fract";
51
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Fract"] = 19] = "Fract";
52
+ /** Exp2 */
53
+ GeometryTrigonometryBlockOperations[GeometryTrigonometryBlockOperations["Exp2"] = 20] = "Exp2";
54
54
  })(GeometryTrigonometryBlockOperations || (GeometryTrigonometryBlockOperations = {}));
55
55
  /**
56
56
  * Block used to apply trigonometry operation to floats
@@ -1 +1 @@
1
- {"version":3,"file":"geometryTrigonometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTrigonometryBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mCA2CX;AA3CD,WAAY,mCAAmC;IAC3C,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,WAAW;IACX,6FAAI,CAAA;IACJ,YAAY;IACZ,+FAAK,CAAA;IACL,YAAY;IACZ,+FAAK,CAAA;IACL,cAAc;IACd,mGAAO,CAAA;IACP,kBAAkB;IAClB,6FAAI,CAAA;IACJ,UAAU;IACV,2FAAG,CAAA;IACH,cAAc;IACd,4FAAG,CAAA;IACH,kBAAkB;IAClB,kGAAM,CAAA;IACN,kBAAkB;IAClB,kGAAM,CAAA;IACN,gBAAgB;IAChB,kGAAM,CAAA;IACN,WAAW;IACX,8FAAI,CAAA;IACJ,aAAa;IACb,kGAAM,CAAA;IACN,eAAe;IACf,sGAAQ,CAAA;IACR,iBAAiB;IACjB,0GAAU,CAAA;IACV,gBAAgB;IAChB,wGAAS,CAAA;IACT,gBAAgB;IAChB,wGAAS,CAAA;IACT,YAAY;IACZ,gGAAK,CAAA;AACT,CAAC,EA3CW,mCAAmC,KAAnC,mCAAmC,QA2C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typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nexport enum GeometryTrigonometryBlockOperations {\r\n /** Cos */\r\n Cos,\r\n /** Sin */\r\n Sin,\r\n /** Abs */\r\n Abs,\r\n /** Exp */\r\n Exp,\r\n /** Exp2 */\r\n Exp2,\r\n /** Round */\r\n Round,\r\n /** Floor */\r\n Floor,\r\n /** Ceiling */\r\n Ceiling,\r\n /** Square root */\r\n Sqrt,\r\n /** Log */\r\n Log,\r\n /** Tangent */\r\n Tan,\r\n /** Arc tangent */\r\n ArcTan,\r\n /** Arc cosinus */\r\n ArcCos,\r\n /** Arc sinus */\r\n ArcSin,\r\n /** Sign */\r\n Sign,\r\n /** Negate */\r\n Negate,\r\n /** OneMinus */\r\n OneMinus,\r\n /** Reciprocal */\r\n Reciprocal,\r\n /** ToDegrees */\r\n ToDegrees,\r\n /** ToRadians */\r\n ToRadians,\r\n /** Fract */\r\n Fract,\r\n}\r\n\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nexport class GeometryTrigonometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Cos\", value: GeometryTrigonometryBlockOperations.Cos },\r\n { label: \"Sin\", value: GeometryTrigonometryBlockOperations.Sin },\r\n { label: \"Abs\", value: GeometryTrigonometryBlockOperations.Abs },\r\n { label: \"Exp\", value: GeometryTrigonometryBlockOperations.Exp },\r\n { label: \"Exp2\", value: GeometryTrigonometryBlockOperations.Exp2 },\r\n { label: \"Round\", value: GeometryTrigonometryBlockOperations.Round },\r\n { label: \"Floor\", value: GeometryTrigonometryBlockOperations.Floor },\r\n { label: \"Ceiling\", value: GeometryTrigonometryBlockOperations.Ceiling },\r\n { label: \"Sqrt\", value: GeometryTrigonometryBlockOperations.Sqrt },\r\n { label: \"Log\", value: GeometryTrigonometryBlockOperations.Log },\r\n { label: \"Tan\", value: GeometryTrigonometryBlockOperations.Tan },\r\n { label: \"ArcTan\", value: GeometryTrigonometryBlockOperations.ArcTan },\r\n { label: \"ArcCos\", value: GeometryTrigonometryBlockOperations.ArcCos },\r\n { label: \"ArcSin\", value: GeometryTrigonometryBlockOperations.ArcSin },\r\n { label: \"Sign\", value: GeometryTrigonometryBlockOperations.Sign },\r\n { label: \"Negate\", value: GeometryTrigonometryBlockOperations.Negate },\r\n { label: \"OneMinus\", value: GeometryTrigonometryBlockOperations.OneMinus },\r\n { label: \"Reciprocal\", value: GeometryTrigonometryBlockOperations.Reciprocal },\r\n { label: \"ToDegrees\", value: GeometryTrigonometryBlockOperations.ToDegrees },\r\n { label: \"ToRadians\", value: GeometryTrigonometryBlockOperations.ToRadians },\r\n ],\r\n })\r\n public operation = GeometryTrigonometryBlockOperations.Cos;\r\n\r\n /**\r\n * Creates a new GeometryTrigonometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryTrigonometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n let func: Nullable<(value: number) => number> = null;\r\n\r\n switch (this.operation) {\r\n case GeometryTrigonometryBlockOperations.Cos: {\r\n func = (value: number) => Math.cos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sin: {\r\n func = (value: number) => Math.sin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Abs: {\r\n func = (value: number) => Math.abs(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp: {\r\n func = (value: number) => Math.exp(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp2: {\r\n func = (value: number) => Math.pow(2, value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Round: {\r\n func = (value: number) => Math.round(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Floor: {\r\n func = (value: number) => Math.floor(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Ceiling: {\r\n func = (value: number) => Math.ceil(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sqrt: {\r\n func = (value: number) => Math.sqrt(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Log: {\r\n func = (value: number) => Math.log(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Tan: {\r\n func = (value: number) => Math.tan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcTan: {\r\n func = (value: number) => Math.atan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcCos: {\r\n func = (value: number) => Math.acos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcSin: {\r\n func = (value: number) => Math.asin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sign: {\r\n func = (value: number) => Math.sign(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Negate: {\r\n func = (value: number) => -value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.OneMinus: {\r\n func = (value: number) => 1 - value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Reciprocal: {\r\n func = (value: number) => 1 / value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToRadians: {\r\n func = (value: number) => (value * Math.PI) / 180;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToDegrees: {\r\n func = (value: number) => (value * 180) / Math.PI;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Fract: {\r\n func = (value: number) => {\r\n if (value >= 0) {\r\n return value - Math.floor(value);\r\n } else {\r\n return value - Math.ceil(value);\r\n }\r\n };\r\n break;\r\n }\r\n }\r\n if (!func) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return func!(source);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector2(func!(source.x), func!(source.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector3(func!(source.x), func!(source.y), func!(source.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector4(func!(source.x), func!(source.y), func!(source.z), func!(source.w));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString =\r\n super._dumpPropertiesCode() +\r\n `${this._codeVariableName}.operation = BABYLON.GeometryTrigonometryBlockOperations.${GeometryTrigonometryBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTrigonometryBlock\", GeometryTrigonometryBlock);\r\n"]}
1
+ {"version":3,"file":"geometryTrigonometryBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Meshes/Node/Blocks/geometryTrigonometryBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,mCA2CX;AA3CD,WAAY,mCAAmC;IAC3C,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,UAAU;IACV,2FAAG,CAAA;IACH,YAAY;IACZ,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,EAAE,mCAAmC,CAAC,IAAI,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,mCAAmC,CAAC,MAAM,EAAE;YACtE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,mCAAmC,CAAC,QAAQ,EAAE;YAC1E,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,mCAAmC,CAAC,UAAU,EAAE;YAC9E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;YAC5E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,mCAAmC,CAAC,SAAS,EAAE;SAC/E;KACJ,CAAC;4DACyD;AAuM/D,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes\";\r\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock\";\r\nimport type { NodeGeometryConnectionPoint } from \"../nodeGeometryBlockConnectionPoint\";\r\nimport type { NodeGeometryBuildState } from \"../nodeGeometryBuildState\";\r\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Trigonometry block\r\n */\r\nexport enum GeometryTrigonometryBlockOperations {\r\n /** Cos */\r\n Cos,\r\n /** Sin */\r\n Sin,\r\n /** Abs */\r\n Abs,\r\n /** Exp */\r\n Exp,\r\n /** Round */\r\n Round,\r\n /** Floor */\r\n Floor,\r\n /** Ceiling */\r\n Ceiling,\r\n /** Square root */\r\n Sqrt,\r\n /** Log */\r\n Log,\r\n /** Tangent */\r\n Tan,\r\n /** Arc tangent */\r\n ArcTan,\r\n /** Arc cosinus */\r\n ArcCos,\r\n /** Arc sinus */\r\n ArcSin,\r\n /** Sign */\r\n Sign,\r\n /** Negate */\r\n Negate,\r\n /** OneMinus */\r\n OneMinus,\r\n /** Reciprocal */\r\n Reciprocal,\r\n /** ToDegrees */\r\n ToDegrees,\r\n /** ToRadians */\r\n ToRadians,\r\n /** Fract */\r\n Fract,\r\n /** Exp2 */\r\n Exp2,\r\n}\r\n\r\n/**\r\n * Block used to apply trigonometry operation to floats\r\n */\r\nexport class GeometryTrigonometryBlock extends NodeGeometryBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Cos\", value: GeometryTrigonometryBlockOperations.Cos },\r\n { label: \"Sin\", value: GeometryTrigonometryBlockOperations.Sin },\r\n { label: \"Abs\", value: GeometryTrigonometryBlockOperations.Abs },\r\n { label: \"Exp\", value: GeometryTrigonometryBlockOperations.Exp },\r\n { label: \"Exp2\", value: GeometryTrigonometryBlockOperations.Exp2 },\r\n { label: \"Round\", value: GeometryTrigonometryBlockOperations.Round },\r\n { label: \"Floor\", value: GeometryTrigonometryBlockOperations.Floor },\r\n { label: \"Ceiling\", value: GeometryTrigonometryBlockOperations.Ceiling },\r\n { label: \"Sqrt\", value: GeometryTrigonometryBlockOperations.Sqrt },\r\n { label: \"Log\", value: GeometryTrigonometryBlockOperations.Log },\r\n { label: \"Tan\", value: GeometryTrigonometryBlockOperations.Tan },\r\n { label: \"ArcTan\", value: GeometryTrigonometryBlockOperations.ArcTan },\r\n { label: \"ArcCos\", value: GeometryTrigonometryBlockOperations.ArcCos },\r\n { label: \"ArcSin\", value: GeometryTrigonometryBlockOperations.ArcSin },\r\n { label: \"Sign\", value: GeometryTrigonometryBlockOperations.Sign },\r\n { label: \"Negate\", value: GeometryTrigonometryBlockOperations.Negate },\r\n { label: \"OneMinus\", value: GeometryTrigonometryBlockOperations.OneMinus },\r\n { label: \"Reciprocal\", value: GeometryTrigonometryBlockOperations.Reciprocal },\r\n { label: \"ToDegrees\", value: GeometryTrigonometryBlockOperations.ToDegrees },\r\n { label: \"ToRadians\", value: GeometryTrigonometryBlockOperations.ToRadians },\r\n ],\r\n })\r\n public operation = GeometryTrigonometryBlockOperations.Cos;\r\n\r\n /**\r\n * Creates a new GeometryTrigonometryBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"GeometryTrigonometryBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): NodeGeometryConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeGeometryConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected _buildBlock(state: NodeGeometryBuildState) {\r\n super._buildBlock(state);\r\n let func: Nullable<(value: number) => number> = null;\r\n\r\n switch (this.operation) {\r\n case GeometryTrigonometryBlockOperations.Cos: {\r\n func = (value: number) => Math.cos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sin: {\r\n func = (value: number) => Math.sin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Abs: {\r\n func = (value: number) => Math.abs(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp: {\r\n func = (value: number) => Math.exp(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Exp2: {\r\n func = (value: number) => Math.pow(2, value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Round: {\r\n func = (value: number) => Math.round(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Floor: {\r\n func = (value: number) => Math.floor(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Ceiling: {\r\n func = (value: number) => Math.ceil(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sqrt: {\r\n func = (value: number) => Math.sqrt(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Log: {\r\n func = (value: number) => Math.log(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Tan: {\r\n func = (value: number) => Math.tan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcTan: {\r\n func = (value: number) => Math.atan(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcCos: {\r\n func = (value: number) => Math.acos(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ArcSin: {\r\n func = (value: number) => Math.asin(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Sign: {\r\n func = (value: number) => Math.sign(value);\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Negate: {\r\n func = (value: number) => -value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.OneMinus: {\r\n func = (value: number) => 1 - value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Reciprocal: {\r\n func = (value: number) => 1 / value;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToRadians: {\r\n func = (value: number) => (value * Math.PI) / 180;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.ToDegrees: {\r\n func = (value: number) => (value * 180) / Math.PI;\r\n break;\r\n }\r\n case GeometryTrigonometryBlockOperations.Fract: {\r\n func = (value: number) => {\r\n if (value >= 0) {\r\n return value - Math.floor(value);\r\n } else {\r\n return value - Math.ceil(value);\r\n }\r\n };\r\n break;\r\n }\r\n }\r\n if (!func) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.input.type) {\r\n case NodeGeometryBlockConnectionPointTypes.Int:\r\n case NodeGeometryBlockConnectionPointTypes.Float: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return func!(source);\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector2(func!(source.x), func!(source.y));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector3(func!(source.x), func!(source.y), func!(source.z));\r\n };\r\n break;\r\n }\r\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\r\n this.output._storedFunction = (state) => {\r\n const source = this.input.getConnectedValue(state);\r\n return new Vector4(func!(source.x), func!(source.y), func!(source.z), func!(source.w));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const codeString =\r\n super._dumpPropertiesCode() +\r\n `${this._codeVariableName}.operation = BABYLON.GeometryTrigonometryBlockOperations.${GeometryTrigonometryBlockOperations[this.operation]};\\n`;\r\n return codeString;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GeometryTrigonometryBlock\", GeometryTrigonometryBlock);\r\n"]}
@@ -4,3 +4,4 @@ export * from "./ssao2RenderingPipeline";
4
4
  export * from "./ssaoRenderingPipeline";
5
5
  export * from "./standardRenderingPipeline";
6
6
  export * from "./ssrRenderingPipeline";
7
+ export * from "./taaRenderingPipeline";
@@ -4,4 +4,5 @@ export * from "./ssao2RenderingPipeline.js";
4
4
  export * from "./ssaoRenderingPipeline.js";
5
5
  export * from "./standardRenderingPipeline.js";
6
6
  export * from "./ssrRenderingPipeline.js";
7
+ export * from "./taaRenderingPipeline.js";
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./defaultRenderingPipeline\";\r\nexport * from \"./lensRenderingPipeline\";\r\nexport * from \"./ssao2RenderingPipeline\";\r\nexport * from \"./ssaoRenderingPipeline\";\r\nexport * from \"./standardRenderingPipeline\";\r\nexport * from \"./ssrRenderingPipeline\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/PostProcesses/RenderPipeline/Pipelines/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from \"./defaultRenderingPipeline\";\r\nexport * from \"./lensRenderingPipeline\";\r\nexport * from \"./ssao2RenderingPipeline\";\r\nexport * from \"./ssaoRenderingPipeline\";\r\nexport * from \"./standardRenderingPipeline\";\r\nexport * from \"./ssrRenderingPipeline\";\r\nexport * from \"./taaRenderingPipeline\";\r\n"]}
@@ -0,0 +1,111 @@
1
+ import type { Camera } from "../../../Cameras/camera";
2
+ import { PostProcessRenderPipeline } from "../postProcessRenderPipeline";
3
+ import type { Scene } from "../../../scene";
4
+ import "../postProcessRenderPipelineManagerSceneComponent";
5
+ import "../../../Shaders/taa.fragment";
6
+ /**
7
+ * Simple implementation of Temporal Anti-Aliasing (TAA).
8
+ * This can be used to improve image quality for still pictures (screenshots for e.g.).
9
+ */
10
+ export declare class TAARenderingPipeline extends PostProcessRenderPipeline {
11
+ /**
12
+ * The TAA PostProcess effect id in the pipeline
13
+ */
14
+ TAARenderEffect: string;
15
+ /**
16
+ * The pass PostProcess effect id in the pipeline
17
+ */
18
+ TAAPassEffect: string;
19
+ private _samples;
20
+ /**
21
+ * Number of accumulated samples (default: 16)
22
+ */
23
+ set samples(samples: number);
24
+ get samples(): number;
25
+ private _msaaSamples;
26
+ /**
27
+ * MSAA samples (default: 1)
28
+ */
29
+ set msaaSamples(samples: number);
30
+ get msaaSamples(): number;
31
+ /**
32
+ * The factor used to blend the history frame with current frame (default: 0.05)
33
+ */
34
+ factor: number;
35
+ /**
36
+ * Disable TAA on camera move (default: true).
37
+ * You generally want to keep this enabled, otherwise you will get a ghost effect when the camera moves (but if it's what you want, go for it!)
38
+ */
39
+ disableOnCameraMove: boolean;
40
+ private _isEnabled;
41
+ /**
42
+ * Gets or sets a boolean indicating if the render pipeline is enabled (default: true).
43
+ */
44
+ get isEnabled(): boolean;
45
+ set isEnabled(value: boolean);
46
+ /**
47
+ * Gets active scene
48
+ */
49
+ get scene(): Scene;
50
+ private _scene;
51
+ private _isDirty;
52
+ private _camerasToBeAttached;
53
+ private _textureType;
54
+ private _taaPostProcess;
55
+ private _passPostProcess;
56
+ private _ping;
57
+ private _pong;
58
+ private _pingpong;
59
+ private _hs;
60
+ private _firstUpdate;
61
+ /**
62
+ * Returns true if TAA is supported by the running hardware
63
+ */
64
+ get isSupported(): boolean;
65
+ /**
66
+ * Constructor of the TAA rendering pipeline
67
+ * @param name The rendering pipeline name
68
+ * @param scene The scene linked to this pipeline
69
+ * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)
70
+ * @param textureType The type of texture where the scene will be rendered (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)
71
+ */
72
+ constructor(name: string, scene: Scene, cameras?: Camera[], textureType?: number);
73
+ /**
74
+ * Get the class name
75
+ * @returns "TAARenderingPipeline"
76
+ */
77
+ getClassName(): string;
78
+ /**
79
+ * Adds a camera to the pipeline
80
+ * @param camera the camera to be added
81
+ */
82
+ addCamera(camera: Camera): void;
83
+ /**
84
+ * Removes a camera from the pipeline
85
+ * @param camera the camera to remove
86
+ */
87
+ removeCamera(camera: Camera): void;
88
+ /**
89
+ * Removes the internal pipeline assets and detaches the pipeline from the scene cameras
90
+ */
91
+ dispose(): void;
92
+ private _createPingPongTextures;
93
+ private _updateEffectDefines;
94
+ private _buildPipeline;
95
+ private _disposePostProcesses;
96
+ private _createTAAPostProcess;
97
+ private _createPassPostProcess;
98
+ /**
99
+ * Serializes the rendering pipeline (Used when exporting)
100
+ * @returns the serialized object
101
+ */
102
+ serialize(): any;
103
+ /**
104
+ * Parse the serialized pipeline
105
+ * @param source Source pipeline.
106
+ * @param scene The scene to load the pipeline to.
107
+ * @param rootUrl The URL of the serialized pipeline.
108
+ * @returns An instantiated pipeline from the serialized object.
109
+ */
110
+ static Parse(source: any, scene: Scene, rootUrl: string): TAARenderingPipeline;
111
+ }