mesh types in mesh constructors (like it should have been)
parent
922673e21e
commit
1fb49ac3c1
|
@ -69,6 +69,32 @@ GameLib.Utils.LoadIdsFromObjectToIdObject = function(object, idToObject) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets random int exclusive of maximum
|
||||||
|
* @param min
|
||||||
|
* @param max
|
||||||
|
* @returns {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.Utils.GetRandomInt = function(min, max) {
|
||||||
|
min = Math.ceil(min);
|
||||||
|
max = Math.floor(max);
|
||||||
|
return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets random int inclusive of maximum
|
||||||
|
* @param min
|
||||||
|
* @param max
|
||||||
|
* @returns {*}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.Utils.GetRandomIntInclusive = function(min, max) {
|
||||||
|
min = Math.ceil(min);
|
||||||
|
max = Math.floor(max);
|
||||||
|
return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
|
||||||
|
};
|
||||||
|
|
||||||
GameLib.Utils.InterpolateArray = function(data, fitCount) {
|
GameLib.Utils.InterpolateArray = function(data, fitCount) {
|
||||||
|
|
||||||
var linearInterpolate = function (before, after, atPoint) {
|
var linearInterpolate = function (before, after, atPoint) {
|
||||||
|
|
|
@ -267,6 +267,8 @@ GameLib.Component.COMPONENT_MESH_TEXT = 0x3b;
|
||||||
GameLib.Component.COMPONENT_FONT = 0x3c;
|
GameLib.Component.COMPONENT_FONT = 0x3c;
|
||||||
GameLib.Component.COMPONENT_CANVAS = 0x3d;
|
GameLib.Component.COMPONENT_CANVAS = 0x3d;
|
||||||
GameLib.Component.COMPONENT_BONE = 0x3e;
|
GameLib.Component.COMPONENT_BONE = 0x3e;
|
||||||
|
GameLib.Component.COMPONENT_MESH_BOX = 0x3f;
|
||||||
|
GameLib.Component.COMPONENT_MESH_CYLINDER = 0x40;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string name for component number
|
* Returns string name for component number
|
||||||
|
@ -338,6 +340,8 @@ GameLib.Component.GetComponentName = function(number) {
|
||||||
case 0x3c : return 'GameLib.D3.Font';
|
case 0x3c : return 'GameLib.D3.Font';
|
||||||
case 0x3d : return 'GameLib.D3.Canvas';
|
case 0x3d : return 'GameLib.D3.Canvas';
|
||||||
case 0x3e : return 'GameLib.D3.Bone';
|
case 0x3e : return 'GameLib.D3.Bone';
|
||||||
|
case 0x3f : return 'GameLib.D3.Mesh.Box';
|
||||||
|
case 0x40 : return 'GameLib.D3.Mesh.Cylinder';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,14 @@ GameLib.D3.Mesh = function (
|
||||||
componentType = GameLib.Component.COMPONENT_MESH_PLANE
|
componentType = GameLib.Component.COMPONENT_MESH_PLANE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_BOX) {
|
||||||
|
componentType = GameLib.Component.COMPONENT_MESH_BOX
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_CYLINDER) {
|
||||||
|
componentType = GameLib.Component.COMPONENT_MESH_CYLINDER
|
||||||
|
}
|
||||||
|
|
||||||
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_SPHERE) {
|
if (this.meshType === GameLib.D3.Mesh.MESH_TYPE_SPHERE) {
|
||||||
componentType = GameLib.Component.COMPONENT_MESH_SPHERE
|
componentType = GameLib.Component.COMPONENT_MESH_SPHERE
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,16 @@ GameLib.D3.Mesh.Box = function (
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||||
|
apiMesh = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||||
|
return apiMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_BOX;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
width = 1;
|
width = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,17 @@ GameLib.D3.Mesh.Cylinder = function (
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||||
|
apiMesh = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||||
|
return apiMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_CYLINDER;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
||||||
radiusTop = 1;
|
radiusTop = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,16 @@ GameLib.D3.Mesh.Plane = function (
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||||
|
apiMesh = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||||
|
return apiMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_PLANE;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
width = 1;
|
width = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,16 @@ GameLib.D3.Mesh.Sphere = function (
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||||
|
apiMesh = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||||
|
return apiMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_SPHERE;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
radius = 1;
|
radius = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,16 @@ GameLib.D3.Mesh.Text = function (
|
||||||
this.graphics = graphics;
|
this.graphics = graphics;
|
||||||
this.graphics.isNotThreeThrow();
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiMesh)) {
|
||||||
|
apiMesh = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (apiMesh instanceof GameLib.D3.Mesh.Box) {
|
||||||
|
return apiMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiMesh.meshType = GameLib.D3.Mesh.MESH_TYPE_TEXT;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(text)) {
|
if (GameLib.Utils.UndefinedOrNull(text)) {
|
||||||
text = '-=<yb4f310';
|
text = '-=<yb4f310';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue