90 lines
2.2 KiB
JavaScript
90 lines
2.2 KiB
JavaScript
|
/**
|
||
|
* R3.D3.API.Geometry.Normal.Sphere
|
||
|
* @param apiGeometry
|
||
|
* @param radius
|
||
|
* @param widthSegments
|
||
|
* @param heightSegments
|
||
|
* @param phiStart
|
||
|
* @param phiLength
|
||
|
* @param thetaStart
|
||
|
* @param thetaLength
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.D3.API.Geometry.Normal.Sphere = function(
|
||
|
apiGeometry,
|
||
|
radius,
|
||
|
widthSegments,
|
||
|
heightSegments,
|
||
|
phiStart,
|
||
|
phiLength,
|
||
|
thetaStart,
|
||
|
thetaLength
|
||
|
) {
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(apiGeometry)) {
|
||
|
apiGeometry = {
|
||
|
geometryType: R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||
|
apiGeometry.geometryType = R3.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE;
|
||
|
}
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(radius)) {
|
||
|
radius = 1;
|
||
|
}
|
||
|
this.radius = radius;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(widthSegments)) {
|
||
|
widthSegments = 8;
|
||
|
}
|
||
|
this.widthSegments = widthSegments;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(heightSegments)) {
|
||
|
heightSegments = 6;
|
||
|
}
|
||
|
this.heightSegments = heightSegments;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(phiStart)) {
|
||
|
phiStart = 0;
|
||
|
}
|
||
|
this.phiStart = phiStart;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(phiLength)) {
|
||
|
phiLength = Math.PI * 2;
|
||
|
}
|
||
|
this.phiLength = phiLength;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(thetaStart)) {
|
||
|
thetaStart = 0;
|
||
|
}
|
||
|
this.thetaStart = thetaStart;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(thetaLength)) {
|
||
|
thetaLength = Math.PI;
|
||
|
}
|
||
|
this.thetaLength = thetaLength;
|
||
|
|
||
|
R3.D3.API.Geometry.Normal.call(
|
||
|
this,
|
||
|
apiGeometry,
|
||
|
apiGeometry.colors,
|
||
|
apiGeometry.lineDistances,
|
||
|
apiGeometry.morphTargets,
|
||
|
apiGeometry.morphNormals,
|
||
|
apiGeometry.skinWeights,
|
||
|
apiGeometry.skinIndices,
|
||
|
apiGeometry.verticesNeedsUpdate,
|
||
|
apiGeometry.elementsNeedUpdate,
|
||
|
apiGeometry.uvsNeedUpdate,
|
||
|
apiGeometry.normalsNeedUpdate,
|
||
|
apiGeometry.colorsNeedUpdate,
|
||
|
apiGeometry.groupsNeedUpdate,
|
||
|
apiGeometry.lineDistancesNeedUpdate
|
||
|
);
|
||
|
};
|
||
|
|
||
|
R3.D3.API.Geometry.Normal.Sphere.prototype = Object.create(R3.D3.API.Geometry.Normal.prototype);
|
||
|
R3.D3.API.Geometry.Normal.Sphere.prototype.constructor = R3.D3.API.Geometry.Normal.Sphere;
|