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
|
* Mesh Superset - The apiMesh properties get moved into the Mesh object itself, and then the instance is created
|
||||||
* @param graphics GameLib.GraphicsRuntime
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
* @param apiMesh GameLib.D3.API.Mesh
|
* @param apiMeshPlane
|
||||||
* @param width
|
|
||||||
* @param height
|
|
||||||
* @param widthSegments
|
|
||||||
* @param heightSegments
|
|
||||||
* @param heightMapScale
|
|
||||||
* @param isHeightMap
|
|
||||||
* @param isClippingPlane
|
|
||||||
* @param distanceFromOrigin
|
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Mesh.Plane = function (
|
GameLib.D3.Mesh.Plane = function (
|
||||||
graphics,
|
graphics,
|
||||||
apiMesh,
|
apiMeshPlane
|
||||||
width,
|
|
||||||
height,
|
|
||||||
widthSegments,
|
|
||||||
heightSegments,
|
|
||||||
heightMapScale,
|
|
||||||
isHeightMap,
|
|
||||||
isClippingPlane,
|
|
||||||
distanceFromOrigin
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
if (GameLib.Utils.UndefinedOrNull(apiMeshPlane)) {
|
||||||
apiMesh = {
|
apiMeshPlane = {
|
||||||
meshType: GameLib.D3.API.Mesh.MESH_TYPE_PLANE
|
meshType : GameLib.D3.API.Mesh.MESH_TYPE_PLANE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiMesh instanceof GameLib.D3.Mesh.Plane) {
|
if (apiMeshPlane instanceof GameLib.D3.Mesh.Plane) {
|
||||||
return apiMesh;
|
return apiMeshPlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
GameLib.D3.API.Mesh.Plane.call(
|
||||||
width = 1;
|
this,
|
||||||
}
|
apiMeshPlane,
|
||||||
this.width = width;
|
apiMeshPlane.width,
|
||||||
|
apiMeshPlane.height,
|
||||||
if (GameLib.Utils.UndefinedOrNull(height)) {
|
apiMeshPlane.widthSegments,
|
||||||
height = 1;
|
apiMeshPlane.heightSegments,
|
||||||
}
|
apiMeshPlane.heightMapScale,
|
||||||
this.height = height;
|
apiMeshPlane.isHeightMap,
|
||||||
|
apiMeshPlane.isDotMap,
|
||||||
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
apiMeshPlane.distanceFromOrigin
|
||||||
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.Mesh.call(
|
GameLib.D3.Mesh.call(
|
||||||
this,
|
this,
|
||||||
this.graphics,
|
graphics,
|
||||||
apiMesh
|
apiMeshPlane
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.Mesh.Plane.prototype = Object.create(GameLib.D3.Mesh.prototype);
|
GameLib.D3.Mesh.Plane.prototype = Object.create(GameLib.D3.Mesh.prototype);
|
||||||
|
|
Loading…
Reference in New Issue