update instance for mesh
parent
e4a5554c56
commit
b5e55136b9
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
// COMPILE TIME DEFINITIONS (Generated via gulp)
|
||||||
var __DATE__ = "Sat Nov 25 2017 11:12:58 GMT+0100 (CET)";
|
var __DATE__ = "Sun Nov 26 2017 22:50:32 GMT+0100 (CET)";
|
||||||
// END COMPILE TIME DEFINITIONS
|
// END COMPILE TIME DEFINITIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14041,6 +14041,11 @@ GameLib.D3.Mesh.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Mesh.prototype.updateInstance = function(property) {
|
GameLib.D3.Mesh.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(property)) {
|
||||||
|
console.warn('unknown mesh property update');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'isBufferMesh') {
|
||||||
if (( this.isBufferMesh && !(this.instance.geometry instanceof THREE.BufferGeometry)) ||
|
if (( this.isBufferMesh && !(this.instance.geometry instanceof THREE.BufferGeometry)) ||
|
||||||
( !this.isBufferMesh && (this.instance.geometry instanceof THREE.BufferGeometry)))
|
( !this.isBufferMesh && (this.instance.geometry instanceof THREE.BufferGeometry)))
|
||||||
{
|
{
|
||||||
|
@ -14049,56 +14054,61 @@ GameLib.D3.Mesh.prototype.updateInstance = function(property) {
|
||||||
*/
|
*/
|
||||||
this.instance.geometry = this.createInstanceGeometry(this.instance.geometry);
|
this.instance.geometry = this.createInstanceGeometry(this.instance.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useQuaternion) {
|
|
||||||
if (this.updateRotationFromAxisAngle) {
|
|
||||||
this.updateInstanceRotationFromAxisAngle();
|
|
||||||
} else {
|
|
||||||
this.instance.quaternion.x = this.quaternion.x;
|
|
||||||
this.instance.quaternion.y = this.quaternion.y;
|
|
||||||
this.instance.quaternion.z = this.quaternion.z;
|
|
||||||
this.instance.quaternion.w = this.quaternion.w;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.instance.rotation.x = this.rotation.x;
|
|
||||||
this.instance.rotation.y = this.rotation.y;
|
|
||||||
this.instance.rotation.z = this.rotation.z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'rotation' ||
|
||||||
|
property === 'quaternion' ||
|
||||||
|
property === 'useQuaternion'
|
||||||
|
) {
|
||||||
|
this.updateInstanceRotation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'parentMesh') {
|
||||||
if (this.parentMesh && this.parentMesh.instance) {
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
if (this.instance.parent !== this.parentMesh.instance) {
|
if (this.instance.parent !== this.parentMesh.instance) {
|
||||||
this.instance.parent = this.parentMesh.instance;
|
this.instance.parent = this.parentMesh.instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.instance.scale.x = this.scale.x;
|
if (property === 'scale') {
|
||||||
this.instance.scale.y = this.scale.y;
|
this.updateInstanceScale();
|
||||||
this.instance.scale.z = this.scale.z;
|
}
|
||||||
|
|
||||||
this.instance.position.x = this.position.x;
|
if (property === 'position') {
|
||||||
this.instance.position.y = this.position.y;
|
this.updateInstancePosition();
|
||||||
this.instance.position.z = this.position.z;
|
}
|
||||||
|
|
||||||
|
if (property === 'up') {
|
||||||
this.instance.up.x = this.up.x;
|
this.instance.up.x = this.up.x;
|
||||||
this.instance.up.y = this.up.y;
|
this.instance.up.y = this.up.y;
|
||||||
this.instance.up.z = this.up.z;
|
this.instance.up.z = this.up.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'name') {
|
||||||
this.instance.name = this.name;
|
this.instance.name = this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'materials') {
|
||||||
if (this.materials.length === 1 && this.materials[0].instance) {
|
if (this.materials.length === 1 && this.materials[0].instance) {
|
||||||
this.instance.material = this.materials[0].instance;
|
this.instance.material = this.materials[0].instance;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'renderOrder') {
|
||||||
this.instance.renderOrder = this.renderOrder;
|
this.instance.renderOrder = this.renderOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'visible') {
|
||||||
|
this.instance.visible = this.visible;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.helper) {
|
if (this.helper) {
|
||||||
this.removeHelper();
|
this.removeHelper();
|
||||||
this.createHelper();
|
this.createHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'visible') {
|
|
||||||
this.instance.visible = this.visible;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -564,6 +564,11 @@ GameLib.D3.Mesh.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Mesh.prototype.updateInstance = function(property) {
|
GameLib.D3.Mesh.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(property)) {
|
||||||
|
console.warn('unknown mesh property update');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'isBufferMesh') {
|
||||||
if (( this.isBufferMesh && !(this.instance.geometry instanceof THREE.BufferGeometry)) ||
|
if (( this.isBufferMesh && !(this.instance.geometry instanceof THREE.BufferGeometry)) ||
|
||||||
( !this.isBufferMesh && (this.instance.geometry instanceof THREE.BufferGeometry)))
|
( !this.isBufferMesh && (this.instance.geometry instanceof THREE.BufferGeometry)))
|
||||||
{
|
{
|
||||||
|
@ -572,56 +577,61 @@ GameLib.D3.Mesh.prototype.updateInstance = function(property) {
|
||||||
*/
|
*/
|
||||||
this.instance.geometry = this.createInstanceGeometry(this.instance.geometry);
|
this.instance.geometry = this.createInstanceGeometry(this.instance.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useQuaternion) {
|
|
||||||
if (this.updateRotationFromAxisAngle) {
|
|
||||||
this.updateInstanceRotationFromAxisAngle();
|
|
||||||
} else {
|
|
||||||
this.instance.quaternion.x = this.quaternion.x;
|
|
||||||
this.instance.quaternion.y = this.quaternion.y;
|
|
||||||
this.instance.quaternion.z = this.quaternion.z;
|
|
||||||
this.instance.quaternion.w = this.quaternion.w;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.instance.rotation.x = this.rotation.x;
|
|
||||||
this.instance.rotation.y = this.rotation.y;
|
|
||||||
this.instance.rotation.z = this.rotation.z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'rotation' ||
|
||||||
|
property === 'quaternion' ||
|
||||||
|
property === 'useQuaternion'
|
||||||
|
) {
|
||||||
|
this.updateInstanceRotation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'parentMesh') {
|
||||||
if (this.parentMesh && this.parentMesh.instance) {
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
if (this.instance.parent !== this.parentMesh.instance) {
|
if (this.instance.parent !== this.parentMesh.instance) {
|
||||||
this.instance.parent = this.parentMesh.instance;
|
this.instance.parent = this.parentMesh.instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.instance.scale.x = this.scale.x;
|
if (property === 'scale') {
|
||||||
this.instance.scale.y = this.scale.y;
|
this.updateInstanceScale();
|
||||||
this.instance.scale.z = this.scale.z;
|
}
|
||||||
|
|
||||||
this.instance.position.x = this.position.x;
|
if (property === 'position') {
|
||||||
this.instance.position.y = this.position.y;
|
this.updateInstancePosition();
|
||||||
this.instance.position.z = this.position.z;
|
}
|
||||||
|
|
||||||
|
if (property === 'up') {
|
||||||
this.instance.up.x = this.up.x;
|
this.instance.up.x = this.up.x;
|
||||||
this.instance.up.y = this.up.y;
|
this.instance.up.y = this.up.y;
|
||||||
this.instance.up.z = this.up.z;
|
this.instance.up.z = this.up.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'name') {
|
||||||
this.instance.name = this.name;
|
this.instance.name = this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'materials') {
|
||||||
if (this.materials.length === 1 && this.materials[0].instance) {
|
if (this.materials.length === 1 && this.materials[0].instance) {
|
||||||
this.instance.material = this.materials[0].instance;
|
this.instance.material = this.materials[0].instance;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'renderOrder') {
|
||||||
this.instance.renderOrder = this.renderOrder;
|
this.instance.renderOrder = this.renderOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'visible') {
|
||||||
|
this.instance.visible = this.visible;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.helper) {
|
if (this.helper) {
|
||||||
this.removeHelper();
|
this.removeHelper();
|
||||||
this.createHelper();
|
this.createHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'visible') {
|
|
||||||
this.instance.visible = this.visible;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue