122 lines
2.8 KiB
JavaScript
122 lines
2.8 KiB
JavaScript
/**
|
|
* Raw Mesh.Plane API object
|
|
* @constructor
|
|
* @param apiMesh
|
|
* @param width
|
|
* @param height
|
|
* @param widthSegments
|
|
* @param heightSegments
|
|
* @param heightMapScale
|
|
* @param isHeightMap
|
|
* @param isDotMap
|
|
* @param dotObject
|
|
*/
|
|
GameLib.D3.API.Mesh.Plane = function(
|
|
apiMesh,
|
|
width,
|
|
height,
|
|
widthSegments,
|
|
heightSegments,
|
|
heightMapScale,
|
|
isHeightMap,
|
|
isDotMap,
|
|
dotObject
|
|
) {
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
|
apiMesh = {
|
|
meshType : GameLib.D3.API.Mesh.MESH_TYPE_PLANE
|
|
};
|
|
}
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
|
width = 1;
|
|
}
|
|
this.width = width;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
|
height = 1;
|
|
}
|
|
this.height = height;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
|
widthSegments = 5;
|
|
}
|
|
this.widthSegments = widthSegments;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
|
heightSegments = 5;
|
|
}
|
|
this.heightSegments = heightSegments;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(heightMapScale)) {
|
|
heightMapScale = 1;
|
|
}
|
|
this.heightMapScale = heightMapScale;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(isHeightMap)) {
|
|
isHeightMap = false;
|
|
}
|
|
this.isHeightMap = isHeightMap;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(isDotMap)) {
|
|
isDotMap = false;
|
|
}
|
|
this.isDotMap = isDotMap;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(dotObject)) {
|
|
dotObject = null;
|
|
}
|
|
this.dotObject = dotObject;
|
|
|
|
GameLib.D3.API.Mesh.call(
|
|
this,
|
|
apiMesh.id,
|
|
apiMesh.meshType,
|
|
apiMesh.name,
|
|
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.parentEntity
|
|
);
|
|
};
|
|
|
|
GameLib.D3.API.Mesh.Plane.prototype = Object.create(GameLib.D3.API.Mesh.prototype);
|
|
GameLib.D3.API.Mesh.Plane.prototype.constructor = GameLib.D3.API.Mesh.Plane;
|
|
|
|
/**
|
|
* Returns an API Mesh from an Object mesh
|
|
* @param objectMesh
|
|
* @constructor
|
|
*/
|
|
GameLib.D3.API.Mesh.Plane.FromObject = function (objectMesh){
|
|
|
|
return new GameLib.D3.API.Mesh.Plane(
|
|
GameLib.D3.API.Mesh.FromObject(objectMesh),
|
|
objectMesh.width,
|
|
objectMesh.height,
|
|
objectMesh.widthSegments,
|
|
objectMesh.heightSegments,
|
|
objectMesh.heightMapScale,
|
|
objectMesh.isHeightMap,
|
|
objectMesh.isDotMap,
|
|
GameLib.Utils.IdOrNull(objectMesh.dotObject)
|
|
);
|
|
|
|
};
|