|
@@ -22,7 +22,7 @@
|
|
|
<script type="text/javascript">
|
|
|
const ossPrefix = 'https://laser.4dkankan.com/data/';
|
|
|
const ossPrefixDep = 'https://laser.4dkankan.com/public/';
|
|
|
- const sceneNum = '@replace';
|
|
|
+ const sceneNum = 't-iksBApb';
|
|
|
</script>
|
|
|
<script src="IndoorViewerAPI.js"></script>
|
|
|
<script type="text/javascript" src="js/OBJExporter.js"></script>
|
|
@@ -58,52 +58,52 @@
|
|
|
}
|
|
|
};
|
|
|
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);
|
|
|
- // });
|
|
|
- }
|
|
|
+ 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 = {};
|
|
@@ -137,84 +137,83 @@
|
|
|
// 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;
|
|
|
+ // 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);
|
|
|
}
|
|
|
+ // }
|
|
|
+ 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);
|
|
|
- }
|
|
|
+ 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);
|
|
|
+ //}
|
|
|
}
|
|
|
- //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();
|
|
|
+ } else if (progress >= 6) {
|
|
|
+ for (var i = 0; i < kfAnimationsLength; ++i) {
|
|
|
+ kfAnimations[i].stop();
|
|
|
}
|
|
|
- main_view.invalidateScene();
|
|
|
- progress += frameTime;
|
|
|
- lastTimestamp = timestamp;
|
|
|
- requestAnimationFrame(animate);
|
|
|
+ // progress = 0;
|
|
|
+ // door_animation_start();
|
|
|
}
|
|
|
-
|
|
|
+ main_view.invalidateScene();
|
|
|
+ progress += frameTime;
|
|
|
+ lastTimestamp = timestamp;
|
|
|
+ requestAnimationFrame(animate);
|
|
|
+ }
|
|
|
</script>
|
|
|
<script src="./js/index.js"></script>
|
|
|
|