107 lines
2.5 KiB
JavaScript
107 lines
2.5 KiB
JavaScript
|
/**
|
||
|
* GameLib.D3.API.Mesh.Cylinder
|
||
|
* @constructor
|
||
|
* @param apiMesh
|
||
|
* @param radiusTop
|
||
|
* @param radiusBottom
|
||
|
* @param height
|
||
|
* @param radiusSegments
|
||
|
* @param heightSegments
|
||
|
* @param openEnded
|
||
|
* @param thetaStart
|
||
|
* @param thetaLength
|
||
|
*/
|
||
|
GameLib.D3.API.Mesh.Cylinder = function(
|
||
|
apiMesh,
|
||
|
radiusTop,
|
||
|
radiusBottom,
|
||
|
height,
|
||
|
radiusSegments,
|
||
|
heightSegments,
|
||
|
openEnded,
|
||
|
thetaStart,
|
||
|
thetaLength
|
||
|
) {
|
||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||
|
apiMesh = {
|
||
|
meshType : GameLib.D3.API.Mesh.MESH_TYPE_CYLINDER
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh.meshType)) {
|
||
|
apiMesh.meshType = GameLib.D3.API.Mesh.MESH_TYPE_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 = 5;
|
||
|
}
|
||
|
this.height = height;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(radiusSegments)) {
|
||
|
radiusSegments = 10;
|
||
|
}
|
||
|
this.radiusSegments = radiusSegments;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||
|
heightSegments = 10;
|
||
|
}
|
||
|
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.Mesh.call(
|
||
|
this,
|
||
|
apiMesh.id,
|
||
|
apiMesh.name,
|
||
|
apiMesh.meshType,
|
||
|
apiMesh.excludeFromEnvironment,
|
||
|
apiMesh.vertices,
|
||
|
apiMesh.faces,
|
||
|
apiMesh.materials,
|
||
|
apiMesh.parentMesh,
|
||
|
apiMesh.parentScene,
|
||
|
apiMesh.skeleton,
|
||
|
apiMesh.skinIndices,
|
||
|
apiMesh.skinWeights,
|
||
|
apiMesh.position,
|
||
|
apiMesh.quaternion,
|
||
|
apiMesh.rotation,
|
||
|
apiMesh.scale,
|
||
|
apiMesh.up,
|
||
|
apiMesh.modelMatrix,
|
||
|
apiMesh.renderOrder,
|
||
|
apiMesh.isBufferMesh,
|
||
|
apiMesh.useQuaternion,
|
||
|
apiMesh.visible,
|
||
|
apiMesh.castShadow,
|
||
|
apiMesh.receiveShadow,
|
||
|
apiMesh.parentEntity
|
||
|
);
|
||
|
};
|
||
|
|
||
|
GameLib.D3.API.Mesh.Cylinder.prototype = Object.create(GameLib.D3.API.Mesh.prototype);
|
||
|
GameLib.D3.API.Mesh.Cylinder.prototype.constructor = GameLib.D3.API.Mesh.Cylinder;
|