fixes for animations with head and jump, etc.

This commit is contained in:
jeena 2013-12-25 00:28:28 +01:00
parent 142964938c
commit 283a1ef48b
16 changed files with 147 additions and 109 deletions

View file

@ -12,9 +12,10 @@ function (DomController, Settings, Exception, NotificationCenter) {
this.canvas = null;
NotificationCenter.on("view/createMesh", this.createMesh, this);
NotificationCenter.on("view/addMesh", this.addMesh, this);
NotificationCenter.on("view/updateMesh", this.updateMesh, this);
NotificationCenter.on("view/createAnimatedMesh", this.createAnimatedMesh, this);
NotificationCenter.on("view/addMesh", this.addMesh, this);
NotificationCenter.on("view/removeMesh", this.removeMesh, this);
NotificationCenter.on("view/updateMesh", this.updateMesh, this);
}
AbstractView.prototype.isWebGlEnabled = function () {
@ -51,18 +52,22 @@ function (DomController, Settings, Exception, NotificationCenter) {
throw new Exception('Abstract Function createMesh not overwritten ');
}
AbstractView.prototype.createAnimatedMesh = function (texturePaths, callback, options) {
throw new Exception('Abstract Function createAnimatedMesh not overwritten ');
}
AbstractView.prototype.addMesh = function(mesh) {
throw new Exception('Abstract Function addMesh not overwritten ');
};
AbstractView.prototype.removeMesh = function(mesh) {
throw new Exception('Abstract Function removeMesh not overwritten ');
};
AbstractView.prototype.updateMesh = function(mesh, options) {
throw new Exception('Abstract Function updateMesh not overwritten ');
};
AbstractView.prototype.createAnimatedMesh = function (texturePaths, callback, options) {
throw new Exception('Abstract Function createAnimatedMesh not overwritten ');
}
AbstractView.prototype.setMe = function(player) {
this.me = player;
};

View file

@ -48,6 +48,10 @@ function (Parent, DomController, PIXI, Settings) {
this.container.addChild(mesh);
};
PixiView.prototype.removeMesh = function(mesh) {
this.container.removeChild(mesh);
};
PixiView.prototype.createMesh = function (texturePath, callback, options) {
var texture = PIXI.Texture.fromImage(texturePath);
@ -84,15 +88,10 @@ function (Parent, DomController, PIXI, Settings) {
if (options.height) mesh.height = options.height;
if (options.visible === true || options.visible === false) mesh.visible = options.visible;
if (options.pivot) {
switch(options.pivot) {
case "mb":
mesh.pivot.x = mesh.width / 2;
mesh.pivot.y = mesh.height;
break;
case "mm":
switch(options.pivot.length) {
default:
mesh.pivot.x = mesh.width / 2;
mesh.pivot.y = mesh.height / 2;
mesh.pivot.y = mesh.height;
break;
}