r3-legacy/src/r3-d3-api-geometry-buffer-t...

68 lines
1.6 KiB
JavaScript

/**
* R3.D3.API.Geometry.Buffer.Torus
* @param apiGeometry
* @param radius
* @param tube
* @param radialSegments
* @param tubularSegments
* @param arc
* @constructor
*/
R3.D3.API.Geometry.Buffer.Torus = function(
apiGeometry,
radius,
tube,
radialSegments,
tubularSegments,
arc
) {
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry = {
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS
};
}
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS;
}
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 = 6;
}
this.tubularSegments = tubularSegments;
if (R3.Utils.UndefinedOrNull(arc)) {
arc = Math.PI * 2;
}
this.arc = arc;
R3.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
};
R3.D3.API.Geometry.Buffer.Torus.prototype = Object.create(R3.D3.API.Geometry.Buffer.prototype);
R3.D3.API.Geometry.Buffer.Torus.prototype.constructor = R3.D3.API.Geometry.Buffer.Torus;