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

99 lines
2.4 KiB
JavaScript
Raw Normal View History

2018-02-09 16:08:43 +01:00
/**
* GameLib.D3.API.Geometry.Cone
* @param apiGeometry
* @param radius
* @param height
* @param radialSegments
* @param heightSegments
* @param openEnded
* @param thetaStart
* @param thetaLength
* @constructor
*/
GameLib.D3.API.Geometry.Cone = function(
apiGeometry,
radius,
height,
radialSegments,
heightSegments,
openEnded,
thetaStart,
thetaLength
) {
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
apiGeometry = {
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE
};
}
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE;
}
if (GameLib.Utils.UndefinedOrNull(radius)) {
radius = 1;
}
this.radius = radius;
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.call(
this,
apiGeometry.id,
apiGeometry.name,
apiGeometry.geometryType,
apiGeometry.isBuffer,
apiGeometry.parentEntity,
apiGeometry.boundingBox,
apiGeometry.boundingSphere,
apiGeometry.colors,
apiGeometry.faces,
apiGeometry.faceVertexUvs,
apiGeometry.lineDistances,
apiGeometry.morphTargets,
apiGeometry.morphNormals,
apiGeometry.skinWeights,
apiGeometry.skinIndices,
apiGeometry.vertices,
apiGeometry.verticesNeedsUpdate,
apiGeometry.elementsNeedUpdate,
apiGeometry.uvsNeedUpdate,
apiGeometry.normalsNeedUpdate,
apiGeometry.colorsNeedUpdate,
apiGeometry.groupsNeedUpdate,
apiGeometry.lineDistancesNeedUpdate
);
};
GameLib.D3.API.Geometry.Cone.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
GameLib.D3.API.Geometry.Cone.prototype.constructor = GameLib.D3.API.Geometry.Cone;