-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcss_shaders.html
141 lines (116 loc) · 4.42 KB
/
css_shaders.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html>
<head>
<style>
body{
padding:0px;
margin:0px;
font-family:sans-serif;
font-size:20px;
}
#left_eye {
position:absolute;
top:0px;
left:0px;
width:50%;
height:100%;
background:#900000;
background-image:url(img/grid.jpg);
background-size: 200%, 200%;
background-position:center center;
background-repeat:no-repeat;
}
#right_eye {
position:absolute;
top:0px;
left:50%;
width:50%;
height:100%;
background:#900000;
background-image:url(img/grid.jpg);
background-size:200%, 200%;
background-position:center center;
background-repeat:no-repeat;
}
.oculus_left {
-webkit-filter: custom(
url(css/distort.vs)
mix(url(css/passthrough.fs) normal source-atop),
50 50, lensShift -0.15197649572649574);
}
.oculus_right {
-webkit-filter: custom(
url(css/distort.vs)
mix(url(css/passthrough.fs) normal source-atop),
50 50, lensShift 0.15197649572649574);
}
.centered{
margin-top:40%;
margin-right:25%;
margin-left:25%;
overflow:auto;
width:50%;
height:30%;
}
</style>
</head>
<body>
<div id="left_eye" class="oculus_left">
<div class="centered" id="content_left">
Click anywhere to enable/disable CSS shader.<br><br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas dapibus interdum sapien, et vestibulum orci rutrum vitae. Donec nulla nulla, condimentum eget diam sed, egestas pulvinar massa. In tellus ante, eleifend in ante sit amet, bibendum faucibus lacus. Nunc vel feugiat mauris. In hendrerit rutrum ante, non rhoncus mi luctus nec. Pellentesque risus mi, luctus in urna non, molestie pulvinar metus. Proin condimentum augue at nisi elementum tempor nec vitae ante. Praesent odio odio, hendrerit a magna sit amet, adipiscing semper tortor. Ut mollis eu ligula ut convallis. In et felis a nunc eleifend convallis blandit nec nulla. Quisque semper dolor nec ligula posuere, molestie ultricies orci ultrices. Phasellus et leo a leo malesuada auctor a condimentum ante.
</div>
</div>
<div id="right_eye" class="oculus_right">
<div class="centered" id="content_right">
Click anywhere to enable/disable CSS shader.<br><br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas dapibus interdum sapien, et vestibulum orci rutrum vitae. Donec nulla nulla, condimentum eget diam sed, egestas pulvinar massa. In tellus ante, eleifend in ante sit amet, bibendum faucibus lacus. Nunc vel feugiat mauris. In hendrerit rutrum ante, non rhoncus mi luctus nec. Pellentesque risus mi, luctus in urna non, molestie pulvinar metus. Proin condimentum augue at nisi elementum tempor nec vitae ante. Praesent odio odio, hendrerit a magna sit amet, adipiscing semper tortor. Ut mollis eu ligula ut convallis. In et felis a nunc eleifend convallis blandit nec nulla. Quisque semper dolor nec ligula posuere, molestie ultricies orci ultrices. Phasellus et leo a leo malesuada auctor a condimentum ante.
</div>
</div>
<script src="../web/build/OculusBridge.min.js"></script>
<script>
var oculusBridge;
var filtered = true;
var ignoreScroll = false;
document.body.onload = init;
function bridgeConfigUpdated( config ){
// TODO: hand off config values to CSS shader.
}
function bridgeOrientationUpdated(quatValues) {
// TODO: Do something interesting with the view direction..
}
function init(){
oculusBridge = OculusBridge({
onOrientationUpdate : bridgeOrientationUpdated,
onConfigUpdate : bridgeConfigUpdated,
});
oculusBridge.connect();
document.body.onclick = function() {
if(filtered){
document.getElementById("left_eye").className = "";
document.getElementById("right_eye").className = "";
}else {
document.getElementById("left_eye").className = "oculus_left";
document.getElementById("right_eye").className = "oculus_right";
}
filtered = !filtered;
}
// Silly mechanism to link scroll position of two elements..
document.getElementById("content_left").onscroll = function() {
if(!ignoreScroll){
ignoreScroll = true;
document.getElementById("content_right").scrollTop = document.getElementById("content_left").scrollTop;
ignoreScroll = false;
}
}
document.getElementById("content_right").onscroll = function(){
if(!ignoreScroll){
ignoreScroll = true;
document.getElementById("content_left").scrollTop = document.getElementById("content_right").scrollTop;
ignoreScroll = false;
}
}
}
</script>
</body>
</html>