textures backward compatible, runtime name, finished cast component
parent
6586de1757
commit
0c7d1dcfd8
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||
var __DATE__ = "Mon Dec 04 2017 21:03:18 GMT+0100 (CET)";
|
||||
var __DATE__ = "Tue Dec 05 2017 11:22:05 GMT+0100 (CET)";
|
||||
// END COMPILE TIME DEFINITIONS
|
||||
|
||||
/**
|
||||
|
@ -1994,6 +1994,41 @@ GameLib.Component.GetComponentInfo = function(number) {
|
|||
throw new Error('Unknown component type: ' + number );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the runtime friendly name
|
||||
* @param runtime
|
||||
* @returns {*}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.Component.GetRuntimeName = function(runtime) {
|
||||
|
||||
if (runtime === GameLib.Component.GRAPHICS_RUNTIME) {
|
||||
return 'Graphics';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.PHYSICS_RUNTIME) {
|
||||
return 'Physics';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.GUI_RUNTIME) {
|
||||
return 'GUI';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.STATISTICS_RUNTIME) {
|
||||
return 'Statistics';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.SOCKET_RUNTIME) {
|
||||
return 'Sockets';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.CODER_RUNTIME) {
|
||||
return 'Coder';
|
||||
}
|
||||
|
||||
return 'Default';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
|
@ -3117,7 +3152,6 @@ GameLib.API.Entity.FromObject = function(objectEntity) {
|
|||
* @param id
|
||||
* @param name
|
||||
* @param domElement
|
||||
* @param objects
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -3125,7 +3159,6 @@ GameLib.API.GUI = function(
|
|||
id,
|
||||
name,
|
||||
domElement,
|
||||
objects,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
|
@ -3144,11 +3177,6 @@ GameLib.API.GUI = function(
|
|||
}
|
||||
this.domElement = domElement;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(objects)) {
|
||||
objects = [];
|
||||
}
|
||||
this.objects = objects;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.GUI,
|
||||
|
@ -3179,7 +3207,6 @@ GameLib.API.GUI.FromObject = function(objectGUI) {
|
|||
objectGUI.id,
|
||||
objectGUI.name,
|
||||
apiDomElement,
|
||||
objectGUI.objects,
|
||||
objectGUI.parentEntity
|
||||
);
|
||||
|
||||
|
@ -4628,29 +4655,10 @@ GameLib.Cast.CAST_TYPE_PEER = 0x2;
|
|||
GameLib.Cast.CAST_TYPE_ALL = 0x3;
|
||||
GameLib.Cast.CAST_TYPE_ALL_BUT_PEER = 0x4;
|
||||
|
||||
/**
|
||||
* We don't use a 3rd party particle engine right now
|
||||
* @returns true
|
||||
*/
|
||||
GameLib.Cast.prototype.createInstance = function() {
|
||||
|
||||
this.instance = true;
|
||||
|
||||
// if (this.templateParticle) {
|
||||
//
|
||||
// this.templateParticle.mesh.position.x = this.position.x;
|
||||
// this.templateParticle.mesh.position.y = this.position.y;
|
||||
// this.templateParticle.mesh.position.z = this.position.z;
|
||||
//
|
||||
// this.templateParticle.direction.x = this.direction.x;
|
||||
// this.templateParticle.direction.y = this.direction.y;
|
||||
// this.templateParticle.direction.z = this.direction.z;
|
||||
//
|
||||
// this.templateParticle.scale.x = this.scale.x;
|
||||
// this.templateParticle.scale.y = this.scale.y;
|
||||
// this.templateParticle.scale.z = this.scale.z;
|
||||
// }
|
||||
|
||||
GameLib.Component.prototype.createInstance.call(this);
|
||||
};
|
||||
|
||||
|
@ -4659,147 +4667,10 @@ GameLib.Cast.prototype.createInstance = function() {
|
|||
*/
|
||||
GameLib.Cast.prototype.updateInstance = function(property) {
|
||||
|
||||
if (property === 'particlesPerSecond') {
|
||||
this.frequency = Number(1 / this.particlesPerSecond);
|
||||
}
|
||||
|
||||
if (property === 'frequency') {
|
||||
this.particlesPerSecond = Math.round(1 / this.frequency);
|
||||
}
|
||||
|
||||
if (property === 'position') {
|
||||
this.position.instance.x = this.position.x;
|
||||
this.position.instance.y = this.position.y;
|
||||
this.position.instance.z = this.position.z;
|
||||
this.templateParticle.mesh.position = this.position.clone();
|
||||
this.templateParticle.mesh.updateInstance('position', true);
|
||||
}
|
||||
|
||||
if (property === 'direction') {
|
||||
this.direction.instance.x = this.direction.x;
|
||||
this.direction.instance.y = this.direction.y;
|
||||
this.direction.instance.z = this.direction.z;
|
||||
this.templateParticle.direction = this.direction.clone();
|
||||
this.templateParticle.direction.updateInstance('direction', true);
|
||||
}
|
||||
};
|
||||
|
||||
GameLib.Cast.prototype.remove = function() {
|
||||
|
||||
if (this.removeSubscription) {
|
||||
console.log('already another remove subscription for ' + this.name);
|
||||
return;
|
||||
}
|
||||
|
||||
this.removeSubscription = GameLib.Event.Subscribe(
|
||||
GameLib.Event.REMOVE_PARTICLE_ENGINE,
|
||||
function(data){
|
||||
if (data.component === this) {
|
||||
|
||||
if (this.isClone) {
|
||||
/**
|
||||
* We only remove the things we cloned, the mesh, particle, and this
|
||||
*/
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component: this.templateParticle.mesh
|
||||
}
|
||||
);
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component: this.templateParticle
|
||||
}
|
||||
);
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component: this
|
||||
}
|
||||
)
|
||||
} else {
|
||||
GameLib.Component.prototype.remove.call(this);
|
||||
}
|
||||
|
||||
this.removeSubscription.remove();
|
||||
|
||||
this.removeSubscription = null;
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
/**
|
||||
* Below signals the particle system to continue processing the particles, but don't create more, and
|
||||
* we wait for the system to signal REMOVE_PARTICLE_ENGINE so we can destroy ourselves
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.disabledForRemoval = true;
|
||||
};
|
||||
|
||||
// GameLib.Cast.prototype.getChildrenComponents = function() {
|
||||
//
|
||||
// var components = [];
|
||||
//
|
||||
// if (this.templateParticle) {
|
||||
// components.push(this.templateParticle);
|
||||
//
|
||||
// if (this.templateParticle.mesh) {
|
||||
// components.push(this.templateParticle.mesh);
|
||||
//
|
||||
// if (this.templateParticle.mesh.materials && this.templateParticle.mesh.materials[0]) {
|
||||
//
|
||||
// components.push(this.templateParticle.mesh.materials[0]);
|
||||
//
|
||||
// if (this.templateParticle.mesh.materials[0].diffuseMap) {
|
||||
// components.push(this.templateParticle.mesh.materials[0].diffuseMap);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return components;
|
||||
// };
|
||||
|
||||
GameLib.Cast.prototype.clone = function() {
|
||||
var mesh = this.templateParticle.mesh.clone();
|
||||
var templateParticle = this.templateParticle.clone();
|
||||
templateParticle.mesh = mesh;
|
||||
templateParticle.instance = mesh.instance;
|
||||
var engine = GameLib.Component.prototype.clone.call(this);
|
||||
engine.templateParticle = templateParticle;
|
||||
return engine;
|
||||
};
|
||||
|
||||
GameLib.Cast.prototype.processParticles = function(delta) {
|
||||
// this.particles = this.particles.reduce(
|
||||
// function(result, particle){
|
||||
//
|
||||
// particle.position.x += particle.userData.direction.x * delta;
|
||||
// particle.position.y += particle.userData.direction.y * delta;
|
||||
// particle.position.z += particle.userData.direction.z * delta;
|
||||
//
|
||||
// particle.userData.elapsed += delta;
|
||||
// if (particle.userData.elapsed > particle.userData.lifeTime) {
|
||||
// particle.parent.remove(particle);
|
||||
// } else {
|
||||
// result.push(particle);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// },
|
||||
// []
|
||||
// );
|
||||
};
|
||||
|
||||
GameLib.Cast.prototype.createNewParticle = function(camera) {
|
||||
//
|
||||
// var particle = this.templateParticle.clone(camera);
|
||||
//
|
||||
// this.particles.push(particle);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -4811,15 +4682,11 @@ GameLib.Cast.prototype.toApiObject = function() {
|
|||
return new GameLib.API.Cast(
|
||||
this.id,
|
||||
this.name,
|
||||
this.position.toApiObject(),
|
||||
this.direction.toApiObject(),
|
||||
this.enabled,
|
||||
GameLib.Utils.IdOrNull(this.templateParticle),
|
||||
this.particlesPerSecond,
|
||||
this.frequency,
|
||||
this.elapsed,
|
||||
GameLib.Utils.IdOrNull(this.camera),
|
||||
this.pulse,
|
||||
this.castType,
|
||||
this.roomId,
|
||||
GameLib.Utils.IdOrNull(this.peer),
|
||||
this.serverIp,
|
||||
this.port,
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
|
@ -4827,20 +4694,17 @@ GameLib.Cast.prototype.toApiObject = function() {
|
|||
|
||||
/**
|
||||
* Converts from an Object Cast to a GameLib.Cast
|
||||
* @param graphics GameLib.GraphicsRuntime
|
||||
* @param sockets GameLib.SocketsRuntime
|
||||
* @param objectCast Object
|
||||
* @returns {GameLib.Cast}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.Cast.FromObject = function(graphics, objectCast) {
|
||||
|
||||
GameLib.Cast.FromObject = function(sockets, objectCast) {
|
||||
var apiCast = GameLib.API.Cast.FromObject(objectCast);
|
||||
|
||||
return new GameLib.Cast(
|
||||
graphics,
|
||||
sockets,
|
||||
apiCast
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -9942,6 +9806,7 @@ GameLib.D3.API.Spline.FromObject = function(objectComponent) {
|
|||
* @param mapping
|
||||
* @param magFilter
|
||||
* @param minFilter
|
||||
* @param storageType
|
||||
* @param textureType
|
||||
* @param anisotropy
|
||||
* @param offset
|
||||
|
@ -9972,7 +9837,7 @@ GameLib.D3.API.Texture = function(
|
|||
mapping,
|
||||
magFilter,
|
||||
minFilter,
|
||||
textureType,
|
||||
storageType,
|
||||
anisotropy,
|
||||
offset,
|
||||
generateMipmaps,
|
||||
|
@ -10053,10 +9918,10 @@ GameLib.D3.API.Texture = function(
|
|||
}
|
||||
this.minFilter = minFilter;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(textureType)) {
|
||||
textureType = GameLib.D3.API.Texture.TYPE_UNSIGNED_BYTE;
|
||||
if (GameLib.Utils.UndefinedOrNull(storageType)) {
|
||||
storageType = GameLib.D3.API.Texture.TYPE_UNSIGNED_BYTE;
|
||||
}
|
||||
this.textureType = textureType;
|
||||
this.storageType = storageType;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(anisotropy)) {
|
||||
anisotropy = 1;
|
||||
|
@ -10212,7 +10077,7 @@ GameLib.D3.API.Texture.TEXTURE_TYPE_CANVAS = 0x3;
|
|||
GameLib.D3.API.Texture.FromObject = function(objectTexture) {
|
||||
return new GameLib.D3.API.Texture(
|
||||
objectTexture.id,
|
||||
objectTexture.textureType,
|
||||
objectTexture.typeId || objectTexture.textureType,
|
||||
objectTexture.name,
|
||||
objectTexture.image,
|
||||
objectTexture.images,
|
||||
|
@ -10224,7 +10089,7 @@ GameLib.D3.API.Texture.FromObject = function(objectTexture) {
|
|||
objectTexture.mapping,
|
||||
objectTexture.magFilter,
|
||||
objectTexture.minFilter,
|
||||
objectTexture.textureType,
|
||||
objectTexture.storageType,
|
||||
objectTexture.anisotropy,
|
||||
GameLib.API.Vector2.FromObject(objectTexture.offset),
|
||||
objectTexture.generateMipmaps,
|
||||
|
@ -22383,7 +22248,7 @@ GameLib.D3.Texture = function(
|
|||
apiTexture.mapping,
|
||||
apiTexture.magFilter,
|
||||
apiTexture.minFilter,
|
||||
apiTexture.textureType,
|
||||
apiTexture.storageType,
|
||||
apiTexture.anisotropy,
|
||||
apiTexture.offset,
|
||||
apiTexture.generateMipmaps,
|
||||
|
@ -22695,7 +22560,7 @@ GameLib.D3.Texture.prototype.toApiObject = function() {
|
|||
this.mapping,
|
||||
this.magFilter,
|
||||
this.minFilter,
|
||||
this.textureType,
|
||||
this.storageType,
|
||||
this.anisotropy,
|
||||
this.offset.toApiObject(),
|
||||
this.generateMipmaps,
|
||||
|
@ -23834,7 +23699,6 @@ GameLib.GUI = function(
|
|||
apiGUI.id,
|
||||
apiGUI.name,
|
||||
apiGUI.domElement,
|
||||
apiGUI.objects,
|
||||
apiGUI.parentEntity
|
||||
);
|
||||
|
||||
|
@ -23874,12 +23738,6 @@ GameLib.GUI.prototype.toApiObject = function() {
|
|||
this.id,
|
||||
this.name,
|
||||
GameLib.Utils.IdOrNull(this.domElement),
|
||||
objects.map(
|
||||
function(object){
|
||||
console.log('todo: check this' + object);
|
||||
return GameLib.Utils.IdOrNull(object);
|
||||
}
|
||||
),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
|
|
|
@ -693,6 +693,41 @@ GameLib.Component.GetComponentInfo = function(number) {
|
|||
throw new Error('Unknown component type: ' + number );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the runtime friendly name
|
||||
* @param runtime
|
||||
* @returns {*}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.Component.GetRuntimeName = function(runtime) {
|
||||
|
||||
if (runtime === GameLib.Component.GRAPHICS_RUNTIME) {
|
||||
return 'Graphics';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.PHYSICS_RUNTIME) {
|
||||
return 'Physics';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.GUI_RUNTIME) {
|
||||
return 'GUI';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.STATISTICS_RUNTIME) {
|
||||
return 'Statistics';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.SOCKET_RUNTIME) {
|
||||
return 'Sockets';
|
||||
}
|
||||
|
||||
if (runtime === GameLib.Component.CODER_RUNTIME) {
|
||||
return 'Coder';
|
||||
}
|
||||
|
||||
return 'Default';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* @param id
|
||||
* @param name
|
||||
* @param domElement
|
||||
* @param objects
|
||||
* @param parentEntity
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -11,7 +10,6 @@ GameLib.API.GUI = function(
|
|||
id,
|
||||
name,
|
||||
domElement,
|
||||
objects,
|
||||
parentEntity
|
||||
) {
|
||||
|
||||
|
@ -30,11 +28,6 @@ GameLib.API.GUI = function(
|
|||
}
|
||||
this.domElement = domElement;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(objects)) {
|
||||
objects = [];
|
||||
}
|
||||
this.objects = objects;
|
||||
|
||||
GameLib.API.Component.call(
|
||||
this,
|
||||
GameLib.Component.GUI,
|
||||
|
@ -65,7 +58,6 @@ GameLib.API.GUI.FromObject = function(objectGUI) {
|
|||
objectGUI.id,
|
||||
objectGUI.name,
|
||||
apiDomElement,
|
||||
objectGUI.objects,
|
||||
objectGUI.parentEntity
|
||||
);
|
||||
|
||||
|
|
|
@ -49,29 +49,10 @@ GameLib.Cast.CAST_TYPE_PEER = 0x2;
|
|||
GameLib.Cast.CAST_TYPE_ALL = 0x3;
|
||||
GameLib.Cast.CAST_TYPE_ALL_BUT_PEER = 0x4;
|
||||
|
||||
/**
|
||||
* We don't use a 3rd party particle engine right now
|
||||
* @returns true
|
||||
*/
|
||||
GameLib.Cast.prototype.createInstance = function() {
|
||||
|
||||
this.instance = true;
|
||||
|
||||
// if (this.templateParticle) {
|
||||
//
|
||||
// this.templateParticle.mesh.position.x = this.position.x;
|
||||
// this.templateParticle.mesh.position.y = this.position.y;
|
||||
// this.templateParticle.mesh.position.z = this.position.z;
|
||||
//
|
||||
// this.templateParticle.direction.x = this.direction.x;
|
||||
// this.templateParticle.direction.y = this.direction.y;
|
||||
// this.templateParticle.direction.z = this.direction.z;
|
||||
//
|
||||
// this.templateParticle.scale.x = this.scale.x;
|
||||
// this.templateParticle.scale.y = this.scale.y;
|
||||
// this.templateParticle.scale.z = this.scale.z;
|
||||
// }
|
||||
|
||||
GameLib.Component.prototype.createInstance.call(this);
|
||||
};
|
||||
|
||||
|
@ -80,147 +61,10 @@ GameLib.Cast.prototype.createInstance = function() {
|
|||
*/
|
||||
GameLib.Cast.prototype.updateInstance = function(property) {
|
||||
|
||||
if (property === 'particlesPerSecond') {
|
||||
this.frequency = Number(1 / this.particlesPerSecond);
|
||||
}
|
||||
|
||||
if (property === 'frequency') {
|
||||
this.particlesPerSecond = Math.round(1 / this.frequency);
|
||||
}
|
||||
|
||||
if (property === 'position') {
|
||||
this.position.instance.x = this.position.x;
|
||||
this.position.instance.y = this.position.y;
|
||||
this.position.instance.z = this.position.z;
|
||||
this.templateParticle.mesh.position = this.position.clone();
|
||||
this.templateParticle.mesh.updateInstance('position', true);
|
||||
}
|
||||
|
||||
if (property === 'direction') {
|
||||
this.direction.instance.x = this.direction.x;
|
||||
this.direction.instance.y = this.direction.y;
|
||||
this.direction.instance.z = this.direction.z;
|
||||
this.templateParticle.direction = this.direction.clone();
|
||||
this.templateParticle.direction.updateInstance('direction', true);
|
||||
}
|
||||
};
|
||||
|
||||
GameLib.Cast.prototype.remove = function() {
|
||||
|
||||
if (this.removeSubscription) {
|
||||
console.log('already another remove subscription for ' + this.name);
|
||||
return;
|
||||
}
|
||||
|
||||
this.removeSubscription = GameLib.Event.Subscribe(
|
||||
GameLib.Event.REMOVE_PARTICLE_ENGINE,
|
||||
function(data){
|
||||
if (data.component === this) {
|
||||
|
||||
if (this.isClone) {
|
||||
/**
|
||||
* We only remove the things we cloned, the mesh, particle, and this
|
||||
*/
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component: this.templateParticle.mesh
|
||||
}
|
||||
);
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component: this.templateParticle
|
||||
}
|
||||
);
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component: this
|
||||
}
|
||||
)
|
||||
} else {
|
||||
GameLib.Component.prototype.remove.call(this);
|
||||
}
|
||||
|
||||
this.removeSubscription.remove();
|
||||
|
||||
this.removeSubscription = null;
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
/**
|
||||
* Below signals the particle system to continue processing the particles, but don't create more, and
|
||||
* we wait for the system to signal REMOVE_PARTICLE_ENGINE so we can destroy ourselves
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.disabledForRemoval = true;
|
||||
};
|
||||
|
||||
// GameLib.Cast.prototype.getChildrenComponents = function() {
|
||||
//
|
||||
// var components = [];
|
||||
//
|
||||
// if (this.templateParticle) {
|
||||
// components.push(this.templateParticle);
|
||||
//
|
||||
// if (this.templateParticle.mesh) {
|
||||
// components.push(this.templateParticle.mesh);
|
||||
//
|
||||
// if (this.templateParticle.mesh.materials && this.templateParticle.mesh.materials[0]) {
|
||||
//
|
||||
// components.push(this.templateParticle.mesh.materials[0]);
|
||||
//
|
||||
// if (this.templateParticle.mesh.materials[0].diffuseMap) {
|
||||
// components.push(this.templateParticle.mesh.materials[0].diffuseMap);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return components;
|
||||
// };
|
||||
|
||||
GameLib.Cast.prototype.clone = function() {
|
||||
var mesh = this.templateParticle.mesh.clone();
|
||||
var templateParticle = this.templateParticle.clone();
|
||||
templateParticle.mesh = mesh;
|
||||
templateParticle.instance = mesh.instance;
|
||||
var engine = GameLib.Component.prototype.clone.call(this);
|
||||
engine.templateParticle = templateParticle;
|
||||
return engine;
|
||||
};
|
||||
|
||||
GameLib.Cast.prototype.processParticles = function(delta) {
|
||||
// this.particles = this.particles.reduce(
|
||||
// function(result, particle){
|
||||
//
|
||||
// particle.position.x += particle.userData.direction.x * delta;
|
||||
// particle.position.y += particle.userData.direction.y * delta;
|
||||
// particle.position.z += particle.userData.direction.z * delta;
|
||||
//
|
||||
// particle.userData.elapsed += delta;
|
||||
// if (particle.userData.elapsed > particle.userData.lifeTime) {
|
||||
// particle.parent.remove(particle);
|
||||
// } else {
|
||||
// result.push(particle);
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// },
|
||||
// []
|
||||
// );
|
||||
};
|
||||
|
||||
GameLib.Cast.prototype.createNewParticle = function(camera) {
|
||||
//
|
||||
// var particle = this.templateParticle.clone(camera);
|
||||
//
|
||||
// this.particles.push(particle);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -232,15 +76,11 @@ GameLib.Cast.prototype.toApiObject = function() {
|
|||
return new GameLib.API.Cast(
|
||||
this.id,
|
||||
this.name,
|
||||
this.position.toApiObject(),
|
||||
this.direction.toApiObject(),
|
||||
this.enabled,
|
||||
GameLib.Utils.IdOrNull(this.templateParticle),
|
||||
this.particlesPerSecond,
|
||||
this.frequency,
|
||||
this.elapsed,
|
||||
GameLib.Utils.IdOrNull(this.camera),
|
||||
this.pulse,
|
||||
this.castType,
|
||||
this.roomId,
|
||||
GameLib.Utils.IdOrNull(this.peer),
|
||||
this.serverIp,
|
||||
this.port,
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
|
@ -248,18 +88,15 @@ GameLib.Cast.prototype.toApiObject = function() {
|
|||
|
||||
/**
|
||||
* Converts from an Object Cast to a GameLib.Cast
|
||||
* @param graphics GameLib.GraphicsRuntime
|
||||
* @param sockets GameLib.SocketsRuntime
|
||||
* @param objectCast Object
|
||||
* @returns {GameLib.Cast}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.Cast.FromObject = function(graphics, objectCast) {
|
||||
|
||||
GameLib.Cast.FromObject = function(sockets, objectCast) {
|
||||
var apiCast = GameLib.API.Cast.FromObject(objectCast);
|
||||
|
||||
return new GameLib.Cast(
|
||||
graphics,
|
||||
sockets,
|
||||
apiCast
|
||||
);
|
||||
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* @param mapping
|
||||
* @param magFilter
|
||||
* @param minFilter
|
||||
* @param storageType
|
||||
* @param textureType
|
||||
* @param anisotropy
|
||||
* @param offset
|
||||
|
@ -43,7 +44,7 @@ GameLib.D3.API.Texture = function(
|
|||
mapping,
|
||||
magFilter,
|
||||
minFilter,
|
||||
textureType,
|
||||
storageType,
|
||||
anisotropy,
|
||||
offset,
|
||||
generateMipmaps,
|
||||
|
@ -124,10 +125,10 @@ GameLib.D3.API.Texture = function(
|
|||
}
|
||||
this.minFilter = minFilter;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(textureType)) {
|
||||
textureType = GameLib.D3.API.Texture.TYPE_UNSIGNED_BYTE;
|
||||
if (GameLib.Utils.UndefinedOrNull(storageType)) {
|
||||
storageType = GameLib.D3.API.Texture.TYPE_UNSIGNED_BYTE;
|
||||
}
|
||||
this.textureType = textureType;
|
||||
this.storageType = storageType;
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(anisotropy)) {
|
||||
anisotropy = 1;
|
||||
|
@ -283,7 +284,7 @@ GameLib.D3.API.Texture.TEXTURE_TYPE_CANVAS = 0x3;
|
|||
GameLib.D3.API.Texture.FromObject = function(objectTexture) {
|
||||
return new GameLib.D3.API.Texture(
|
||||
objectTexture.id,
|
||||
objectTexture.textureType,
|
||||
objectTexture.typeId || objectTexture.textureType,
|
||||
objectTexture.name,
|
||||
objectTexture.image,
|
||||
objectTexture.images,
|
||||
|
@ -295,7 +296,7 @@ GameLib.D3.API.Texture.FromObject = function(objectTexture) {
|
|||
objectTexture.mapping,
|
||||
objectTexture.magFilter,
|
||||
objectTexture.minFilter,
|
||||
objectTexture.textureType,
|
||||
objectTexture.storageType,
|
||||
objectTexture.anisotropy,
|
||||
GameLib.API.Vector2.FromObject(objectTexture.offset),
|
||||
objectTexture.generateMipmaps,
|
||||
|
|
|
@ -35,7 +35,7 @@ GameLib.D3.Texture = function(
|
|||
apiTexture.mapping,
|
||||
apiTexture.magFilter,
|
||||
apiTexture.minFilter,
|
||||
apiTexture.textureType,
|
||||
apiTexture.storageType,
|
||||
apiTexture.anisotropy,
|
||||
apiTexture.offset,
|
||||
apiTexture.generateMipmaps,
|
||||
|
@ -347,7 +347,7 @@ GameLib.D3.Texture.prototype.toApiObject = function() {
|
|||
this.mapping,
|
||||
this.magFilter,
|
||||
this.minFilter,
|
||||
this.textureType,
|
||||
this.storageType,
|
||||
this.anisotropy,
|
||||
this.offset.toApiObject(),
|
||||
this.generateMipmaps,
|
||||
|
|
|
@ -24,7 +24,6 @@ GameLib.GUI = function(
|
|||
apiGUI.id,
|
||||
apiGUI.name,
|
||||
apiGUI.domElement,
|
||||
apiGUI.objects,
|
||||
apiGUI.parentEntity
|
||||
);
|
||||
|
||||
|
@ -64,12 +63,6 @@ GameLib.GUI.prototype.toApiObject = function() {
|
|||
this.id,
|
||||
this.name,
|
||||
GameLib.Utils.IdOrNull(this.domElement),
|
||||
objects.map(
|
||||
function(object){
|
||||
console.log('todo: check this' + object);
|
||||
return GameLib.Utils.IdOrNull(object);
|
||||
}
|
||||
),
|
||||
GameLib.Utils.IdOrNull(this.parentEntity)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue