75 lines
1.7 KiB
JavaScript
75 lines
1.7 KiB
JavaScript
/**
|
|
* R3.D3.API.Geometry.Buffer.TorusKnot
|
|
* @param apiGeometry
|
|
* @param radius
|
|
* @param tube
|
|
* @param radialSegments
|
|
* @param tubularSegments
|
|
* @param p
|
|
* @param q
|
|
* @constructor
|
|
*/
|
|
R3.D3.API.Geometry.Buffer.TorusKnot = function(
|
|
apiGeometry,
|
|
radius,
|
|
tube,
|
|
radialSegments,
|
|
tubularSegments,
|
|
p,
|
|
q
|
|
) {
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
|
apiGeometry = {
|
|
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT
|
|
};
|
|
}
|
|
|
|
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT;
|
|
}
|
|
|
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
|
radius = 1;
|
|
}
|
|
this.radius = radius;
|
|
|
|
if (R3.Utils.UndefinedOrNull(tube)) {
|
|
tube = 0.4;
|
|
}
|
|
this.tube = tube;
|
|
|
|
if (R3.Utils.UndefinedOrNull(radialSegments)) {
|
|
radialSegments = 8;
|
|
}
|
|
this.radialSegments = radialSegments;
|
|
|
|
if (R3.Utils.UndefinedOrNull(tubularSegments)) {
|
|
tubularSegments = 64;
|
|
}
|
|
this.tubularSegments = tubularSegments;
|
|
|
|
if (R3.Utils.UndefinedOrNull(p)) {
|
|
p = 2;
|
|
}
|
|
this.p = p;
|
|
|
|
if (R3.Utils.UndefinedOrNull(q)) {
|
|
q = 3;
|
|
}
|
|
this.q = q;
|
|
|
|
R3.D3.API.Geometry.Buffer.call(
|
|
this,
|
|
apiGeometry,
|
|
apiGeometry.attributes,
|
|
apiGeometry.drawRange,
|
|
apiGeometry.groups,
|
|
apiGeometry.index,
|
|
apiGeometry.morphAttributes
|
|
);
|
|
};
|
|
|
|
R3.D3.API.Geometry.Buffer.TorusKnot.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);
|
|
R3.D3.API.Geometry.Buffer.TorusKnot.prototype.constructor = R3.D3.API.Geometry.Buffer.TorusKnot;
|