123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <title>四维展厅</title>
- <style>
- html,
- body {
- width: 100%;
- height: 100%;
- background-color: #000;
- color: #fff;
- margin: 0px;
- padding: 0;
- overflow: hidden;
- }
- </style>
- <link rel="stylesheet" href="https://laser.4dkankan.com/public/css/element.css">
- <link rel="stylesheet" href="https://laser.4dkankan.com/public/css/style.css">
- </head>
- <script type="text/javascript">
- const ossPrefix = 'https://laser.4dkankan.com/data/';
- const ossPrefixDep = 'https://laser.4dkankan.com/public/';
- const sceneNum = '@replace';
- //const sceneNum = 't-vZkqRV8';
- // const sceneNum = 't-iksBApb';
- // const sceneNum = 't-HMGa5zn';
- </script>
- <script src="https://laser.4dkankan.com/public/bus/bus.js"></script>
- <script src="https://laser.4dkankan.com/public/main.js?v=8"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/OBJExporter.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/Animation.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/AnimationHandler.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/KeyFrameAnimation.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/ColladaLoader.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/OBJLoader.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/tinyqueue.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/THREE.MeshLine.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/custom.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/utf.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/jquery-1.8.0.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/jquery.qrcode.js"></script>
- <script type="text/javascript" src="https://laser.4dkankan.com/public/js/proj4.js"></script>
- <script type="text/javascript">
- var indoorViewer;
- var run = false;
- IV.loaded(function() {
- indoorViewer = new IndoorViewer({
- 'base_url': 'https://laser.4dkankan.com/public/',
- 'onLoadComplete': setLayers
- });
- });
- var setLayers = function() {
- if (!run) {
- run = true;
- var setting = new Setting()
- var doorOpenCLose = new DoorOpenCLose();
- main_view.addToScene(doorOpenCLose);
- }
- };
- var DoorOpenCLose = function(e) {
- var main_view = IV.getMainView();
- // var model;
- // var animations;
- // var kfAnimations = [];
- // var kfAnimationsLength = 0;
- // var progress = 0;
- // var lastTimestamp = 0;
- // var pre_select_map_id = -1;
- // let path = './models/mesh/';
- // var mtlLoader = new IV.THREE.MTLLoader()
- // .setPath( path )
- // .load('mesh.mtl', function ( materials ) {
- // console.log(materials)
- // materials.preload();
- // // 加载obj
- // new IV.THREE.OBJLoader()
- // .setMaterials( materials )
- // .setPath( path )
- // .load('mesh.obj', function ( object ) {
- // // console.log(object)
- // // 设置旋转中心点
- // //object.children[0].geometry.computeBoundingBox();
- // //object.children[0].geometry.center()
- // object.position.x = 0;
- // object.position.y = 0;
- // object.position.z = 0;
- // // 将模型加入到场景
- // scene.add( object );
- // }, onProgress, onError );
- // });
- // OBJLoader_plugin();
- // var loader = new IV.THREE.OBJLoader();
- // loader.load('./models/mesh/mesh.obj', function (object) {
- // //controller = object.children[0];
- // var texture_loader = new IV.THREE.TextureLoader();
- // var material = new IV.THREE.MeshBasicMaterial();
- // main_view.scene.add(object);
- // });
- }
- /*
- if (!IV.custom) { //自定义功能集合
- IV.custom = {};
- }
- var loader_wall = new IV.THREE.ColladaLoader();
- loader_wall.load('./models/qt.dae', function(collada) {
- model = collada.scene.children[2];
- var material = new IV.THREE.MeshBasicMaterial({
- color: 0x00FA9A
- });
- material.colorWrite = false;
- model.children[0].material = material;
- model.renderOrder = 2;
- model.children[0].renderOrder = 2;
- main_view.overlayScene.add(model);
- //mesh.material.colorWrite = false;
- });
- var loader = new IV.THREE.ColladaLoader();
- */
- // loader.load('./models/m4.dae', function (collada) {
- // //console.log(collada)
- // model = collada.scene;
- // model.renderOrder = 3;
- // for (var j = 0; j < model.children.length; ++j) {
- // model.children[j].renderOrder = 3;
- // }
- // animations = collada.animations;
- // kfAnimationsLength = animations.length;
- // model.scale.x = model.scale.y = model.scale.z = 1;
- // main_view.scene.add(model);
- // //main_view.overlayScene.add(model);
- // //map_scene.add(model)
- // for (var i = 0; i < kfAnimationsLength; ++i) {
- // var animation = animations[i];
- // var kfAnimation = new IV.THREE.KeyFrameAnimation(animation);
- // kfAnimation.timeScale = 1;
- // kfAnimations.push(kfAnimation);
- // }
- // door_animation_start(0);
- // animate(lastTimestamp);
- // });
- function door_animation_start(time) {
- for (var i = 0; i < kfAnimationsLength; ++i) {
- var animation = kfAnimations[i];
- // if (animation.root.name === "animation_door1") {
- // console.log(animation.root.name)
- for (var h = 0, hl = animation.hierarchy.length; h < hl; h++) {
- var keys = animation.data.hierarchy[h].keys;
- var sids = animation.data.hierarchy[h].sids;
- var obj = animation.hierarchy[h];
- if (keys.length && sids) {
- for (var s = 0; s < sids.length; s++) {
- var sid = sids[s];
- var next = animation.getNextKeyWith(sid, h, 0);
- if (next) next.apply(sid);
- }
- obj.matrixAutoUpdate = false;
- animation.data.hierarchy[h].node.updateMatrix();
- obj.matrixWorldNeedsUpdate = true;
- }
- }
- // }
- animation.loop = false;
- animation.play(time);
- }
- }
- function animate(timestamp) {
- var frameTime = (timestamp - lastTimestamp) * 0.001;
- if (IV.custom.select_map_id && (pre_select_map_id !== IV.custom.select_map_id)) {
- pre_select_map_id = IV.custom.select_map_id;
- for (var i = 0; i < kfAnimationsLength; ++i) {
- kfAnimations[i].stop();
- }
- if (IV.custom.select_map_id === 2) {
- progress = 0;
- door_animation_start(6);
- } else if (IV.custom.select_map_id === 3) {
- progress = 0;
- door_animation_start(0);
- }
- }
- //console.log(progress,max_progress,start,end)
- if (progress >= 0 && progress < 6) {
- for (var i = 0; i < kfAnimationsLength; ++i) {
- //if (kfAnimations[i].root.name === "door1") {
- kfAnimations[i].update(frameTime);
- //}
- }
- } else if (progress >= 6) {
- for (var i = 0; i < kfAnimationsLength; ++i) {
- kfAnimations[i].stop();
- }
- // progress = 0;
- // door_animation_start();
- }
- main_view.invalidateScene();
- progress += frameTime;
- lastTimestamp = timestamp;
- requestAnimationFrame(animate);
- }
- </script>
- <script src="./js/index.js"></script>
- <body>
- <indoorviewer style="height: 100%"></indoorviewer>
- <div id="curscroll" style="position:absolute;visibility:hidden;padding: 2px 10px;z-index:2000"></div>
- </body>
- </html>
|