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

89 lines
2.2 KiB
JavaScript
Raw Normal View History

2018-02-09 16:08:43 +01:00
/**
2018-02-11 16:57:28 +01:00
* GameLib.D3.API.Geometry.Buffer.Cylinder
2018-02-09 16:08:43 +01:00
* @param apiGeometry
* @param radiusTop
* @param radiusBottom
* @param height
* @param radialSegments
* @param heightSegments
* @param openEnded
* @param thetaStart
* @param thetaLength
* @constructor
*/
2018-02-11 16:57:28 +01:00
GameLib.D3.API.Geometry.Buffer.Cylinder = function(
2018-02-09 16:08:43 +01:00
apiGeometry,
radiusTop,
radiusBottom,
height,
radialSegments,
heightSegments,
openEnded,
thetaStart,
thetaLength
) {
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry = {
2018-02-11 16:57:28 +01:00
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER
2018-02-09 16:08:43 +01:00
};
}
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
2018-02-11 16:57:28 +01:00
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER;
2018-02-09 16:08:43 +01:00
}
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;
2018-02-11 16:57:28 +01:00
GameLib.D3.API.Geometry.Buffer.call(
2018-02-09 16:08:43 +01:00
this,
2018-02-11 16:57:28 +01:00
apiGeometry,
apiGeometry.attributes,
apiGeometry.drawRange,
apiGeometry.groups,
apiGeometry.index,
apiGeometry.morphAttributes
2018-02-09 16:08:43 +01:00
);
};
2018-02-11 16:57:28 +01:00
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;