r3-legacy/src/game-lib-d3-api-geometry-bu...

75 lines
1.9 KiB
JavaScript

/**
* GameLib.D3.API.Geometry.Buffer.Ring
* @param apiGeometry
* @param innerRadius
* @param outerRadius
* @param thetaSegments
* @param phiSegments
* @param thetaStart
* @param thetaLength
* @constructor
*/
GameLib.D3.API.Geometry.Buffer.Ring = function(
apiGeometry,
innerRadius,
outerRadius,
thetaSegments,
phiSegments,
thetaStart,
thetaLength
) {
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry = {
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING
};
}
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING;
}
if (GameLib.Utils.UndefinedOrNull(innerRadius)) {
innerRadius = 0.5;
}
this.innerRadius = innerRadius;
if (GameLib.Utils.UndefinedOrNull(outerRadius)) {
outerRadius = 1;
}
this.outerRadius = outerRadius;
if (GameLib.Utils.UndefinedOrNull(thetaSegments)) {
thetaSegments = 8;
}
this.thetaSegments = thetaSegments;
if (GameLib.Utils.UndefinedOrNull(phiSegments)) {
phiSegments = 8;
}
this.phiSegments = phiSegments;
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
thetaStart = 0;
}
this.thetaStart = thetaStart;
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
thetaLength = Math.PI * 2;
}
this.thetaLength = thetaLength;
GameLib.D3.API.Geometry.Buffer.call(
this,
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
);
};
GameLib.D3.API.Geometry.Buffer.Ring.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
GameLib.D3.API.Geometry.Buffer.Ring.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Ring;