@onerjs/core 8.30.3 → 8.30.5

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.
Files changed (163) hide show
  1. package/Audio/audioSceneComponent.d.ts +9 -5
  2. package/Audio/audioSceneComponent.js +1 -0
  3. package/Audio/audioSceneComponent.js.map +1 -1
  4. package/AudioV2/abstractAudio/audioEngineV2.d.ts +8 -0
  5. package/AudioV2/abstractAudio/audioEngineV2.js +19 -0
  6. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  7. package/AudioV2/webAudio/webAudioEngine.d.ts +5 -0
  8. package/AudioV2/webAudio/webAudioEngine.js +8 -0
  9. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  10. package/AudioV2/webAudio/webAudioStaticSound.js +2 -2
  11. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  12. package/AudioV2/webAudio/webAudioStreamingSound.js +5 -2
  13. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  14. package/Cameras/camera.d.ts +4 -0
  15. package/Cameras/camera.js +18 -9
  16. package/Cameras/camera.js.map +1 -1
  17. package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
  18. package/Engines/WebGPU/webgpuDrawContext.js +8 -0
  19. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  20. package/Engines/abstractEngine.js +2 -2
  21. package/Engines/abstractEngine.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
  23. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +1 -1
  25. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
  26. package/FrameGraph/Node/Blocks/computeShaderBlock.d.ts +42 -0
  27. package/FrameGraph/Node/Blocks/computeShaderBlock.js +74 -0
  28. package/FrameGraph/Node/Blocks/computeShaderBlock.js.map +1 -0
  29. package/FrameGraph/Node/Blocks/executeBlock.d.ts +11 -1
  30. package/FrameGraph/Node/Blocks/executeBlock.js +18 -0
  31. package/FrameGraph/Node/Blocks/executeBlock.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  33. package/FrameGraph/Node/Blocks/index.js +1 -0
  34. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  35. package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
  36. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  37. package/FrameGraph/Node/Blocks/outputBlock.js +1 -0
  38. package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -1
  39. package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
  40. package/FrameGraph/Node/nodeRenderGraph.js +7 -3
  41. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  42. package/FrameGraph/Node/nodeRenderGraphBlock.js +7 -0
  43. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  44. package/FrameGraph/Passes/pass.d.ts +11 -1
  45. package/FrameGraph/Passes/pass.js +11 -1
  46. package/FrameGraph/Passes/pass.js.map +1 -1
  47. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +115 -0
  48. package/FrameGraph/Tasks/Misc/computeShaderTask.js +174 -0
  49. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -0
  50. package/FrameGraph/Tasks/Misc/executeTask.d.ts +5 -0
  51. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  52. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  53. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -1
  54. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
  55. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  56. package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
  57. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +7 -0
  58. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
  59. package/FrameGraph/frameGraph.d.ts +1 -1
  60. package/FrameGraph/frameGraph.js +3 -6
  61. package/FrameGraph/frameGraph.js.map +1 -1
  62. package/FrameGraph/frameGraphTask.d.ts +3 -2
  63. package/FrameGraph/frameGraphTask.js +5 -2
  64. package/FrameGraph/frameGraphTask.js.map +1 -1
  65. package/FrameGraph/frameGraphTextureManager.js +2 -2
  66. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  67. package/FrameGraph/index.d.ts +1 -0
  68. package/FrameGraph/index.js +1 -0
  69. package/FrameGraph/index.js.map +1 -1
  70. package/Lights/directionalLight.js +1 -4
  71. package/Lights/directionalLight.js.map +1 -1
  72. package/Lights/pointLight.js +2 -5
  73. package/Lights/pointLight.js.map +1 -1
  74. package/Materials/Background/backgroundMaterial.js +9 -5
  75. package/Materials/Background/backgroundMaterial.js.map +1 -1
  76. package/Materials/PBR/openpbrMaterial.d.ts +14 -0
  77. package/Materials/PBR/openpbrMaterial.js +16 -0
  78. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  79. package/Materials/materialHelper.functions.d.ts +8 -0
  80. package/Materials/materialHelper.functions.js +31 -0
  81. package/Materials/materialHelper.functions.js.map +1 -1
  82. package/Materials/shaderMaterial.js +20 -0
  83. package/Materials/shaderMaterial.js.map +1 -1
  84. package/Maths/math.vector.functions.d.ts +26 -13
  85. package/Maths/math.vector.functions.js +29 -8
  86. package/Maths/math.vector.functions.js.map +1 -1
  87. package/Meshes/mesh.js +1 -1
  88. package/Meshes/mesh.js.map +1 -1
  89. package/Misc/decorators.d.ts +1 -1
  90. package/Misc/decorators.js.map +1 -1
  91. package/Misc/dumpTools.d.ts +20 -0
  92. package/Misc/dumpTools.js +60 -49
  93. package/Misc/dumpTools.js.map +1 -1
  94. package/Misc/index.d.ts +1 -2
  95. package/Misc/index.js +1 -2
  96. package/Misc/index.js.map +1 -1
  97. package/Misc/sceneSerializer.js +4 -1
  98. package/Misc/sceneSerializer.js.map +1 -1
  99. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  100. package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +57 -0
  101. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +163 -0
  102. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -0
  103. package/Particles/Node/Blocks/Emitters/index.d.ts +5 -4
  104. package/Particles/Node/Blocks/Emitters/index.js +5 -4
  105. package/Particles/Node/Blocks/Emitters/index.js.map +1 -1
  106. package/Particles/Node/Blocks/particleInputBlock.js +2 -0
  107. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  108. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  109. package/Particles/Node/Blocks/systemBlock.js +8 -0
  110. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  111. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
  112. package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
  113. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  114. package/Particles/Node/nodeParticleBuildState.js +5 -0
  115. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  116. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +4 -3
  117. package/Particles/Node/nodeParticleSystemSet.helper.js +182 -115
  118. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  119. package/Physics/physicsRaycastResult.d.ts +3 -0
  120. package/Physics/physicsRaycastResult.js.map +1 -1
  121. package/Physics/v2/Plugins/havokPlugin.js +1 -1
  122. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  123. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -0
  124. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +9 -1
  125. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  126. package/PostProcesses/postProcess.d.ts +4 -0
  127. package/PostProcesses/postProcess.js +4 -0
  128. package/PostProcesses/postProcess.js.map +1 -1
  129. package/PostProcesses/thinSSAO2PostProcess.d.ts +1 -0
  130. package/PostProcesses/thinSSAO2PostProcess.js +18 -6
  131. package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
  132. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -0
  133. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  134. package/Shaders/ShadersInclude/openpbrCoatLayerData.js +4 -0
  135. package/Shaders/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
  136. package/Shaders/ShadersInclude/openpbrDirectLighting.js +5 -2
  137. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  138. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
  139. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  140. package/Shaders/ShadersInclude/openpbrFuzzLayerData.js +1 -1
  141. package/Shaders/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
  142. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
  143. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  144. package/Shaders/particles.vertex.js +1 -1
  145. package/Shaders/particles.vertex.js.map +1 -1
  146. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +2 -2
  147. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
  148. package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js +4 -0
  149. package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
  150. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +5 -2
  151. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  152. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
  153. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  154. package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js +1 -1
  155. package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
  156. package/ShadersWGSL/iblVoxelGrid.vertex.js +77 -3
  157. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  158. package/ShadersWGSL/particles.vertex.js +1 -1
  159. package/ShadersWGSL/particles.vertex.js.map +1 -1
  160. package/package.json +1 -1
  161. package/scene.d.ts +2 -0
  162. package/scene.js +9 -1
  163. package/scene.js.map +1 -1
@@ -1,7 +1,6 @@
1
1
  import type { DeepImmutable } from "../types.js";
2
- import type { IVector2Like, IVector3Like } from "./math.like.js";
2
+ import type { IQuaternionLike, IVector2Like, IVector3Like, IVector4Like } from "./math.like.js";
3
3
  import { Quaternion, Vector3 } from "./math.vector.js";
4
- import type { Vector4 } from "./math.vector.js";
5
4
  /**
6
5
  * Creates a string representation of the IVector2Like
7
6
  * @param vector defines the IVector2Like to stringify
@@ -15,7 +14,7 @@ export declare function Vector2ToFixed(vector: IVector2Like, decimalCount: numbe
15
14
  * @param b defines the second vector
16
15
  * @returns the dot product
17
16
  */
18
- export declare function Vector3Dot<T extends IVector3Like, U extends IVector3Like>(a: DeepImmutable<T>, b: DeepImmutable<U>): number;
17
+ export declare function Vector3Dot(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number;
19
18
  /**
20
19
  * Sets the given floats into the result.
21
20
  * @param x defines the x coordinate
@@ -32,28 +31,42 @@ export declare function Vector3FromFloatsToRef<T extends IVector3Like>(x: number
32
31
  * @param result defines the target vector
33
32
  * @returns the scaled vector
34
33
  */
35
- export declare function Vector3ScaleToRef<T extends IVector3Like, ResultT extends IVector3Like>(a: DeepImmutable<T>, scale: number, result: ResultT): ResultT;
34
+ export declare function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, scale: number, result: T): T;
36
35
  /**
37
- * Creates a string representation of the Vector3
38
- * @param vector defines the Vector3 to stringify
36
+ * Scales the current vector values in place by a factor
37
+ * @param vector defines the vector to scale
38
+ * @param scale defines the scale factor
39
+ * @returns the input scaled vector
40
+ */
41
+ export declare function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T;
42
+ /**
43
+ * Creates a string representation of the IVector3Like
44
+ * @param vector defines the IVector3Like to stringify
39
45
  * @param decimalCount defines the number of decimals to use
40
- * @returns a string with the Vector3 coordinates.
46
+ * @returns a string with the IVector3Like coordinates.
47
+ */
48
+ export declare function Vector3ToFixed(vector: DeepImmutable<IVector3Like>, decimalCount: number): string;
49
+ /**
50
+ * Computes the dot product of two IVector4Like objects
51
+ * @param a defines the first vector
52
+ * @param b defines the second vector
53
+ * @returns the dot product
41
54
  */
42
- export declare function Vector3ToFixed(vector: Vector3, decimalCount: number): string;
55
+ export declare function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVector4Like>): number;
43
56
  /**
44
- * Creates a string representation of the Vector4
45
- * @param vector defines the Vector4 to stringify
57
+ * Creates a string representation of the IVector4Like
58
+ * @param vector defines the IVector4Like to stringify
46
59
  * @param decimalCount defines the number of decimals to use
47
- * @returns a string with the Vector4 coordinates.
60
+ * @returns a string with the IVector4Like coordinates.
48
61
  */
49
- export declare function Vector4ToFixed(vector: Vector4, decimalCount: number): string;
62
+ export declare function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string;
50
63
  /**
51
64
  * Returns the angle in radians between two quaternions
52
65
  * @param q1 defines the first quaternion
53
66
  * @param q2 defines the second quaternion
54
67
  * @returns the angle in radians between the two quaternions
55
68
  */
56
- export declare function GetAngleBetweenQuaternions(q1: DeepImmutable<Quaternion>, q2: DeepImmutable<Quaternion>): number;
69
+ export declare function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number;
57
70
  /**
58
71
  * Creates a quaternion from two direction vectors
59
72
  * @param a defines the first direction vector
@@ -46,19 +46,40 @@ export function Vector3ScaleToRef(a, scale, result) {
46
46
  return result;
47
47
  }
48
48
  /**
49
- * Creates a string representation of the Vector3
50
- * @param vector defines the Vector3 to stringify
49
+ * Scales the current vector values in place by a factor
50
+ * @param vector defines the vector to scale
51
+ * @param scale defines the scale factor
52
+ * @returns the input scaled vector
53
+ */
54
+ export function Vector3ScaleInPlace(vector, scale) {
55
+ vector.x *= scale;
56
+ vector.y *= scale;
57
+ vector.z *= scale;
58
+ return vector;
59
+ }
60
+ /**
61
+ * Creates a string representation of the IVector3Like
62
+ * @param vector defines the IVector3Like to stringify
51
63
  * @param decimalCount defines the number of decimals to use
52
- * @returns a string with the Vector3 coordinates.
64
+ * @returns a string with the IVector3Like coordinates.
53
65
  */
54
66
  export function Vector3ToFixed(vector, decimalCount) {
55
- return `{X: ${vector._x.toFixed(decimalCount)} Y: ${vector._y.toFixed(decimalCount)} Z: ${vector._z.toFixed(decimalCount)}}`;
67
+ return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)}}`;
68
+ }
69
+ /**
70
+ * Computes the dot product of two IVector4Like objects
71
+ * @param a defines the first vector
72
+ * @param b defines the second vector
73
+ * @returns the dot product
74
+ */
75
+ export function Vector4Dot(a, b) {
76
+ return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
56
77
  }
57
78
  /**
58
- * Creates a string representation of the Vector4
59
- * @param vector defines the Vector4 to stringify
79
+ * Creates a string representation of the IVector4Like
80
+ * @param vector defines the IVector4Like to stringify
60
81
  * @param decimalCount defines the number of decimals to use
61
- * @returns a string with the Vector4 coordinates.
82
+ * @returns a string with the IVector4Like coordinates.
62
83
  */
63
84
  export function Vector4ToFixed(vector, decimalCount) {
64
85
  return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;
@@ -70,7 +91,7 @@ export function Vector4ToFixed(vector, decimalCount) {
70
91
  * @returns the angle in radians between the two quaternions
71
92
  */
72
93
  export function GetAngleBetweenQuaternions(q1, q2) {
73
- return Math.acos(Clamp(Quaternion.Dot(q1, q2))) * 2;
94
+ return Math.acos(Clamp(Vector4Dot(q1, q2))) * 2;
74
95
  }
75
96
  /**
76
97
  * Creates a quaternion from two direction vectors
@@ -1 +1 @@
1
- {"version":3,"file":"math.vector.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.vector.functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGpD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,YAAoB;IACrE,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAiD,CAAmB,EAAE,CAAmB;IAC/G,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAyB,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,MAAS;IACrG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAuD,CAAmB,EAAE,KAAa,EAAE,MAAe;IACvI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACvB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B,EAAE,MAAe;IACrJ,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Clamp } from \"./math.scalar.functions\";\r\nimport type { DeepImmutable } from \"../types\";\r\nimport type { IVector2Like, IVector3Like } from \"./math.like\";\r\nimport { Quaternion, Vector3 } from \"./math.vector\";\r\nimport type { Vector4 } from \"./math.vector\";\r\n\r\n/**\r\n * Creates a string representation of the IVector2Like\r\n * @param vector defines the IVector2Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector2Like coordinates.\r\n */\r\nexport function Vector2ToFixed(vector: IVector2Like, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector3Like objects.\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector3Dot<T extends IVector3Like, U extends IVector3Like>(a: DeepImmutable<T>, b: DeepImmutable<U>) {\r\n return a.x * b.x + a.y * b.y + a.z * b.z;\r\n}\r\n\r\n/**\r\n * Sets the given floats into the result.\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param result defines the target vector\r\n * @returns the result vector\r\n */\r\nexport function Vector3FromFloatsToRef<T extends IVector3Like>(x: number, y: number, z: number, result: T): T {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n return result;\r\n}\r\n\r\n/**\r\n * Stores the scaled values of a vector into the result.\r\n * @param a defines the source vector\r\n * @param scale defines the scale factor\r\n * @param result defines the target vector\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleToRef<T extends IVector3Like, ResultT extends IVector3Like>(a: DeepImmutable<T>, scale: number, result: ResultT): ResultT {\r\n result.x = a.x * scale;\r\n result.y = a.y * scale;\r\n result.z = a.z * scale;\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the Vector3\r\n * @param vector defines the Vector3 to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the Vector3 coordinates.\r\n */\r\nexport function Vector3ToFixed(vector: Vector3, decimalCount: number): string {\r\n return `{X: ${vector._x.toFixed(decimalCount)} Y: ${vector._y.toFixed(decimalCount)} Z: ${vector._z.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the Vector4\r\n * @param vector defines the Vector4 to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the Vector4 coordinates.\r\n */\r\nexport function Vector4ToFixed(vector: Vector4, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<Quaternion>, q2: DeepImmutable<Quaternion>): number {\r\n return Math.acos(Clamp(Quaternion.Dot(q1, q2))) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
1
+ {"version":3,"file":"math.vector.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.vector.functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,YAAoB;IACrE,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,CAA8B,EAAE,CAA8B;IACrF,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AACD;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAyB,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,MAAS;IACrG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,M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,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACnK,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,EAAkC,EAAE,EAAkC;IAC7G,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAoB,CAAmB,EAAE,CAAmB;IACnG,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,gCAAgC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAAgD,CAAmB,EAAE,CAAmB,EAAE,MAAe;IACrJ,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Clamp } from \"./math.scalar.functions\";\r\nimport type { DeepImmutable } from \"../types\";\r\nimport type { IQuaternionLike, IVector2Like, IVector3Like, IVector4Like } from \"./math.like\";\r\nimport { Quaternion, Vector3 } from \"./math.vector\";\r\n\r\n/**\r\n * Creates a string representation of the IVector2Like\r\n * @param vector defines the IVector2Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector2Like coordinates.\r\n */\r\nexport function Vector2ToFixed(vector: IVector2Like, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector3Like objects.\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector3Dot(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z;\r\n}\r\n/**\r\n * Sets the given floats into the result.\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param result defines the target vector\r\n * @returns the result vector\r\n */\r\nexport function Vector3FromFloatsToRef<T extends IVector3Like>(x: number, y: number, z: number, result: T): T {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n return result;\r\n}\r\n\r\n/**\r\n * Stores the scaled values of a vector into the result.\r\n * @param a defines the source vector\r\n * @param scale defines the scale factor\r\n * @param result defines the target vector\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, scale: number, result: T): T {\r\n result.x = a.x * scale;\r\n result.y = a.y * scale;\r\n result.z = a.z * scale;\r\n return result;\r\n}\r\n\r\n/**\r\n * Scales the current vector values in place by a factor\r\n * @param vector defines the vector to scale\r\n * @param scale defines the scale factor\r\n * @returns the input scaled vector\r\n */\r\nexport function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T {\r\n vector.x *= scale;\r\n vector.y *= scale;\r\n vector.z *= scale;\r\n return vector;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector3Like\r\n * @param vector defines the IVector3Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector3Like coordinates.\r\n */\r\nexport function Vector3ToFixed(vector: DeepImmutable<IVector3Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector4Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVector4Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector4Like\r\n * @param vector defines the IVector4Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector4Like coordinates.\r\n */\r\nexport function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Returns the angle in radians between two quaternions\r\n * @param q1 defines the first quaternion\r\n * @param q2 defines the second quaternion\r\n * @returns the angle in radians between the two quaternions\r\n */\r\nexport function GetAngleBetweenQuaternions(q1: DeepImmutable<IQuaternionLike>, q2: DeepImmutable<IQuaternionLike>): number {\r\n return Math.acos(Clamp(Vector4Dot(q1, q2))) * 2;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirections<T extends Vector3>(a: DeepImmutable<T>, b: DeepImmutable<T>): Quaternion {\r\n const result = new Quaternion();\r\n GetQuaternionFromDirectionsToRef(a, b, result);\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a quaternion from two direction vectors\r\n * @param a defines the first direction vector\r\n * @param b defines the second direction vector\r\n * @param result defines the target quaternion\r\n * @returns the target quaternion\r\n */\r\nexport function GetQuaternionFromDirectionsToRef<T extends Vector3, ResultT extends Quaternion>(a: DeepImmutable<T>, b: DeepImmutable<T>, result: ResultT): ResultT {\r\n const axis = Vector3.Cross(a, b);\r\n const angle = Math.acos(Clamp(Vector3Dot(a, b), -1, 1));\r\n Quaternion.RotationAxisToRef(axis, angle, result);\r\n return result;\r\n}\r\n"]}
package/Meshes/mesh.js CHANGED
@@ -2105,7 +2105,7 @@ export class Mesh extends AbstractMesh {
2105
2105
  if (!instanceDataStorage.isFrozen &&
2106
2106
  (this._internalMeshDataInfo._effectiveMaterial.backFaceCulling ||
2107
2107
  this._internalMeshDataInfo._effectiveMaterial.sideOrientation !== null ||
2108
- this._internalMeshDataInfo._effectiveMaterial.twoSidedLighting)) {
2108
+ this._internalMeshDataInfo._effectiveMaterial._twoSidedLighting)) {
2109
2109
  // Note: if two sided lighting is enabled, we need to ensure that the normal will point in the right direction even if the determinant of the world matrix is negative
2110
2110
  const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();
2111
2111
  sideOrientation = this._internalMeshDataInfo._effectiveMaterial._getEffectiveOrientation(this);