|
@@ -15,142 +15,6 @@ export default {
|
|
|
},
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- drawModelOld(modelItem, spaceObj, wallObj, isAnimate=false){
|
|
|
- let cube = wallObj.obj;
|
|
|
- let that = this;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- console.log("墙体动画", modelItem, spaceObj, wallObj, isAnimate,spaceObj.rightCenter);
|
|
|
- if(!wallObj.obj){
|
|
|
-
|
|
|
- if(modelItem.wallPositionX == wallObj.wallPositionX
|
|
|
- && modelItem.wallPositionY == wallObj.wallPositionY
|
|
|
- && modelItem.wallScaleX == wallObj.wallScaleX
|
|
|
- && modelItem.wallScaleY == wallObj.wallScaleY){
|
|
|
- return false;
|
|
|
- }
|
|
|
- wallObj.instancedMeshIndexList.forEach(item=>{
|
|
|
- let _index = item.instancedMeshIndex;
|
|
|
- let instancedMesh = this.instancedMeshList[_index];
|
|
|
- let stratMatrix = new THREE.Matrix4();
|
|
|
- let endMatrix = new THREE.Matrix4();
|
|
|
- instancedMesh.getMatrixAt(item.instancedAtIndex,stratMatrix);
|
|
|
- let position = new THREE.Vector3();
|
|
|
- let position1 = new THREE.Vector3();
|
|
|
- let scale = new THREE.Vector3();
|
|
|
- let scale1 = new THREE.Vector3();
|
|
|
- let quaternion = new THREE.Quaternion();
|
|
|
- stratMatrix.decompose(position,quaternion,scale);
|
|
|
-
|
|
|
- let x = position.x + modelItem.wallPositionX - wallObj.wallPositionX;
|
|
|
- let z = position.z + modelItem.wallPositionY - wallObj.wallPositionY;
|
|
|
-
|
|
|
- let scalex = scale.x * (modelItem.wallScaleX/ wallObj.wallScaleX);
|
|
|
- let scaley = scale.z * (modelItem.wallScaleY/ wallObj.wallScaleY);
|
|
|
-
|
|
|
- if(modelItem.wallScaleX!=wallObj.wallScaleX){
|
|
|
- if(modelItem.wallRotateY>0){
|
|
|
- let _ch = modelItem.wallPositionY - wallObj.wallPositionY;
|
|
|
- if(spaceObj.rightCenter){
|
|
|
- z = z + _ch;
|
|
|
- }else{
|
|
|
- z = z - _ch;
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
- let _ch = modelItem.wallPositionX - wallObj.wallPositionX;
|
|
|
- if(spaceObj.rightCenter){
|
|
|
- x = x + _ch;
|
|
|
- }else{
|
|
|
- x = x - _ch;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if(modelItem.wallScaleY!=wallObj.wallScaleY){
|
|
|
- if(modelItem.wallRotateY>0){
|
|
|
- let _ch = modelItem.wallPositionX - wallObj.wallPositionX;
|
|
|
- if(spaceObj.rightCenter){
|
|
|
- x = x + _ch;
|
|
|
- }else{
|
|
|
- x = x - _ch;
|
|
|
- }
|
|
|
-
|
|
|
- }else{
|
|
|
- let _ch = modelItem.wallPositionY - wallObj.wallPositionY;
|
|
|
- if(spaceObj.rightCenter){
|
|
|
- z = z + _ch;
|
|
|
- }else{
|
|
|
- z = z - _ch;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- position1.set(x, position.y, z);
|
|
|
- scale1.set(scalex,scale.y,scaley);
|
|
|
-
|
|
|
- endMatrix = endMatrix.compose(position1,quaternion,scale1);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- var tween = new TWEEN.Tween(stratMatrix.elements)
|
|
|
- .to(endMatrix.elements, 2000)
|
|
|
- .easing(TWEEN.Easing.Quadratic.InOut)
|
|
|
- .onUpdate((matrixWorld)=> {
|
|
|
- let m4 = new THREE.Matrix4();
|
|
|
- m4.set(...matrixWorld);
|
|
|
- instancedMesh.instanceMatrix.needsUpdate = true;
|
|
|
- instancedMesh.setMatrixAt(item.instancedAtIndex,m4.transpose());
|
|
|
- }).onComplete(()=>{
|
|
|
- instancedMesh.setMatrixAt(item.instancedAtIndex,endMatrix);
|
|
|
- this.tweenCameraAnmaChange(false)
|
|
|
- });
|
|
|
-
|
|
|
- tween.start();
|
|
|
- this.tweenCameraAnmaChange(true)
|
|
|
- })
|
|
|
-
|
|
|
- setTimeout(()=>{
|
|
|
- let gltfWall = that.gltfWalls.find(gltfWall=>gltfWall.uniId==wallObj.uniId);
|
|
|
- gltfWall.wallPositionX = modelItem.wallPositionX;
|
|
|
- gltfWall.wallPositionY = modelItem.wallPositionY;
|
|
|
- gltfWall.wallScaleX = modelItem.wallScaleX;
|
|
|
- gltfWall.wallScaleY = modelItem.wallScaleY;
|
|
|
- gltfWall.wallRotateY = modelItem.wallRotateY;
|
|
|
- }, 2000);
|
|
|
- }else{
|
|
|
- console.warn("***drawModel-isAnimate-2***",JSON.stringify(cube.position),JSON.stringify(cube.scale),modelItem);
|
|
|
- var tween = new TWEEN.Tween({
|
|
|
- x: cube.position.x,
|
|
|
- z: cube.position.z,
|
|
|
- sx:cube.scale.x,
|
|
|
- sz:cube.scale.z
|
|
|
- })
|
|
|
- .to({
|
|
|
- x: modelItem.wallPositionX,
|
|
|
- z: modelItem.wallPositionY,
|
|
|
- sx:modelItem.wallScaleX
|
|
|
- }, 2000)
|
|
|
- .easing(TWEEN.Easing.Quadratic.InOut)
|
|
|
- .onUpdate((object)=> {
|
|
|
- cube.position.x = object.x;
|
|
|
- cube.position.z = object.z;
|
|
|
- cube.scale.x = object.sx;
|
|
|
- cube.scale.z = object.sz;
|
|
|
- }).onComplete(()=>{
|
|
|
- this.tweenCameraAnmaChange(false)
|
|
|
- });
|
|
|
-
|
|
|
- tween.start();
|
|
|
- this.tweenCameraAnmaChange(true)
|
|
|
- }
|
|
|
- },
|
|
|
|
|
|
|
|
|
drawModel(modelItem, spaceObj, wallObj, isAnimate=false){
|