89 lines
2.2 KiB
JavaScript
89 lines
2.2 KiB
JavaScript
|
/**
|
||
|
* GameLib.D3.API.Geometry.Buffer.Cylinder
|
||
|
* @param apiGeometry
|
||
|
* @param radiusTop
|
||
|
* @param radiusBottom
|
||
|
* @param height
|
||
|
* @param radialSegments
|
||
|
* @param heightSegments
|
||
|
* @param openEnded
|
||
|
* @param thetaStart
|
||
|
* @param thetaLength
|
||
|
* @constructor
|
||
|
*/
|
||
|
GameLib.D3.API.Geometry.Buffer.Cylinder = function(
|
||
|
apiGeometry,
|
||
|
radiusTop,
|
||
|
radiusBottom,
|
||
|
height,
|
||
|
radialSegments,
|
||
|
heightSegments,
|
||
|
openEnded,
|
||
|
thetaStart,
|
||
|
thetaLength
|
||
|
) {
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||
|
apiGeometry = {
|
||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER;
|
||
|
}
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
||
|
radiusTop = 1;
|
||
|
}
|
||
|
this.radiusTop = radiusTop;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(radiusBottom)) {
|
||
|
radiusBottom = 1;
|
||
|
}
|
||
|
this.radiusBottom = radiusBottom;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
||
|
height = 100;
|
||
|
}
|
||
|
this.height = height;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
||
|
radialSegments = 8;
|
||
|
}
|
||
|
this.radialSegments = radialSegments;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||
|
heightSegments = 1;
|
||
|
}
|
||
|
this.heightSegments = heightSegments;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(openEnded)) {
|
||
|
openEnded = false;
|
||
|
}
|
||
|
this.openEnded = openEnded;
|
||
|
|
||
|
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.Cylinder.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||
|
GameLib.D3.API.Geometry.Buffer.Cylinder.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Cylinder;
|