get remote api url event

beta.r3js.org
-=yb4f310 2017-10-02 10:26:12 +02:00
parent ccb92eb363
commit c39d975f8f
3 changed files with 70 additions and 3 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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;