diff --git a/src/game-lib-a-1-event.js b/src/game-lib-a-1-event.js index 7628069..29c2196 100644 --- a/src/game-lib-a-1-event.js +++ b/src/game-lib-a-1-event.js @@ -91,6 +91,8 @@ GameLib.Event.TOUCH_START = 0x49; GameLib.Event.TOUCH_END = 0x4a; GameLib.Event.TOUCH_MOVE = 0x4b; GameLib.Event.TOUCH_CANCEL = 0x4c; +GameLib.Event.GET_REMOTE_API_URL = 0x4d; + /** * Returns string name of event ID @@ -177,6 +179,7 @@ GameLib.Event.GetEventName = function(number) { case 0x4a : return 'touch_end'; case 0x4b : return 'touch_move'; case 0x4c : return 'touch_cancel'; + case 0x4d : return 'get_remote_api_url'; break; } diff --git a/src/game-lib-a-component-a.js b/src/game-lib-a-component-a.js index ce42cf8..850b22f 100644 --- a/src/game-lib-a-component-a.js +++ b/src/game-lib-a-component-a.js @@ -380,10 +380,20 @@ GameLib.Component.prototype.getStorageDependencies = function() { return dependencies; }; -GameLib.Component.prototype.save = function() { +GameLib.Component.prototype.saveToRemoteAPI = function() { + this.save(true); +}; + +GameLib.Component.prototype.save = function(remote) { + + var event = GameLib.Event.GET_API_URL; + + if (remote) { + event = GameLib.Event.GET_REMOTE_API_URL + } this.publish( - GameLib.Event.GET_API_URL, + event, null, function(data) { this.buildIdToObject(); diff --git a/src/game-lib-d3-mesh-0.js b/src/game-lib-d3-mesh-0.js index ea55321..da86320 100644 --- a/src/game-lib-d3-mesh-0.js +++ b/src/game-lib-d3-mesh-0.js @@ -940,10 +940,64 @@ GameLib.D3.Mesh.prototype.centerAroundOrigin = function() { }; GameLib.D3.Mesh.prototype.applyAxisAngleToPosition = function(axis, angle) { - this.position.applyAxisAngle(this.quaternion.axis, this.quaternion.angle); + + if (GameLib.Utils.UndefinedOrNull(axis)) { + axis = this.quaternion.axis; + } + + if (GameLib.Utils.UndefinedOrNull(angle)) { + angle = this.quaternion.angle; + } + + this.position.applyAxisAngle(axis, angle); this.updateInstancePosition(); }; +GameLib.D3.Mesh.prototype.applyAxisAngleToUvs = function(axis, angle) { + + if (GameLib.Utils.UndefinedOrNull(axis)) { + axis = this.quaternion.axis; + } + + if (GameLib.Utils.UndefinedOrNull(angle)) { + angle = this.quaternion.angle; + } + + // this.instance.geometry.faceVertexUvs[0].map( + // function(uvs) { + // uvs.map(function(uv) { + // + // var x = uv.x; + // + // uv.x = uv.y; + // uv.y = x; + // + // //var v = new THREE.Vector3(uv.x, uv.y, 0); + // //v.applyAxisAngle(axis, angle); + // //uv.x = v.x; + // //uv.y = v.u; + // }); + // } + // ); + + this.instance.geometry.uvsNeedUpdate = true; + // + // this.faces.map( + // function(face) { + // face.uvs.map(function(uvs){ + // uvs.map( + // function(uv) { + // var v = new GameLib.Vector3(this.graphics, new GameLib.API.Vector3(uv.x, uv.y, 0)); + // v.applyAxisAngle(axis, angle); + // uv.x = v.x; + // uv.y = v.y; + // } + // ) + // }); + // } + // ) +}; + GameLib.D3.Mesh.prototype.translate = function(vector3) { this.position.x += vector3.x;