start api.mesh.plane
parent
ff68ee618f
commit
ce3ad977a1
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* Raw Mesh.Plane API object
|
||||
* @constructor
|
||||
* @param apiMesh
|
||||
* @param width
|
||||
* @param height
|
||||
* @param widthSegments
|
||||
* @param heightSegments
|
||||
* @param heightMapScale
|
||||
* @param isHeightMap
|
||||
* @param isDotMap
|
||||
* @param distanceFromOrigin
|
||||
*/
|
||||
GameLib.D3.API.Mesh.Plane = function(
|
||||
apiMesh,
|
||||
width,
|
||||
height,
|
||||
widthSegments,
|
||||
heightSegments,
|
||||
heightMapScale,
|
||||
isHeightMap,
|
||||
isDotMap,
|
||||
distanceFromOrigin
|
||||
) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {};
|
||||
}
|
||||
|
||||
GameLib.D3.API.Mesh.call(
|
||||
this,
|
||||
apiMesh
|
||||
);
|
||||
|
||||
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 = 1;
|
||||
}
|
||||
this.widthSegments = widthSegments;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||||
heightSegments = 1
|
||||
}
|
||||
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(distanceFromOrigin)) {
|
||||
distanceFromOrigin = 0;
|
||||
}
|
||||
this.distanceFromOrigin = distanceFromOrigin;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.SOCKET_CAST
|
||||
);
|
||||
};
|
||||
|
||||
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){
|
||||
|
||||
|
||||
var apiMesh = GameLib.D3.API.Mesh.FromObject(objectMesh);
|
||||
|
||||
return new GameLib.D3.API.Mesh.Plane(
|
||||
apiMesh,
|
||||
objectMesh.width,
|
||||
objectMesh.height,
|
||||
objectMesh.widthSegments,
|
||||
objectMesh.heightSegments,
|
||||
objectMesh.heightMapScale,
|
||||
objectMesh.isHeightMap,
|
||||
objectMesh.isDotMap,
|
||||
objectMesh.distanceFromOrigin
|
||||
);
|
||||
|
||||
};
|
|
@ -1,87 +1,47 @@
|
|||
/**
|
||||
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
|
||||
* @param graphics GameLib.GraphicsRuntime
|
||||
* @param apiMesh GameLib.D3.API.Mesh
|
||||
* @param width
|
||||
* @param height
|
||||
* @param widthSegments
|
||||
* @param heightSegments
|
||||
* @param heightMapScale
|
||||
* @param isHeightMap
|
||||
* @param isClippingPlane
|
||||
* @param distanceFromOrigin
|
||||
* @param apiMeshPlane
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.Mesh.Plane = function (
|
||||
graphics,
|
||||
apiMesh,
|
||||
width,
|
||||
height,
|
||||
widthSegments,
|
||||
heightSegments,
|
||||
heightMapScale,
|
||||
isHeightMap,
|
||||
isClippingPlane,
|
||||
distanceFromOrigin
|
||||
apiMeshPlane
|
||||
) {
|
||||
|
||||
|
||||
this.graphics = graphics;
|
||||
this.graphics.isNotThreeThrow();
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||
apiMesh = {
|
||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_PLANE
|
||||
if (GameLib.Utils.UndefinedOrNull(apiMeshPlane)) {
|
||||
apiMeshPlane = {
|
||||
meshType : GameLib.D3.API.Mesh.MESH_TYPE_PLANE
|
||||
};
|
||||
}
|
||||
|
||||
if (apiMesh instanceof GameLib.D3.Mesh.Plane) {
|
||||
return apiMesh;
|
||||
if (apiMeshPlane instanceof GameLib.D3.Mesh.Plane) {
|
||||
return apiMeshPlane;
|
||||
}
|
||||
|
||||
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 = 1;
|
||||
}
|
||||
this.widthSegments = widthSegments;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||||
heightSegments = 1
|
||||
}
|
||||
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(isClippingPlane)) {
|
||||
isClippingPlane = false;
|
||||
}
|
||||
this.isClippingPlane = isClippingPlane;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(distanceFromOrigin)) {
|
||||
distanceFromOrigin = 0;
|
||||
}
|
||||
this.distanceFromOrigin = distanceFromOrigin;
|
||||
GameLib.D3.API.Mesh.Plane.call(
|
||||
this,
|
||||
apiMeshPlane,
|
||||
apiMeshPlane.width,
|
||||
apiMeshPlane.height,
|
||||
apiMeshPlane.widthSegments,
|
||||
apiMeshPlane.heightSegments,
|
||||
apiMeshPlane.heightMapScale,
|
||||
apiMeshPlane.isHeightMap,
|
||||
apiMeshPlane.isDotMap,
|
||||
apiMeshPlane.distanceFromOrigin
|
||||
);
|
||||
|
||||
GameLib.D3.Mesh.call(
|
||||
this,
|
||||
this.graphics,
|
||||
apiMesh
|
||||
graphics,
|
||||
apiMeshPlane
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
GameLib.D3.Mesh.Plane.prototype = Object.create(GameLib.D3.Mesh.prototype);
|
||||
|
|
Loading…
Reference in New Issue