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

129 lines
3.0 KiB
JavaScript

/**
* R3.D3.API.Mesh.Plane
* @constructor
* @param apiMesh
* @param width
* @param height
* @param widthSegments
* @param heightSegments
* @param heightMapScale
* @param isHeightMap
* @param isDotMap
* @param dotMapScale
* @param dotMapOffset
* @param dotMapWeight
* @param dotObject
*/
R3.D3.API.Mesh.Plane = function(
apiMesh,
width,
height,
widthSegments,
heightSegments,
heightMapScale,
isHeightMap,
isDotMap,
dotMapScale,
dotMapOffset,
dotMapWeight,
dotObject
) {
if (R3.Utils.UndefinedOrNull(apiMesh)) {
apiMesh = {
meshType : R3.D3.API.Mesh.MESH_TYPE_PLANE
};
}
if (R3.Utils.UndefinedOrNull(apiMesh.meshType)) {
apiMesh.meshType = R3.D3.API.Mesh.MESH_TYPE_PLANE;
}
if (R3.Utils.UndefinedOrNull(width)) {
width = 1;
}
this.width = width;
if (R3.Utils.UndefinedOrNull(height)) {
height = 1;
}
this.height = height;
if (R3.Utils.UndefinedOrNull(widthSegments)) {
widthSegments = 5;
}
this.widthSegments = widthSegments;
if (R3.Utils.UndefinedOrNull(heightSegments)) {
heightSegments = 5;
}
this.heightSegments = heightSegments;
if (R3.Utils.UndefinedOrNull(heightMapScale)) {
heightMapScale = 1;
}
this.heightMapScale = heightMapScale;
if (R3.Utils.UndefinedOrNull(isHeightMap)) {
isHeightMap = false;
}
this.isHeightMap = isHeightMap;
if (R3.Utils.UndefinedOrNull(isDotMap)) {
isDotMap = false;
}
this.isDotMap = isDotMap;
if (R3.Utils.UndefinedOrNull(dotMapScale)) {
dotMapScale = new R3.API.Vector3(0.01, 0.01, 0.01);
}
this.dotMapScale = dotMapScale;
if (R3.Utils.UndefinedOrNull(dotMapOffset)) {
dotMapOffset = new R3.API.Vector3(1, -1, 5);
}
this.dotMapOffset = dotMapOffset;
if (R3.Utils.UndefinedOrNull(dotMapWeight)) {
dotMapWeight = new R3.API.Vector3(1, 1, 1);
}
this.dotMapWeight = dotMapWeight;
if (R3.Utils.UndefinedOrNull(dotObject)) {
dotObject = null;
}
this.dotObject = dotObject;
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.Plane.prototype = Object.create(R3.D3.API.Mesh.prototype);
R3.D3.API.Mesh.Plane.prototype.constructor = R3.D3.API.Mesh.Plane;