r3-legacy/bak/r3-d3-api-mesh-cylinder.js

107 lines
2.5 KiB
JavaScript

/**
* R3.D3.API.Mesh.Cylinder
* @constructor
* @param apiMesh
* @param radiusTop
* @param radiusBottom
* @param height
* @param radiusSegments
* @param heightSegments
* @param openEnded
* @param thetaStart
* @param thetaLength
*/
R3.D3.API.Mesh.Cylinder = function(
apiMesh,
radiusTop,
radiusBottom,
height,
radiusSegments,
heightSegments,
openEnded,
thetaStart,
thetaLength
) {
if (R3.Utils.UndefinedOrNull(apiMesh)) {
apiMesh = {
meshType : R3.D3.API.Mesh.MESH_TYPE_CYLINDER
};
}
if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) {
apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_CYLINDER;
}
if (R3.Utils.UndefinedOrNull(radiusTop)) {
radiusTop = 1;
}
this.radiusTop = radiusTop;
if (R3.Utils.UndefinedOrNull(radiusBottom)) {
radiusBottom = 1;
}
this.radiusBottom = radiusBottom;
if (R3.Utils.UndefinedOrNull(height)) {
height = 5;
}
this.height = height;
if (R3.Utils.UndefinedOrNull(radiusSegments)) {
radiusSegments = 10;
}
this.radiusSegments = radiusSegments;
if (R3.Utils.UndefinedOrNull(heightSegments)) {
heightSegments = 10;
}
this.heightSegments = heightSegments;
if (R3.Utils.UndefinedOrNull(openEnded)) {
openEnded = false;
}
this.openEnded = openEnded;
if (R3.Utils.UndefinedOrNull(thetaStart)) {
thetaStart = 0;
}
this.thetaStart = thetaStart;
if (R3.Utils.UndefinedOrNull(thetaLength)) {
thetaLength = Math.PI * 2;
}
this.thetaLength = thetaLength;
R3.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
);
};
R3.D3.API.Mesh.Cylinder.prototype = Object.create(R3.D3.API.Mesh.prototype);
R3.D3.API.Mesh.Cylinder.prototype.constructor = R3.D3.API.Mesh.Cylinder;