-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmouse_event_example.html
85 lines (77 loc) · 2.73 KB
/
mouse_event_example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
<head>
<title>vr sphere example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<script src="../build/three.js"></script>
<script src="../build/mxreality.js"></script>
<script src="./js/avr.utils.js"></script>
<style type="text/css">
</style>
</head>
<body>
<div id="example"></div>
<script>
window.onload=function () {
init();
}
function init() {
var vr = new VR({ 'id': 'example', onload: function () { } });
vr.vrbox.radius=50;
if(!AVR.isCrossScreen()) {
vr.useGyroscope = false;
}
vr.loadProgressManager.onLoad=function () {
//vr.controls.enable=false;
}
vr.loadProgressManager.onProgress=function () {
console.log("onProgress")
}
vr.loadProgressManager.onError=function () {
console.log("onError")
}
vr.init(function () {
});
vr.play('textures/puydesancy.jpg');
var util=new VRUtils(vr);
vr.container.addEventListener("mousemove",function (e) {
util.bindRaycaster(e,{
success:function (obj) {
if(obj[0].object.name=="btn1") {
document.body.style.cursor = "pointer";
}else if( obj[0].object.name=="btn2"){
document.body.style.cursor="move";
}else{
document.body.style.cursor="auto";
}
},
empty:function () {
document.body.style.cursor="auto";
}
})
},false)
util.markIcon("textures/forward.png", new THREE.Vector3(0,0,10), 'btn1','title1', 1,1);
util.markIcon("textures/left.png", new THREE.Vector3(10,0,10), 'btn2','title2',1,1);
animate();
function animate() {
requestAnimationFrame(animate);
if(AVR.isCrossScreen()) {
cameraEvent.updatePosition();
}else{
util.markIconInViews();
if(vr.markIconGroup) {
for (var i = 0; i < vr.markIconGroup.children.length; i++) {
vr.markIconGroup.children[i].lookAt(vr.vr.camera.position);
}
}
}
}
}
</script>
</body>
</html>