update camera from controls
parent
b97ef4eac4
commit
5316925a41
|
@ -213,6 +213,10 @@ GameLib.D3.Object.prototype.updateInstance = function(property) {
|
||||||
this.quaternion.instance.w = this.quaternion.w;
|
this.quaternion.instance.w = this.quaternion.w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.Defined(this.instance.updateProjectionMatrix)) {
|
||||||
|
this.instance.updateProjectionMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'position') {
|
if (property === 'position') {
|
||||||
|
@ -227,6 +231,10 @@ GameLib.D3.Object.prototype.updateInstance = function(property) {
|
||||||
this.instance.position.y = this.position.y;
|
this.instance.position.y = this.position.y;
|
||||||
this.instance.position.z = this.position.z;
|
this.instance.position.z = this.position.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.Defined(this.instance.updateProjectionMatrix)) {
|
||||||
|
this.instance.updateProjectionMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'scale') {
|
if (property === 'scale') {
|
||||||
|
|
|
@ -39,7 +39,8 @@ GameLib.D3.Mesh = function (
|
||||||
|
|
||||||
if (
|
if (
|
||||||
GameLib.Utils.Defined(this.geometry) &&
|
GameLib.Utils.Defined(this.geometry) &&
|
||||||
GameLib.Utils.Defined(this.geometry.componentType)
|
GameLib.Utils.Defined(this.geometry.componentType) &&
|
||||||
|
!(this.geometry instanceof GameLib.D3.Geometry)
|
||||||
) {
|
) {
|
||||||
this.geometry = GameLib.Component.ConstructFromObject(this.geometry);
|
this.geometry = GameLib.Component.ConstructFromObject(this.geometry);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +48,10 @@ GameLib.D3.Mesh = function (
|
||||||
this.materials = this.materials.map(
|
this.materials = this.materials.map(
|
||||||
function(material) {
|
function(material) {
|
||||||
|
|
||||||
if (GameLib.Utils.Defined(material.componentType)) {
|
if (
|
||||||
|
GameLib.Utils.Defined(material.componentType) &&
|
||||||
|
!(material instanceof GameLib.D3.Material)
|
||||||
|
) {
|
||||||
return GameLib.Component.ConstructFromObject(material);
|
return GameLib.Component.ConstructFromObject(material);
|
||||||
} else {
|
} else {
|
||||||
return material;
|
return material;
|
||||||
|
|
|
@ -1194,24 +1194,24 @@ GameLib.System.Input.prototype.onMouseMoveEdit = function(event) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.editorControls.map(
|
GameLib.EntityManager.Instance.queryComponentsByConstructor(GameLib.Controls.D3).map(
|
||||||
function(editorControl) {
|
function(control) {
|
||||||
editorControl.camera.position.x = editorControl.camera.instance.position.x;
|
|
||||||
editorControl.camera.position.y = editorControl.camera.instance.position.y;
|
|
||||||
editorControl.camera.position.z = editorControl.camera.instance.position.z;
|
|
||||||
//
|
|
||||||
// editorControl.camera.quaternion.x = editorControl.camera.instance.quaternion.x;
|
|
||||||
// editorControl.camera.quaternion.y = editorControl.camera.instance.quaternion.y;
|
|
||||||
// editorControl.camera.quaternion.z = editorControl.camera.instance.quaternion.z;
|
|
||||||
// editorControl.camera.quaternion.w = editorControl.camera.instance.quaternion.w;
|
|
||||||
|
|
||||||
//TODO: do this below???!?
|
control.camera.position.x = control.camera.instance.position.x;
|
||||||
//editorControl.camera.lookAt.x = editorControl.instance.center.x;
|
control.camera.position.y = control.camera.instance.position.y;
|
||||||
//editorControl.camera.lookAt.y = editorControl.instance.center.y;
|
control.camera.position.z = control.camera.instance.position.z;
|
||||||
//editorControl.camera.lookAt.z = editorControl.instance.center.z;
|
|
||||||
//editorControl.camera.lookAt.instance.copy(editorControl.instance.center);
|
control.camera.rotation.x = control.camera.instance.rotation.x;
|
||||||
|
control.camera.rotation.y = control.camera.instance.rotation.y;
|
||||||
|
control.camera.rotation.z = control.camera.instance.rotation.z;
|
||||||
|
|
||||||
|
control.camera.quaternion.x = control.camera.instance.quaternion.x;
|
||||||
|
control.camera.quaternion.y = control.camera.instance.quaternion.y;
|
||||||
|
control.camera.quaternion.z = control.camera.instance.quaternion.z;
|
||||||
|
control.camera.quaternion.w = control.camera.instance.quaternion.w;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue