if-guards for 3d-editor

beta.r3js.org
polygonboutique 2016-11-09 12:37:46 +01:00
parent cf57556a0b
commit ac820f70ba
3 changed files with 26 additions and 22 deletions

View File

@ -24,10 +24,12 @@ GameLib.D3.ComponentFollow = function(
this.minDistance = minDistance || 0; this.minDistance = minDistance || 0;
}; };
ComponentFollow_Target_Vec3 = new THREE.Vector3(); if(typeof THREE != "undefined") {
ComponentFollow_TargetToParent_Vec3 = new THREE.Vector3(); ComponentFollow_Target_Vec3 = new THREE.Vector3();
ComponentFollow_rotatedTargetOffset_Vec3 = new THREE.Vector3(); ComponentFollow_TargetToParent_Vec3 = new THREE.Vector3();
ComponentFollow_tempQuaternion = new THREE.Quaternion(); ComponentFollow_rotatedTargetOffset_Vec3 = new THREE.Vector3();
ComponentFollow_tempQuaternion = new THREE.Quaternion();
}
///////////////////////// Methods to override ////////////////////////// ///////////////////////// Methods to override //////////////////////////
GameLib.D3.ComponentFollow.prototype.onUpdate = function( GameLib.D3.ComponentFollow.prototype.onUpdate = function(

View File

@ -22,16 +22,17 @@ GameLib.D3.ComponentLookAt = function(
this.rotationSpeed = rotationSpeed || 22.0; this.rotationSpeed = rotationSpeed || 22.0;
}; };
if(typeof THREE != "undefined") {
ComponentLookAt_rotatedTargetOffset = new THREE.Vector3(); ComponentLookAt_rotatedTargetOffset = new THREE.Vector3();
ComponentLookAt_currentPos = new THREE.Vector3(); ComponentLookAt_currentPos = new THREE.Vector3();
ComponentLookAt_targetPos = new THREE.Vector3(); ComponentLookAt_targetPos = new THREE.Vector3();
ComponentLookAt_upVector = new THREE.Vector3(0, 1, 0); ComponentLookAt_upVector = new THREE.Vector3(0, 1, 0);
ComponentLookAt_targetQuaternion = new THREE.Quaternion(0, 0, 0, 1); ComponentLookAt_targetQuaternion = new THREE.Quaternion(0, 0, 0, 1);
ComponentLookAt_tmpQuaternion = new THREE.Quaternion(0, 0, 0, 1); ComponentLookAt_tmpQuaternion = new THREE.Quaternion(0, 0, 0, 1);
ComponentLookAt_newRotationQuaternion = new THREE.Quaternion(0, 0, 0, 1); ComponentLookAt_newRotationQuaternion = new THREE.Quaternion(0, 0, 0, 1);
ComponentLookAt_lastRotationQuaternion = new THREE.Quaternion(0, 0, 0, 1); ComponentLookAt_lastRotationQuaternion = new THREE.Quaternion(0, 0, 0, 1);
ComponentLookAt_lookAtMatrix = new THREE.Matrix4(); ComponentLookAt_lookAtMatrix = new THREE.Matrix4();
}
///////////////////////// Methods to override ////////////////////////// ///////////////////////// Methods to override //////////////////////////
GameLib.D3.ComponentLookAt.prototype.onUpdate = function( GameLib.D3.ComponentLookAt.prototype.onUpdate = function(

View File

@ -15,14 +15,15 @@ GameLib.D3.ComponentMeshPermutation = function(
GameLib.D3.Utils.Extend(GameLib.D3.ComponentMeshPermutation, GameLib.D3.ComponentInterface); GameLib.D3.Utils.Extend(GameLib.D3.ComponentMeshPermutation, GameLib.D3.ComponentInterface);
}; };
ComponentMeshPermutation_quaternion = new THREE.Quaternion(); if(typeof THREE != "undefined") {
ComponentMeshPermutation_quaternionCopy = new THREE.Quaternion(); ComponentMeshPermutation_quaternion = new THREE.Quaternion();
ComponentMeshPermutation_position = new THREE.Vector3(); ComponentMeshPermutation_quaternionCopy = new THREE.Quaternion();
ComponentMeshPermutation_scale = new THREE.Vector3(); ComponentMeshPermutation_position = new THREE.Vector3();
ComponentMeshPermutation_scale = new THREE.Vector3();
ComponentMeshPermutation_offsetQuaternion = new THREE.Quaternion(); ComponentMeshPermutation_offsetQuaternion = new THREE.Quaternion();
ComponentMeshPermutation_offsetPosition = new THREE.Vector3(); ComponentMeshPermutation_offsetPosition = new THREE.Vector3();
ComponentMeshPermutation_offsetScale = new THREE.Vector3(); ComponentMeshPermutation_offsetScale = new THREE.Vector3();
}
///////////////////////// Methods to override ////////////////////////// ///////////////////////// Methods to override //////////////////////////
GameLib.D3.ComponentMeshPermutation.prototype.onLateUpdate = function( GameLib.D3.ComponentMeshPermutation.prototype.onLateUpdate = function(