@babylonjs/core 5.45.0 → 5.45.1

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 (32) hide show
  1. package/Engines/thinEngine.js +2 -2
  2. package/Engines/thinEngine.js.map +1 -1
  3. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +7 -0
  4. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
  5. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  6. package/Materials/Textures/texture.d.ts +2 -2
  7. package/Materials/Textures/texture.js +2 -2
  8. package/Materials/Textures/texture.js.map +1 -1
  9. package/Materials/clipPlaneMaterialHelper.js +22 -19
  10. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  11. package/Misc/khronosTextureContainer2.js +3 -5
  12. package/Misc/khronosTextureContainer2.js.map +1 -1
  13. package/Physics/v2/IPhysicsEnginePlugin.d.ts +6 -0
  14. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  15. package/Physics/v2/physicsAggregate.d.ts +21 -19
  16. package/Physics/v2/physicsAggregate.js +18 -4
  17. package/Physics/v2/physicsAggregate.js.map +1 -1
  18. package/Physics/v2/physicsBody.d.ts +15 -0
  19. package/Physics/v2/physicsBody.js +17 -0
  20. package/Physics/v2/physicsBody.js.map +1 -1
  21. package/Physics/v2/physicsShape.d.ts +30 -44
  22. package/Physics/v2/physicsShape.js +30 -44
  23. package/Physics/v2/physicsShape.js.map +1 -1
  24. package/Shaders/ShadersInclude/bumpFragment.js +1 -0
  25. package/Shaders/ShadersInclude/bumpFragment.js.map +1 -1
  26. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +1 -1
  27. package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
  28. package/Shaders/sprites.fragment.js +1 -1
  29. package/Shaders/sprites.fragment.js.map +1 -1
  30. package/assetContainer.js +1 -1
  31. package/assetContainer.js.map +1 -1
  32. package/package.json +1 -1
@@ -92,100 +92,86 @@ export declare class PhysicsShape {
92
92
  dispose(): void;
93
93
  }
94
94
  /**
95
- *
95
+ * Helper object to create a sphere shape
96
96
  */
97
- /** @internal */
98
97
  export declare class PhysicsShapeSphere extends PhysicsShape {
99
98
  /** @internal */
100
99
  /**
101
- *
102
- * @param center
103
- * @param radius
104
- * @param scene
100
+ * Constructor for the Sphere Shape
101
+ * @param center local center of the sphere
102
+ * @param radius radius
103
+ * @param scene scene to attach to
105
104
  */
106
105
  constructor(center: Vector3, radius: number, scene: Scene);
107
106
  }
108
107
  /***
109
- *
108
+ * Helper object to create a capsule shape
110
109
  */
111
- /** @internal */
112
110
  export declare class PhysicsShapeCapsule extends PhysicsShape {
113
- /** @internal */
114
111
  /**
115
112
  *
116
- * @param pointA
117
- * @param pointB
118
- * @param radius
119
- * @param scene
113
+ * @param pointA Starting point that defines the capsule segment
114
+ * @param pointB ending point of that same segment
115
+ * @param radius radius
116
+ * @param scene scene to attach to
120
117
  */
121
118
  constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene);
122
119
  }
123
120
  /**
124
- *
121
+ * Helper object to create a cylinder shape
125
122
  */
126
- /** @internal */
127
123
  export declare class PhysicsShapeCylinder extends PhysicsShape {
128
- /** @internal */
129
124
  /**
130
125
  *
131
- * @param pointA
132
- * @param pointB
133
- * @param radius
134
- * @param scene
126
+ * @param pointA Starting point that defines the cylinder segment
127
+ * @param pointB ending point of that same segment
128
+ * @param radius radius
129
+ * @param scene scene to attach to
135
130
  */
136
131
  constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene);
137
132
  }
138
133
  /**
139
- *
134
+ * Helper object to create a box shape
140
135
  */
141
- /** @internal */
142
136
  export declare class PhysicsShapeBox extends PhysicsShape {
143
- /** @internal */
144
137
  /**
145
138
  *
146
- * @param center
147
- * @param rotation
148
- * @param extents
149
- * @param scene
139
+ * @param center local center of the sphere
140
+ * @param rotation local orientation
141
+ * @param extents size of the box in each direction
142
+ * @param scene scene to attach to
150
143
  */
151
144
  constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene);
152
145
  }
153
146
  /**
154
- *
147
+ * Helper object to create a convex hull shape
155
148
  */
156
- /** @internal */
157
149
  export declare class PhysicsShapeConvexHull extends PhysicsShape {
158
- /** @internal */
159
150
  /**
160
151
  *
161
- * @param mesh
162
- * @param scene
152
+ * @param mesh the mesh to be used as topology infos for the convex hull
153
+ * @param scene scene to attach to
163
154
  */
164
155
  constructor(mesh: Mesh, scene: Scene);
165
156
  }
166
157
  /**
167
- *
158
+ * Helper object to create a mesh shape
168
159
  */
169
- /** @internal */
170
160
  export declare class PhysicsShapeMesh extends PhysicsShape {
171
- /** @internal */
172
161
  /**
173
162
  *
174
- * @param mesh
175
- * @param scene
163
+ * @param mesh the mesh topology that will be used to create the shape
164
+ * @param scene scene to attach to
176
165
  */
177
166
  constructor(mesh: Mesh, scene: Scene);
178
167
  }
179
168
  /**
180
- *
169
+ * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.
181
170
  */
182
- /** @internal */
183
171
  export declare class PhysicsShapeContainer extends PhysicsShape {
184
- /** @internal */
185
172
  /**
186
- *
187
- * @param mesh
188
- * @param scene
173
+ * Constructor of the Shape container
174
+ * @param scene scene to attach to
189
175
  */
190
- constructor(mesh: Mesh, scene: Scene);
176
+ constructor(scene: Scene);
191
177
  }
@@ -121,114 +121,100 @@ export class PhysicsShape {
121
121
  }
122
122
  }
123
123
  /**
124
- *
124
+ * Helper object to create a sphere shape
125
125
  */
126
- /** @internal */
127
126
  export class PhysicsShapeSphere extends PhysicsShape {
128
127
  /** @internal */
129
128
  /**
130
- *
131
- * @param center
132
- * @param radius
133
- * @param scene
129
+ * Constructor for the Sphere Shape
130
+ * @param center local center of the sphere
131
+ * @param radius radius
132
+ * @param scene scene to attach to
134
133
  */
135
134
  constructor(center, radius, scene) {
136
135
  super(ShapeType.SPHERE, { center: center, radius: radius }, scene);
137
136
  }
138
137
  }
139
138
  /***
140
- *
139
+ * Helper object to create a capsule shape
141
140
  */
142
- /** @internal */
143
141
  export class PhysicsShapeCapsule extends PhysicsShape {
144
- /** @internal */
145
142
  /**
146
143
  *
147
- * @param pointA
148
- * @param pointB
149
- * @param radius
150
- * @param scene
144
+ * @param pointA Starting point that defines the capsule segment
145
+ * @param pointB ending point of that same segment
146
+ * @param radius radius
147
+ * @param scene scene to attach to
151
148
  */
152
149
  constructor(pointA, pointB, radius, scene) {
153
150
  super(ShapeType.CAPSULE, { pointA: pointA, pointB: pointB, radius: radius }, scene);
154
151
  }
155
152
  }
156
153
  /**
157
- *
154
+ * Helper object to create a cylinder shape
158
155
  */
159
- /** @internal */
160
156
  export class PhysicsShapeCylinder extends PhysicsShape {
161
- /** @internal */
162
157
  /**
163
158
  *
164
- * @param pointA
165
- * @param pointB
166
- * @param radius
167
- * @param scene
159
+ * @param pointA Starting point that defines the cylinder segment
160
+ * @param pointB ending point of that same segment
161
+ * @param radius radius
162
+ * @param scene scene to attach to
168
163
  */
169
164
  constructor(pointA, pointB, radius, scene) {
170
165
  super(ShapeType.CYLINDER, { pointA: pointA, pointB: pointB, radius: radius }, scene);
171
166
  }
172
167
  }
173
168
  /**
174
- *
169
+ * Helper object to create a box shape
175
170
  */
176
- /** @internal */
177
171
  export class PhysicsShapeBox extends PhysicsShape {
178
- /** @internal */
179
172
  /**
180
173
  *
181
- * @param center
182
- * @param rotation
183
- * @param extents
184
- * @param scene
174
+ * @param center local center of the sphere
175
+ * @param rotation local orientation
176
+ * @param extents size of the box in each direction
177
+ * @param scene scene to attach to
185
178
  */
186
179
  constructor(center, rotation, extents, scene) {
187
180
  super(ShapeType.BOX, { center: center, rotation: rotation, extents: extents }, scene);
188
181
  }
189
182
  }
190
183
  /**
191
- *
184
+ * Helper object to create a convex hull shape
192
185
  */
193
- /** @internal */
194
186
  export class PhysicsShapeConvexHull extends PhysicsShape {
195
- /** @internal */
196
187
  /**
197
188
  *
198
- * @param mesh
199
- * @param scene
189
+ * @param mesh the mesh to be used as topology infos for the convex hull
190
+ * @param scene scene to attach to
200
191
  */
201
192
  constructor(mesh, scene) {
202
193
  super(ShapeType.CONVEX_HULL, { mesh: mesh }, scene);
203
194
  }
204
195
  }
205
196
  /**
206
- *
197
+ * Helper object to create a mesh shape
207
198
  */
208
- /** @internal */
209
199
  export class PhysicsShapeMesh extends PhysicsShape {
210
- /** @internal */
211
200
  /**
212
201
  *
213
- * @param mesh
214
- * @param scene
202
+ * @param mesh the mesh topology that will be used to create the shape
203
+ * @param scene scene to attach to
215
204
  */
216
205
  constructor(mesh, scene) {
217
206
  super(ShapeType.MESH, { mesh: mesh }, scene);
218
207
  }
219
208
  }
220
209
  /**
221
- *
210
+ * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.
222
211
  */
223
- /** @internal */
224
212
  export class PhysicsShapeContainer extends PhysicsShape {
225
- /** @internal */
226
213
  /**
227
- *
228
- * @param mesh
229
- * @param scene
214
+ * Constructor of the Shape container
215
+ * @param scene scene to attach to
230
216
  */
231
- constructor(mesh, scene) {
217
+ constructor(scene) {
232
218
  super(ShapeType.CONTAINER, {}, scene);
233
219
  }
234
220
  }
@@ -1 +1 @@
1
- {"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsShape.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAQnD;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAYrB;;;;;;;;;OASG;IACH,YAAY,IAAY,EAAE,UAAkC,EAAE,EAAE,KAAY;QArB5E;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAmBhC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B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port type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { ShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Quaternion } from \"../../Maths/math.vector\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: ShapeType;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param type The type of the shape.\r\n * @param options The options of the shape.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(type: number, options: PhysicsShapeParameters = {}, scene: Scene) {\r\n this._type = type;\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._physicsPlugin.initShape(this, type, options);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public get type(): ShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n *\r\n * @param layer\r\n */\r\n public setFilterLayer(layer: number): void {\r\n this._physicsPlugin.setFilterLayer(this, layer);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getFilterLayer(): number {\r\n return this._physicsPlugin.getFilterLayer(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param materialId\r\n */\r\n public setMaterial(material: PhysicsMaterial): void {\r\n this._physicsPlugin.setMaterial(this, material);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getMaterial(): PhysicsMaterial | undefined {\r\n return this._physicsPlugin.getMaterial(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param density\r\n */\r\n public setDensity(density: number): void {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getDensity(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param newChild\r\n * @param childTransform\r\n */\r\n public addChild(newChild: PhysicsShape, childTransform: TransformNode): void {\r\n this._physicsPlugin.addChild(this, newChild, childTransform);\r\n }\r\n\r\n /**\r\n *\r\n * @param childIndex\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public dispose() {\r\n this._physicsPlugin.disposeShape(this);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param center\r\n * @param radius\r\n * @param scene\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super(ShapeType.SPHERE, { center: center, radius: radius }, scene);\r\n }\r\n}\r\n\r\n/***\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param pointA\r\n * @param pointB\r\n * @param radius\r\n * @param scene\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super(ShapeType.CAPSULE, { pointA: pointA, pointB: pointB, radius: radius }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param pointA\r\n * @param pointB\r\n * @param radius\r\n * @param scene\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super(ShapeType.CYLINDER, { pointA: pointA, pointB: pointB, radius: radius }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param center\r\n * @param rotation\r\n * @param extents\r\n * @param scene\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super(ShapeType.BOX, { center: center, rotation: rotation, extents: extents }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param mesh\r\n * @param scene\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super(ShapeType.CONVEX_HULL, { mesh: mesh }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param mesh\r\n * @param scene\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super(ShapeType.MESH, { mesh: mesh }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n *\r\n * @param mesh\r\n * @param scene\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super(ShapeType.CONTAINER, {}, scene);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsShape.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAQnD;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAYrB;;;;;;;;;OASG;IACH,YAAY,IAAY,EAAE,UAAkC,EAAE,EAAE,KAAY;QArB5E;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAmBhC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QACD,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACvE;QACD,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,cAAc,GAAG,aAAuC,CAAC;QAC9D,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;;OAGG;IAC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,SAAS,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAC9C;;;;OAIG;IACH,YAAY,IAAU,EAAE,KAAY;QAChC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IACnD;;;OAGG;IACH,YAAY,KAAY;QACpB,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["import type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { ShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Quaternion } from \"../../Maths/math.vector\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: ShapeType;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param type The type of the shape.\r\n * @param options The options of the shape.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(type: number, options: PhysicsShapeParameters = {}, scene: Scene) {\r\n this._type = type;\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._physicsPlugin.initShape(this, type, options);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public get type(): ShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n *\r\n * @param layer\r\n */\r\n public setFilterLayer(layer: number): void {\r\n this._physicsPlugin.setFilterLayer(this, layer);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getFilterLayer(): number {\r\n return this._physicsPlugin.getFilterLayer(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param materialId\r\n */\r\n public setMaterial(material: PhysicsMaterial): void {\r\n this._physicsPlugin.setMaterial(this, material);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getMaterial(): PhysicsMaterial | undefined {\r\n return this._physicsPlugin.getMaterial(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param density\r\n */\r\n public setDensity(density: number): void {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getDensity(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param newChild\r\n * @param childTransform\r\n */\r\n public addChild(newChild: PhysicsShape, childTransform: TransformNode): void {\r\n this._physicsPlugin.addChild(this, newChild, childTransform);\r\n }\r\n\r\n /**\r\n *\r\n * @param childIndex\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public dispose() {\r\n this._physicsPlugin.disposeShape(this);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /** @internal */\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super(ShapeType.SPHERE, { center: center, radius: radius }, scene);\r\n }\r\n}\r\n\r\n/***\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super(ShapeType.CAPSULE, { pointA: pointA, pointB: pointB, radius: radius }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super(ShapeType.CYLINDER, { pointA: pointA, pointB: pointB, radius: radius }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the sphere\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super(ShapeType.BOX, { center: center, rotation: rotation, extents: extents }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super(ShapeType.CONVEX_HULL, { mesh: mesh }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super(ShapeType.MESH, { mesh: mesh }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super(ShapeType.CONTAINER, {}, scene);\r\n }\r\n}\r\n"]}
@@ -24,6 +24,7 @@ uvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);
24
24
  vec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);
25
25
  #ifdef BUMP
26
26
  #ifdef OBJECTSPACE_NORMALMAP
27
+ #define CUSTOM_FRAGMENT_BUMP_FRAGMENT
27
28
  normalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);
28
29
  normalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);
29
30
  vec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;
@@ -1 +1 @@
1
- {"version":3,"file":"bumpFragment.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Shaders/ShadersInclude/bumpFragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,cAAc,CAAC;AAC5B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Dd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"bumpFragment\";\nconst shader = `vec2 uvOffset=vec2(0.0,0.0);\r#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\r#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\r#else\nfloat normalScale=1.0;\r#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\r#elif defined(BUMP)\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;\rmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\r#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;\rmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\r#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\r#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;\rmat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\r#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\r#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\r#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\r#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\rvec2 detailNormalRG=detailColor.wy*2.0-1.0;\rfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\rvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\r#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);\rnormalW=normalize(mat3(normalMatrix)*normalW);\r#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\r#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\r#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;\rvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\r#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;\rbumpNormal+=vec3(0.0,0.0,1.0);\rdetailNormal*=vec3(-1.0,-1.0,1.0);\rvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\r#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\r#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\rnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\r#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragment = { name, shader };\n"]}
1
+ {"version":3,"file":"bumpFragment.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Shaders/ShadersInclude/bumpFragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,cAAc,CAAC;AAC5B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"bumpFragment\";\nconst shader = `vec2 uvOffset=vec2(0.0,0.0);\r#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\r#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\r#else\nfloat normalScale=1.0;\r#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\r#elif defined(BUMP)\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;\rmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\r#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;\rmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\r#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\r#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;\rmat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\r#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\r#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\r#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\r#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\rvec2 detailNormalRG=detailColor.wy*2.0-1.0;\rfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\rvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\r#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);\rnormalW=normalize(mat3(normalMatrix)*normalW);\r#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\r#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\r#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;\rvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\r#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;\rbumpNormal+=vec3(0.0,0.0,1.0);\rdetailNormal*=vec3(-1.0,-1.0,1.0);\rvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\r#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\r#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\rnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\r#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragment = { name, shader };\n"]}
@@ -5,7 +5,7 @@ const shader = `#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTRO
5
5
  #if defined(TANGENT) && defined(NORMAL)
6
6
  varying mat3 vTBN;
7
7
  #ifdef OBJECTSPACE_NORMALMAP
8
- uniform mat4 normalMatrix;
8
+ uniform mat4 normalMatrix;
9
9
  vec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)
10
10
  normal=normalize(normal*vec3(scale,scale,1.0));
11
11
  return normalize(cotangentFrame*normal);
@@ -1 +1 @@
1
- {"version":3,"file":"bumpFragmentMainFunctions.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Shaders/ShadersInclude/bumpFragmentMainFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,2BAA2B,CAAC;AACzC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"bumpFragmentMainFunctions\";\nconst shader = `#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\r#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\r#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\r{\r#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\r#endif\nreturn normalize(cotangentFrame*normal);\r}\rvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\r{\rreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\r}\rmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\r{\rvec3 dp1=dFdx(p);\rvec3 dp2=dFdy(p);\rvec2 duv1=dFdx(uv);\rvec2 duv2=dFdy(uv);\rvec3 dp2perp=cross(dp2,normal);\rvec3 dp1perp=cross(normal,dp1);\rvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\rvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\rtangent*=tangentSpaceParams.x;\rbitangent*=tangentSpaceParams.y;\rfloat det=max(dot(tangent,tangent),dot(bitangent,bitangent));\rfloat invmax=det==0.0 ? 0.0 : inversesqrt(det);\rreturn mat3(tangent*invmax,bitangent*invmax,normal);\r}\r#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragmentMainFunctions = { name, shader };\n"]}
1
+ {"version":3,"file":"bumpFragmentMainFunctions.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Shaders/ShadersInclude/bumpFragmentMainFunctions.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,2BAA2B,CAAC;AACzC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Cd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"bumpFragmentMainFunctions\";\nconst shader = `#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\r#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\rmat4 toNormalMatrix(mat4 wMatrix)\r{\rmat4 ret=inverse(wMatrix);\rret=transpose(ret);\rret[0][3]=0.;\rret[1][3]=0.;\rret[2][3]=0.;\rret[3]=vec4(0.,0.,0.,1.);\rreturn ret;\r}\r#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\r{\r#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\r#endif\nreturn normalize(cotangentFrame*normal);\r}\rvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\r{\rreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\r}\rmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\r{\rvec3 dp1=dFdx(p);\rvec3 dp2=dFdy(p);\rvec2 duv1=dFdx(uv);\rvec2 duv2=dFdy(uv);\rvec3 dp2perp=cross(dp2,normal);\rvec3 dp1perp=cross(normal,dp1);\rvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\rvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\rtangent*=tangentSpaceParams.x;\rbitangent*=tangentSpaceParams.y;\rfloat det=max(dot(tangent,tangent),dot(bitangent,bitangent));\rfloat invmax=det==0.0 ? 0.0 : inversesqrt(det);\rreturn mat3(tangent*invmax,bitangent*invmax,normal);\r}\r#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragmentMainFunctions = { name, shader };\n"]}
@@ -7,7 +7,7 @@ const name = "spritesPixelShader";
7
7
  const shader = `uniform bool alphaTest;
8
8
  #define CUSTOM_FRAGMENT_DEFINITIONS
9
9
  void main(void) {
10
- vec4 color=texture2D(diffuseSampler,vUV);
10
+ vec4 color=texture2D(diffuseSampler,vUV);
11
11
  gl_FragColor=color;
12
12
  #define CUSTOM_FRAGMENT_MAIN_END
13
13
  }`;
@@ -1 +1 @@
1
- {"version":3,"file":"sprites.fragment.js","sourceRoot":"","sources":["../../../../lts/core/generated/Shaders/sprites.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,yCAAyC,CAAC;AACjD,OAAO,8BAA8B,CAAC;AACtC,OAAO,+CAA+C,CAAC;AAEvD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;EAmBb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/fogFragmentDeclaration\";\nimport \"./ShadersInclude/fogFragment\";\nimport \"./ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"spritesPixelShader\";\nconst shader = `uniform bool alphaTest;\rvarying vec4 vColor;\rvarying vec2 vUV;\runiform sampler2D diffuseSampler;\r#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\r#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 color=texture2D(diffuseSampler,vUV);\rif (float(alphaTest) != 0.)\r{\rif (color.a<0.95)\rdiscard;\r}\rcolor*=vColor;\r#include<fogFragment>\ngl_FragColor=color;\r#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const spritesPixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"sprites.fragment.js","sourceRoot":"","sources":["../../../../lts/core/generated/Shaders/sprites.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,yCAAyC,CAAC;AACjD,OAAO,8BAA8B,CAAC;AACtC,OAAO,+CAA+C,CAAC;AAEvD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;EAoBb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/fogFragmentDeclaration\";\nimport \"./ShadersInclude/fogFragment\";\nimport \"./ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"spritesPixelShader\";\nconst shader = `uniform bool alphaTest;\rvarying vec4 vColor;\rvarying vec2 vUV;\runiform sampler2D diffuseSampler;\r#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\r#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 color=texture2D(diffuseSampler,vUV);\rfloat fAlphaTest=float(alphaTest);\rif (fAlphaTest != 0.)\r{\rif (color.a<0.95)\rdiscard;\r}\rcolor*=vColor;\r#include<fogFragment>\ngl_FragColor=color;\r#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const spritesPixelShader = { name, shader };\n"]}
package/assetContainer.js CHANGED
@@ -363,7 +363,7 @@ export class AssetContainer extends AbstractScene {
363
363
  }
364
364
  else {
365
365
  // Mesh or TransformNode
366
- const canInstance = !(options === null || options === void 0 ? void 0 : options.doNotInstantiate) && node._isMesh;
366
+ const canInstance = !(localOptions === null || localOptions === void 0 ? void 0 : localOptions.doNotInstantiate) && node.getTotalVertices() > 0;
367
367
  const replicatedNode = canInstance ? node.createInstance(`instance of ${node.name}`) : node.clone(`Clone of ${node.name}`, null, true);
368
368
  if (!replicatedNode) {
369
369
  throw new Error(`Could not clone or instantiate node on Asset Container ${node.name}`);