lanzhouYC/public/unity.html

1991 lines
82 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
}
#unity {
width: 100%;
height: 100%;
position: relative;
/* background: url(./lib/bj1.png) no-repeat;
background-size: cover; */
}
</style>
</head>
<body>
<div id="unity">
</div>
</body>
</html>
<!-- <script src="../src/assets/js/ht-init-config.js"></script> -->
<script src="./lib/vue.minV2.5.17.js"></script>
<script src="./lib/axios.minV0.18.0.js"></script>
<script src="lib/core/ht.js"></script>
<script src="lib/plugin/ht-obj.js"></script>
<script src="lib/plugin/ht-animation.js"></script>
<script src="./lib/require.js"></script>
<script>
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^'']*)(&|$)", "i");
// var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function handleBoom() {
console.log('aaaa');
if (getQueryString('src') == '1') {
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[2] + 40,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[2] - 40,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] + 40,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] - 40,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[1] - 40,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[1] + 110,
1,
1000,
function () {
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[1] + 40,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[1] + 90,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] + 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[1] + 60,
1,
2000,
function () { }
);
}
);
} else if (getQueryString('src') == 'chelun') {
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[1] + 12,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[1] + 16,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[21],
unity.models[21].p3()[1] + 17,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[20],
unity.models[20].p3()[1] + 15,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[19],
unity.models[19].p3()[1] + 6,
1,
2000,
function () {
}
);
unity.nodeAnimation(
unity.models[17],
unity.models[17].p3()[1] + 21,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[1] + 6,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[0] + 8,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[0] + 10,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[12],
unity.models[12].p3()[0] + 8,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[0] + 4,
0,
2000,
function () { }
);
}
);
}
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] + 14,
0,
2000,
function () {
}
);
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[0] + 14,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[1] - 5,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[1] - 2,
1,
2000,
function () { }
);
}
);
}
);
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[0] + 17,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[0] + 14,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[0] - 20,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] - 13,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[0] - 8,
0,
2000,
function () { }
);
}
);
}
);
}
);
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[1] + 6,
1,
2000,
function () { }
);
} else if (getQueryString('src') == 'jusheng') {
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[2] + 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[2] + 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[2] + 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[2] + 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[2] - 20,
2,
2000,
function () {
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[1] + 20,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[2] - 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[2] - 10,
2,
2000,
function () {
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[0] - 17,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[2] - 4,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[2] + 4,
2,
2000,
function () { }
);
}
);
}
);
}
);
} else if (getQueryString('src') == '2') {
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[1] + 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[1] + 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[1] + 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[1] + 20,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[1] + 10,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[0] - 10,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] + 10,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] - 10,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[2] + 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[12],
unity.models[12].p3()[2] + 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[2] + 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[2] - 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[14],
unity.models[14].p3()[2] - 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[2] - 10,
2,
2000,
function () { }
);
}
);
}
);
} else if (getQueryString('src') == '3') {
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[2] - 70,
2,
1500,
function () {
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[2] - 30,
2,
1800,
function () {
})
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[0] + 35,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] - 35,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[2] - 45,
2,
1500,
function () {
})
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[2] + 35,
2,
1800,
function () {
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[1] - 55,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] + 50,
1,
1500,
function () {
})
})
}
);
} else if (getQueryString('src') == '4') {
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[1] + 100,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[17],
unity.models[17].p3()[1] + 85,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[21],
unity.models[21].p3()[1] + 75,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[20],
unity.models[20].p3()[0] + 70,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[0] + 30,
0,
1500,
function () {
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[1] + 25,
1,
1500,
function () {
})
})
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[0] + 30,
0,
1500,
function () {
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[1] + 25,
1,
1500,
function () {
})
})
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[0] + 30,
0,
1500,
function () {
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[1] + 15,
1,
1500,
function () {
})
})
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] + 30,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[14],
unity.models[14].p3()[0] + 50,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[0] + 20,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] - 60,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[0] - 60,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[0] - 80,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[19],
unity.models[19].p3()[0] - 80,
0,
1500,
function () {
unity.nodeAnimation(
unity.models[19],
unity.models[19].p3()[1] + 15,
1,
1500,
function () {
})
})
})
})
})
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[1] - 50,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[2] - 30,
2,
1500,
function () {
})
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[2] + 30,
2,
1500,
function () {
})
unity.nodeAnimation(
unity.models[18],
unity.models[18].p3()[1] - 50,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] - 50,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[13],
unity.models[13].p3()[1] - 40,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[12],
unity.models[12].p3()[1] - 30,
1,
1500,
function () {
})
})
}
}
function handleReduction() {
console.log('bbbb');
if (getQueryString('src') == '1') {
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[1] - 40,
1,
1000,
function () {
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] - 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[1] - 90,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[1] - 110,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[1] - 60,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[2] - 40,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[2] + 40,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] - 40,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] + 40,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[1] + 40,
1,
2000,
function () { }
);
}
);
}
);
} else if (getQueryString('src') == 'chelun') {
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[1] - 12,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[1] - 16,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[21],
unity.models[21].p3()[1] - 17,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[20],
unity.models[20].p3()[1] - 15,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[19],
unity.models[19].p3()[1] - 6,
1,
2000,
function () {
}
);
unity.nodeAnimation(
unity.models[17],
unity.models[17].p3()[1] - 21,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[1] - 6,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[0] - 8,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[0] - 4,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[12],
unity.models[12].p3()[0] - 8,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[0] - 10,
0,
2000,
function () { }
);
}
);
}
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] - 14,
0,
2000,
function () {
}
);
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[0] - 14,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[1] + 5,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[1] + 2,
1,
2000,
function () { }
);
}
);
}
);
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[0] - 17,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[0] - 14,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[0] + 8,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] + 13,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[0] + 20,
0,
2000,
function () { }
);
}
);
}
);
}
);
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[1] - 6,
1,
2000,
function () { }
);
} else if (getQueryString('src') == 'jusheng') {
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[2] + 4,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[2] - 4,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[0] + 17,
0,
2000,
function () {
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[2] + 10,
2,
2000,
function () { }
)
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[1] - 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[2] + 10,
2,
2000,
function () {
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[2] + 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[2] - 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[2] - 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[2] - 20,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[2] - 20,
2,
2000,
function () { }
);
}
);
}
);
} else if (getQueryString('src') == '2') {
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[0] + 10,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] - 10,
0,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] + 10,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[2] - 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[12],
unity.models[12].p3()[2] - 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[10],
unity.models[10].p3()[2] - 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[2] + 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[14],
unity.models[14].p3()[2] + 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[2] + 10,
2,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[1] - 10,
1,
2000,
function () {
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[1] - 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[1] - 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[1] - 20,
1,
2000,
function () { }
);
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[1] - 20,
1,
2000,
function () { }
);
}
);
} else if (getQueryString('src') == '3') {
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[1] + 55,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] - 50,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[2] - 35,
2,
1800,
function () {
})
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[0] - 35,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] + 35,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[2] + 30,
2,
1800,
function () {
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[2] + 45,
2,
1500,
function () {
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[2] + 70,
2,
1500,
function () {
})
})
}
);
})
} else if (getQueryString('src') == '4') {
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[1] - 25,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[1] - 25,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[1] - 15,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[19],
unity.models[19].p3()[1] - 15,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[5],
unity.models[5].p3()[0] + 80,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[19],
unity.models[19].p3()[0] + 80,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[6],
unity.models[6].p3()[0] + 60,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[11],
unity.models[11].p3()[0] + 60,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[14],
unity.models[14].p3()[0] - 50,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[3],
unity.models[3].p3()[0] - 20,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[4],
unity.models[4].p3()[0] - 30,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[7],
unity.models[7].p3()[0] - 30,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[15],
unity.models[15].p3()[0] - 30,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[16],
unity.models[16].p3()[0] - 30,
0,
1500,
function () {
})
unity.nodeAnimation(
unity.models[20],
unity.models[20].p3()[0] - 70,
0,
1500,
function () {
unity.nodeAnimation(
unity.models[21],
unity.models[21].p3()[1] - 75,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[2],
unity.models[2].p3()[2] - 30,
2,
1500,
function () {
})
unity.nodeAnimation(
unity.models[1],
unity.models[1].p3()[2] + 30,
2,
1500,
function () {
})
unity.nodeAnimation(
unity.models[17],
unity.models[17].p3()[1] - 85,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[9],
unity.models[9].p3()[1] - 100,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[13],
unity.models[13].p3()[1] + 40,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[12],
unity.models[12].p3()[1] + 30,
1,
1500,
function () {
unity.nodeAnimation(
unity.models[8],
unity.models[8].p3()[1] + 50,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[0],
unity.models[0].p3()[1] + 50,
1,
1500,
function () {
})
unity.nodeAnimation(
unity.models[18],
unity.models[18].p3()[1] + 50,
1,
1500,
function () {
})
})
})
})
})
}
}
var unity = new Vue({
el: '#unity',
data() {
return {
mtlFiles: [],
files: [],
realObj: [],
rawS3: null, // 模型原始大小
dm: null, // DataModel
g3d: null, // 3d环境
models: {},
modulesFiles: ['车架', '底板部分', '电池部件', '覆盖件部分', '举升总成', '托板', '行走部件', '转向部件'],
modelResource: [],
modelUrl: '',
boomStatus: true
}
},
mounted() {
this.staticArr()
},
methods: {
staticArr() {
if (getQueryString('src') == '1') {
this.modulesFiles = ['车架', '底板部分', '电池部件', '覆盖件部分01', '覆盖件部分02', '覆盖件部分03', '覆盖件部分04', '举升总成', '托板', '行走部件', '转向部件']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "车架",
name: '车架',
pos: [0, 0, 0],
size: [1, 1, 1],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "车架",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
obj.name = item
this.modelResource.push(obj)
})
this.modelUrl = 'Rgv/oneLevel/'
if (this.modulesFiles.length == 11) {
this.getData()
}
} else if (getQueryString('src') == 'chelun') {
this.modulesFiles = ['车轮', '大齿轮轴', '防撞轴', '防撞轴承', '防撞轴承座', '轮边测距传感器', '内轮架', '驱动转接套', '外轮架', '行走电机减速器总成', '有无货传感器', '有无货传感器支架', '轴承1', '轴承2', '轴承3', '轴承垫圈1', '轴承端盖', '转向连杆', '转向轴', '转向座', '轴承_01', '轴承_02']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "车架",
name: '车架',
pos: [0, 0, 0],
size: [1, 1, 1],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "车架",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
this.modelResource.push(obj)
})
this.modelUrl = 'Rgv/twoLevel/chelun/'
if (this.modulesFiles.length == 22) {
this.getData()
}
} else if (getQueryString('src') == 'jusheng') {
this.modulesFiles = ['挡片', '电动缸机架', '电动缸销轴', '电动缸总成', '机架销轴', '连杆', '连杆销轴1', '连杆销轴2', '摇臂机架', '摇臂凸轮', '电动缸转接座_001', '电动缸转接座_002']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "车架",
name: '车架',
pos: [0, 0, 0],
size: [1, 1, 1],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "车架",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
this.modelResource.push(obj)
})
this.modelUrl = 'Rgv/twoLevel/jusheng/'
if (this.modulesFiles.length == 12) {
this.getData()
}
} else if (getQueryString('src') == 'zhuanxiang') {
this.modulesFiles = ['大齿轮', '链条', '双链轮座', '小齿轮座', '张紧支座1', '张紧支座2', '张紧支座3', '转向电机总成']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "车架",
name: '车架',
pos: [0, 0, 0],
size: [1, 1, 1],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "车架",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
this.modelResource.push(obj)
})
this.modelUrl = 'Rgv/twoLevel/zhuanxiang/'
if (this.modulesFiles.length == 8) {
this.getData()
}
} else if (getQueryString('src') == '2') {
this.modulesFiles = ['机架底部', '机架顶部', '减速电机', '立柱后片', '立柱前片', '载货台', '惰轮组件1', '惰轮组件2', '惰轮组件3', '惰轮组件4', '一层停车部件1', '一层停车部件2'
, '二层停车部件1', , '二层停车部件2', '三层停车部件1', '三层停车部件2', '载货台停车部件1', '载货台停车部件2']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "提升机",
name: '提升机',
pos: [0, -50, 0],
size: [16, 16, 16],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "提升机",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
obj.name = item
this.modelResource.push(obj)
})
this.modelUrl = 'Hgv/oneLevel/'
if (this.modulesFiles.length == 19) {
this.getData()
}
} else if (getQueryString('src') == '3') {
this.modulesFiles = ['过渡输送机构', '爬梯结构', '起升机构', '载货台机构', '主体框架01', '主体框架02', '主体框架03', '主体框架04', '主体框架05', '主体框架06']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "提升机",
name: '提升机',
pos: [0, 0, 0],
size: [0.08, 0.08, 0.08],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "提升机",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
obj.name = item
this.modelResource.push(obj)
})
this.modelUrl = 'Tw3/oneLevel/'
console.log(this.modulesFiles.length);
if (this.modulesFiles.length == 10) {
this.getData()
}
} else if (getQueryString('src') == '4') {
this.modulesFiles = ['电池勾', '观察窗1', '观察窗2', '滚珠丝杆', '减速电机CMP50M_BK_AK1H', '减速电机RGH4KCA', '其余部件01',
'其余部件02', '其余部件03', '其余部件04', '其余部件05', '深沟球轴承6302_2RZ', '丝杆安装下端支座', '丝性滑轨RGH25CA', '丝性滑轨RGH35CA',
'提升从动齿轮', '提升主动齿轮', '线性滑轨RGH25CA', '小汽缸', '行走主动齿轮', '直线滑轨安装座', '主滑动框架']
this.modulesFiles.forEach((item, index) => {
var obj = {
cId: 1,
parentName: "电池",
name: '电池',
pos: [0, 0, 0],
size: [0.13, 0.13, 0.13],
rotate: [0, 0, 0],
wirePos: [],
affiliation: [],
type: "电池",
visible: true,
passenger: [],
taskCode: -1,
}
obj.cId = index
obj.parentName = item
obj.type = item
obj.name = item
this.modelResource.push(obj)
})
this.modelUrl = 'Dcv/oneLevel/'
console.log(this.modulesFiles.length);
if (this.modulesFiles.length == 22) {
this.getData()
}
}
},
// 爆炸
nodeAnimation(node, to, axis, duration, completeCallback, followNodes) {
let f = node.p3()[axis];
let t = to;
let dir = f > t ? -1 : 1;
//启动节点动画
node.setAnimation({
move: {
from: node.p3()[axis],
to: to,
easing: "Linear",
duration: duration,
onUpdate: function (value) {
let thisPos = node.p3();
if (dir == -1) {
if (value > to) thisPos[axis] = value;
else thisPos[axis] = to;
} else {
if (value < to) thisPos[axis] = value;
else thisPos[axis] = to;
}
// thisPos[axis] = value;
node.setPosition3d(thisPos);
if (followNodes != undefined) {
for (var idx in followNodes) {
let fpos = followNodes[idx].p3();
fpos[axis] = thisPos[axis];
followNodes[idx].setPosition3d(fpos);
}
}
},
},
start: ["move"],
}); //动画计时结束调用回调
setTimeout(() => {
if (completeCallback != undefined) {
completeCallback();
}
}, duration * 1.1);
},
//获取模型贴图
getData() {
// const mtlFiles = ['穿梭车'];
let promiseArr = []
this.modulesFiles.forEach((key) => {
let p1 = new Promise((resolve, reject) => {
axios({
method: "get",
url: this.modelUrl + key + '.obj',
}).then((res) => {
resolve(res);
this.files.push({ name: key, text: res.data, mtltext: '' });
});
});
promiseArr.push(p1)
});
this.modulesFiles.forEach((key) => {
let p2 = new Promise((resolve, reject) => {
axios({
method: "get",
url: this.modelUrl + key + '.mtl',
}).then((res) => {
resolve(res);
this.mtlFiles.push({ name: key, text: res.data });
});
});
promiseArr.push(p2)
});
Promise.all(promiseArr).then((res) => {
this.mtlFiles.forEach(item => {
this.files.map(items => {
if (item.name == items.name) {
items.mtltext = item.text
}
return items
})
})
this.getFakeData(this.files);
});
},
// 从文件获取模型数据依赖renderRealData()
getFakeData(files) {
let reader = [];
for (let i = 0; i < files.length; i++) {
this.realObj.push({
parentName: files[i].name,
objText: files[i].text,
mtltext: files[i].mtltext
});
if (this.realObj.length === files.length) {
// 读取完毕
this.renderRealData();
}
}
},
// 渲染模型依赖renderSingle()
renderRealData() {
// 实体状态看板计时器
this.rawS3 = null;
this.dm = new ht.DataModel(); // 创建数据容器
this.g3d = window.g3d = new ht.graph3d.Graph3dView(this.dm); // 创建3D环境并挂载到window
this.g3d.setGridVisible(false); // 显示网格
// this.g3d.getView().style.background = 'darkgrey' ; // 设置3D空间背景颜色
// this.g3d.setGridColor('lightgrey'); // 设置网格颜色
// this.g3d.setGridSize(40); // 设置网格行列数默认为40
// this.g3d.setGridGap(10); // 设置网格线间距
// this.g3d.setFar(10000); // 设置远端截面位置默认值为10000
// this.g3d.setOrthoWidth(5000); // 设置正交投影宽度默认为2000
// this.g3d.setFogNear(100); // 迷雾影响起始距离
// this.g3d.setFogFar(8000); // 迷雾完全遮盖图元的距离
// this.g3d.setFogMode('linear'); // 迷雾过渡效果
this.g3d.setEye([0, 300, 300]); // 镜头位置
this.g3d.setCenter([0, 0, 0]); // 设置中心点
this.g3d.enableToolTip(); // 启用文字提示
this.g3d.addToDOM(); // 将3D环境加载到document.body下
this.g3d.setEditable(false); // 启用编辑
this.g3d.setMovableFunc(function (data) {
// 可移动性setMovableFunc的参数如果是null则所有图元都可移动参数如果是function则返回true可移动返回false不可移动
// return data.cId <= 4 ? false : true; // 可以通过Node.cId设置可移动的图元
return false;
});
this.g3d.setVisibleFunc(function (data) {
// 设置图元可见性,内部循环
return data.cVisible;
});
// 设置背景图片
// this.g3d.showDebugTip(true); // 开启Debug面板
this.g3d.addInteractorListener((e) => {
// 交互回调
// 交互事件参考:
// beginRotate开始旋转
// betweenRotate旋转过程
// endRotate结束旋转
// beginWalk开始行进
// betweenWalk行进过程
// endWalk结束行进
// beginZoom开始缩放
// betweenZoom缩放过程
// endZoom结束缩放
// beginPan开始平移
// betweenPan平移过程
// endPan结束平移
// beginPinch开始双指缩放
// betweenPinch双指缩放过程
// endPinch结束双指缩放
// toggleNote双击在note上
// toggleNote2双击在note2上
// clickData单击图元
// clickBackground单击背景
// doubleClickData双击图元
// doubleClickBackground双击背景
// beginEditRotation: 开始编辑图元旋转角度
// betweenEditRotation: 正在编辑图元旋转角度
// endEditRotation: 结束编辑图元旋转角度
// beginEditSize: 开始编辑图元大小
// betweenEditSize: 正在编辑图元大小
// endEditSize: 结束编辑图元大小
// beginMove: 开始移动图元
// betweenMove: 正在移动图元
// endMove: 结束移动图元
// beginRectSelect: 开始框选图元
// betweenRectSelect: 正在框选图元
// endRectSelect: 结束框选图元
// beginEditRect
// betweenEditRect
// endEditRect
// beginEditPoint
// betweenEditPoint
// endEditPoint
// moveLeft
// moveRight
// moveUp
// moveDown
// 左键单击实体
if (e.kind === "clickData" && e.event.mousedown0_isDoubleClick) {
// let content = document.querySelectorAll(".feedback-panel p");
this.cId = e.data.cId;
this.cName = e.data.cName;
this.cTaskCode = e.data.cTaskCode;
console.log(e.data, ",,,,e.data");
console.log(
`[HT-TEST] NODE:\n- cId: ${e.data.cId
}\n- cParentName(模型文件名): ${e.data.cParentName
}\n- cName(模型名称): ${e.data.cName}\n- cType(模型类别): ${e.data.cType
}\n- p3(位置): [${e.data.p3()}]\n- s3(大小): [${e.data.s3()}]\n- r3(旋转): [${e.data.r3()}]\n- cWirePos(网格坐标): [${e.data.cWirePos
}]\n- cAffiliation(附属设备): [${e.data.cAffiliation
}]\n- cVisible(可见性): ${e.data.cVisible
}\n- cPassenger(所载设备): [${e.data.cPassenger
}]\n- cTaskCode(任务号): ${e.data.cTaskCode}\n- cState(运行状态): ${e.data.cState
}\n- color(颜色): ${e.data.getStyle(
"shape3d.color"
)}\n- anchor(锚点): (${e.data.getAnchor3d().x},${e.data.getAnchor3d().y
},${e.data.getAnchor3d().z})\n- click pos(鼠标点击位置): (${e.event.clientX
},${e.event.clientY})\n- _id: ${e.data._id}\n- _name: ${e.data._name
}`
);
// content[0].innerHTML = `设备名称:${e.data.cName}`;
// content[1].innerHTML = `状态:${e.data.cState}`;
// clearTimeout(timer);
// 后期交互功能……
}
// 双击实体
if (e.kind === "doubleClickData") {
let that = this
let boomStatus = that.boomStatus
this.g3d.flyTo(e.data, {
animation: true,
ratio: 0.6, // [0, 1],越大相机越近
});
if (e.data.cName == '行走部件') {
window.parent.postMessage({
boomStatus
}, '*'); // * 通配符 匹配所有地址; content 表示传递过去嵌套iframe页面的数据
window.parent.unityChange('chelun')
} else if (e.data.cName == '举升总成') {
window.parent.postMessage({
boomStatus
}, '*'); // * 通配符 匹配所有地址; content 表示传递过去嵌套iframe页面的数据
window.parent.unityChange('jusheng')
} else if (e.data.cName == '转向部件') {
window.parent.postMessage({
boomStatus
}, '*'); // * 通配符 匹配所有地址; content 表示传递过去嵌套iframe页面的数据
window.parent.unityChange('zhuanxiang')
}
}
// 双击实体
if (e.kind === "doubleClickData") {
// console.log('aaaaa');
console.log(e.data);
this.dataInfo = e.data;
// this.$emit("equipmentInfo", this.dataInfo);
this.g3d.flyTo(e.data, {
animation: true,
ratio: 0.6, // [0, 1],越大相机越近
})
}
// 开始旋转镜头
// if (e.kind === 'beginRotate') {
// this.g3d.setVisibleFunc(function(data) {
// if (!/货箱/.test(data.cParentName)) {return true}// 设置图元可见性,内部循环
// });
// }
// 结束旋转镜头
// if (e.kind === 'endRotate') {
// this.g3d.setVisibleFunc(function(data) { // 设置图元可见性,内部循环
// return data.cVisible
// });
// }
});
// 渲染模型
// 单个导入
this.renderSingle();
// 以组导入
// renderAsGroup(realMtl, realObj);
},
// 单个导入依赖createNode()
renderSingle() {
for (let i = 0; i < this.realObj.length; i++) {
var modelMap = ht.Default.parseObj(
this.realObj[i].objText,
this.realObj[i].mtltext,
{ center: false, cube: true, ignoreImage: false, t3: [0, 0, 0], prefix: this.modelUrl }
);
this.modelarray = [];
for (var name in modelMap) {
this.modelarray.push(modelMap[name]);
}
// 注册解析出来的obj
ht.Default.setShape3dModel(this.realObj[i].parentName, this.modelarray);
// 循环创建node
for (let j = 0; j < this.modelResource.length; j++) {
// 只会创建在modelResource中有对应parentName的实体多导入的obj不会被创建
if (this.modelResource[j].parentName === this.realObj[i].parentName) {
this.createNode(this.modelResource[j], this.modelarray);
}
}
}
this.dm.enableAnimation();
let loadingShow = false
// this.$emit('loadingShow',loadingShow)
window.parent.postMessage({
loadingShow
}, '*'); // * 通配符 匹配所有地址; content 表示传递过去嵌套iframe页面的数据
},
createNode(single, array, conveyorInfo) {
if (this.models[single.cId] != undefined) {
return;
}
var node = new ht.Node();
node.cId = single.cId; // 挂载modelResource中的cId属性
node.cParentName = single.parentName; // 挂载modelResource中的parentName属性
node.cName = single.name; // 挂载modelResource中的name属性
node.cType = single.type; // 挂载modelResource中的type属性
node.cWirePos = single.wirePos; // 挂载modelResource中的wirePos属性
node.cAffiliation = single.affiliation; // 挂载modelResource中的affiliation属性
node.cVisible = single.visible; // 挂载modelResource中的visible属性
node.cPassenger = single.passenger; // 挂载modelResource中的passenger属性
node.cTaskCode = single.taskCode; // 挂载modelResource中的taskCode属性
node.cState = "正常"; // 挂载modelResource中的state属性待确认
node.cApp = this;
node.doxId = null;
// 在这里挂载更多属性所有挂载的属性建议以c开头便于区分
node.remove = function () {
this.cApp.dm.remove(this);
};
node.s({
shape3d: single.parentName, // 模型类别与obj文件一一对应1
// 'wf.visible': 'selected', // 线框是否可见
// 'wf.color': 'red', // 线框颜色
// color:conveyorInfo.cId.indexOf('53')!=-1?'orange':'red'
// "shape3d.color":'orange', // 模型着色
"shape3d.transparent": false, // 模型是否透明
"shape3d.opacity": 1, // 模型透明度
// "wf.geometry": false, // 是否显示几何体的线条
// "wf.loadQuadWireframe": true, // 是否载入四边面的线框
// "wf.combineTriangle": true, // 线框模型是否合并三角
// "all.transparent": true,
// 'all.color': 'red',
'all.image': '',
// 'note': 'One Node',
// 'note.color': 'black',
// 'note.background': 'lightblue',
// 'note.face': 'center',
// 'note.position': 7,
// 'note.autorotate': 'y',
});
// 模型允许的条件下开启线框模式?(需要模型细节,但无法满足加载时间需求)
// node.s({
// 'shape3d.transparent': true,
// 'shape3d.opacity': 0,
// 'wf.geometry': true,
// 'wf.combineTriangle': 0, // 0 - 不合并三角形1 - 合并相邻三角为四边面原来的效果2 - 融合所有联通的共面三角面3 - 根据法线信息融合所有平滑三角面
// 'wf.color': 'rgba(96, 172, 252, .3)'
// })
// 设置尺寸
// node.s3(array[0].rawS3); // rawS3格式[x, y, z]设置cube参数后大小归1这里用rawS3*1得到原始尺寸
// console.log(array[1],'aaaabbbb');
node.s3(
array[0].rawS3[0] * single.size[0],
array[0].rawS3[1] * single.size[1],
array[0].rawS3[2] * single.size[2]
);
node.p3(single.pos[0], single.pos[1], single.pos[2]);
node.r3(single.rotate[0], single.rotate[1], single.rotate[2]); // 旋转
// node.posy = single.pos[1];
node.setAnchor3d(
[0.5, 0.5, 0.5]
); // 设置实体的中心点,默认为[0.5, 0.5, 0.5],表示实体正中心
node.setToolTip(`名称: ${single.parentName}`); // 鼠标悬停信息
// node.setStyle('shape3d.color', node.cParentColor); // 填色body.color为混入颜色shape3d.color为设置颜色
// node.setStyle('shape3d.color', this.getColorByParent(node));
// node.setScale3d(5, 5, 5); // 模型放大100倍(x, y, z)
this.dm.add(node); // 把node加载到数据容器
this.models[node.cId] = node;
},
}
})
</script>