|
@@ -1,6 +1,16 @@
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
var SolidParticle = (function () {
|
|
|
+ /**
|
|
|
+ * Creates a Solid Particle object.
|
|
|
+ * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()
|
|
|
+ * `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier.
|
|
|
+ * `positionIndex` (integer) is the starting index of the particle vertices in the SPS "positions" array.
|
|
|
+ * `model` (ModelShape) is a reference to the model shape on what the particle is designed.
|
|
|
+ * `shapeId` (integer) is the model shape identifier in the SPS.
|
|
|
+ * `idxInShape` (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))
|
|
|
+ * `modelBoundingInfo` is the reference to the model BoundingInfo used for intersection computations.
|
|
|
+ */
|
|
|
function SolidParticle(particleIndex, positionIndex, model, shapeId, idxInShape, modelBoundingInfo) {
|
|
|
this.idx = 0; // particle global index
|
|
|
this.color = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0); // color
|
|
@@ -25,7 +35,9 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
Object.defineProperty(SolidParticle.prototype, "scale", {
|
|
|
- //legacy support, changed scale to scaling
|
|
|
+ /**
|
|
|
+ * legacy support, changed scale to scaling
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this.scaling;
|
|
|
},
|
|
@@ -36,7 +48,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(SolidParticle.prototype, "quaternion", {
|
|
|
- //legacy support, changed quaternion to rotationQuaternion
|
|
|
+ /**
|
|
|
+ * legacy support, changed quaternion to rotationQuaternion
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this.rotationQuaternion;
|
|
|
},
|
|
@@ -46,10 +60,12 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ /**
|
|
|
+ * Returns a boolean. True if the particle intersects another particle or another mesh, else false.
|
|
|
+ * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)
|
|
|
+ * `target` is the object (solid particle or mesh) what the intersection is computed against.
|
|
|
+ */
|
|
|
SolidParticle.prototype.intersectsMesh = function (target) {
|
|
|
- if (!(this.isVisible && target.isVisible)) {
|
|
|
- return false; // only visible particle and target can intersect
|
|
|
- }
|
|
|
if (!this._boundingInfo || !target._boundingInfo) {
|
|
|
return false;
|
|
|
}
|
|
@@ -59,6 +75,10 @@ var BABYLON;
|
|
|
}());
|
|
|
BABYLON.SolidParticle = SolidParticle;
|
|
|
var ModelShape = (function () {
|
|
|
+ /**
|
|
|
+ * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.
|
|
|
+ * SPS internal tool, don't use it manually.
|
|
|
+ */
|
|
|
function ModelShape(id, shape, shapeUV, posFunction, vtxFunction) {
|
|
|
this.shapeID = id;
|
|
|
this._shape = shape;
|