32 |
33 |
101 |
102 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/example/css/primer.css:
--------------------------------------------------------------------------------
1 | .control{
2 | position: fixed;
3 | width: 300px;
4 | height:100px;
5 | bottom:30px;
6 | left:20px;
7 | }
8 |
9 | .control img{
10 | width: 60px;
11 | height:60px;
12 | opacity: 0.5;
13 | position: fixed;
14 | /*box-shadow:0 0 3px 1px rgba(0,198,255,0.7);*/
15 | }
16 |
17 | .control img:hover{
18 | opacity: 1;
19 | }
20 |
21 | .control #toleft{
22 | bottom: 25px;
23 | left: 20px;
24 | }
25 |
26 | .control #toahead{
27 | bottom: 95px;
28 | left:90px;
29 | }
30 |
31 | .control #tobackward{
32 | bottom: 25px;
33 | left: 90px;
34 | }
35 |
36 | .control #toright{
37 | bottom: 25px;
38 | left: 160px;
39 | }
40 |
41 |
42 |
43 | .goods{
44 | position: fixed;
45 | right:20px;
46 | bottom: 250px;
47 | width: 180px;
48 | }
49 |
50 | .goods .certain_good{
51 | float: right;
52 | background-color: rgba(0,0,33,0.1);
53 | width: 100px;
54 | height:100px;
55 | border-radius: 10px;
56 | box-shadow:0 0 5px 1px rgba(0,198,255,0.7);
57 | margin-bottom: 10px;
58 | /*box-shadow: 1px 1px 1px 2px rgba(255,255,255,0.3);*/
59 | /*outline:1px solid rgba(255,255,255,0.9);*/
60 | }
61 |
62 | .goods .certain_good:hover,.anouncement:hover{
63 | background-color: rgba(0,0,33,0.2);
64 | margin-bottom: 10px;
65 | }
66 |
67 | .certain_good img{
68 | width: 80px;
69 | height: 80px;
70 | margin: 10px;
71 | }
72 |
73 | .anouncement{
74 | position: fixed;
75 | right:20px;
76 | bottom: 30px;
77 | width: 400px;
78 | height:200px;
79 | box-shadow:0 0 5px 1px rgba(0,198,255,0.7);
80 | background-color: rgba(0,0,33,0.1);
81 | }
82 |
83 | .anounc_title{
84 | margin:5px 15px 10px ;
85 | color:#21b4ba
86 | }
87 | .anounc_content{
88 | margin: 5px 15px 10px ;
89 | height: 160px;
90 | color:rgba(255,255,255,0.8);
91 | }
92 |
93 | .anounc_title span{
94 | margin: 5px;
95 | font-size: 15px;
96 | position: relative;
97 | top:2px;
98 | }
99 |
100 | .modal{
101 | padding-top: 300px;
102 | }
103 |
104 | .modal-content{
105 | background-color: rgba(255,255,255,0);
106 | }
107 |
108 | .modal-title{
109 | color:rgba(255,255,255,0.7);
110 | border-bottom:none;
111 | text-align: center;
112 | }
113 | .modal-header{
114 | border-bottom:none;
115 | }
116 |
117 | .codeInput{
118 | border-color:#21b4ba;
119 | color:#21b4ba;
120 | border-width:3px;
121 | width: 30px;
122 | height: 30px;
123 | font-size: 20px;
124 | font-weight: 700;
125 | padding: 2px;
126 | text-align: center;
127 | margin-right: 10px;
128 | outline: none;
129 | background-color: rgba(0,0,0,0);
130 | }
131 |
132 | .codeInputGroup{
133 | width:200px;
134 | display: block;
135 | margin-left: auto;
136 | }
137 |
138 | .wrongPass{
139 | color:rgba(255,0,0,0.8);
140 | font-size: 16px;
141 | margin-top: 10px;
142 | margin-left: 20px;
143 | }
144 |
145 | .modal-content2{
146 | height: 400px;
147 | width: 700px;
148 | }
149 |
150 | .modal-content2 img{
151 | /*width: 120px;*/
152 | /*height: 120px;*/
153 | }
154 |
155 | .rightPass{
156 | color:rgba(21,255,250,0.8);
157 | font-size: 16px;
158 | margin-top: 10px;
159 | margin-left: -26px;
160 | }
161 |
162 | .modal-code{
163 | position: relative;
164 | }
165 |
166 | #modal-code1{ top:90px;left: 0;}
167 | #modal-code2{ top:0;left:0;}
168 | #modal-code3{ top:0;left:90px; }
169 | #modal-code4{ top:90px;left:90px; }
--------------------------------------------------------------------------------
/example/images/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/.DS_Store
--------------------------------------------------------------------------------
/example/images/ahead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/ahead.png
--------------------------------------------------------------------------------
/example/images/backward.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/backward.png
--------------------------------------------------------------------------------
/example/images/box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/box.png
--------------------------------------------------------------------------------
/example/images/code1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/code1.png
--------------------------------------------------------------------------------
/example/images/code2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/code2.png
--------------------------------------------------------------------------------
/example/images/code3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/code3.png
--------------------------------------------------------------------------------
/example/images/code4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/code4.png
--------------------------------------------------------------------------------
/example/images/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/left.png
--------------------------------------------------------------------------------
/example/images/leftmaster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/leftmaster.png
--------------------------------------------------------------------------------
/example/images/mouse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/mouse.png
--------------------------------------------------------------------------------
/example/images/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/right.png
--------------------------------------------------------------------------------
/example/images/rightmaster.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/images/rightmaster.png
--------------------------------------------------------------------------------
/example/library/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/library/.DS_Store
--------------------------------------------------------------------------------
/example/library/bootstrap/css/bootstrap-theme.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.3.0 (http://getbootstrap.com)
3 | * Copyright 2011-2014 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */
6 |
7 | .btn-default,
8 | .btn-primary,
9 | .btn-success,
10 | .btn-info,
11 | .btn-warning,
12 | .btn-danger {
13 | text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
14 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
15 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
16 | }
17 | .btn-default:active,
18 | .btn-primary:active,
19 | .btn-success:active,
20 | .btn-info:active,
21 | .btn-warning:active,
22 | .btn-danger:active,
23 | .btn-default.active,
24 | .btn-primary.active,
25 | .btn-success.active,
26 | .btn-info.active,
27 | .btn-warning.active,
28 | .btn-danger.active {
29 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
30 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
31 | }
32 | .btn-default .badge,
33 | .btn-primary .badge,
34 | .btn-success .badge,
35 | .btn-info .badge,
36 | .btn-warning .badge,
37 | .btn-danger .badge {
38 | text-shadow: none;
39 | }
40 | .btn:active,
41 | .btn.active {
42 | background-image: none;
43 | }
44 | .btn-default {
45 | text-shadow: 0 1px 0 #fff;
46 | background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
47 | background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
48 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
49 | background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
50 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
51 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
52 | background-repeat: repeat-x;
53 | border-color: #dbdbdb;
54 | border-color: #ccc;
55 | }
56 | .btn-default:hover,
57 | .btn-default:focus {
58 | background-color: #e0e0e0;
59 | background-position: 0 -15px;
60 | }
61 | .btn-default:active,
62 | .btn-default.active {
63 | background-color: #e0e0e0;
64 | border-color: #dbdbdb;
65 | }
66 | .btn-default:disabled,
67 | .btn-default[disabled] {
68 | background-color: #e0e0e0;
69 | background-image: none;
70 | }
71 | .btn-primary {
72 | background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%);
73 | background-image: -o-linear-gradient(top, #428bca 0%, #2d6ca2 100%);
74 | background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#2d6ca2));
75 | background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%);
76 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);
77 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
78 | background-repeat: repeat-x;
79 | border-color: #2b669a;
80 | }
81 | .btn-primary:hover,
82 | .btn-primary:focus {
83 | background-color: #2d6ca2;
84 | background-position: 0 -15px;
85 | }
86 | .btn-primary:active,
87 | .btn-primary.active {
88 | background-color: #2d6ca2;
89 | border-color: #2b669a;
90 | }
91 | .btn-primary:disabled,
92 | .btn-primary[disabled] {
93 | background-color: #2d6ca2;
94 | background-image: none;
95 | }
96 | .btn-success {
97 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
98 | background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
99 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
100 | background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
101 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
102 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
103 | background-repeat: repeat-x;
104 | border-color: #3e8f3e;
105 | }
106 | .btn-success:hover,
107 | .btn-success:focus {
108 | background-color: #419641;
109 | background-position: 0 -15px;
110 | }
111 | .btn-success:active,
112 | .btn-success.active {
113 | background-color: #419641;
114 | border-color: #3e8f3e;
115 | }
116 | .btn-success:disabled,
117 | .btn-success[disabled] {
118 | background-color: #419641;
119 | background-image: none;
120 | }
121 | .btn-info {
122 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
123 | background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
124 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
125 | background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
126 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
127 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
128 | background-repeat: repeat-x;
129 | border-color: #28a4c9;
130 | }
131 | .btn-info:hover,
132 | .btn-info:focus {
133 | background-color: #2aabd2;
134 | background-position: 0 -15px;
135 | }
136 | .btn-info:active,
137 | .btn-info.active {
138 | background-color: #2aabd2;
139 | border-color: #28a4c9;
140 | }
141 | .btn-info:disabled,
142 | .btn-info[disabled] {
143 | background-color: #2aabd2;
144 | background-image: none;
145 | }
146 | .btn-warning {
147 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
148 | background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
149 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
150 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
151 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
152 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
153 | background-repeat: repeat-x;
154 | border-color: #e38d13;
155 | }
156 | .btn-warning:hover,
157 | .btn-warning:focus {
158 | background-color: #eb9316;
159 | background-position: 0 -15px;
160 | }
161 | .btn-warning:active,
162 | .btn-warning.active {
163 | background-color: #eb9316;
164 | border-color: #e38d13;
165 | }
166 | .btn-warning:disabled,
167 | .btn-warning[disabled] {
168 | background-color: #eb9316;
169 | background-image: none;
170 | }
171 | .btn-danger {
172 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
173 | background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
174 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
175 | background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
176 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
177 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
178 | background-repeat: repeat-x;
179 | border-color: #b92c28;
180 | }
181 | .btn-danger:hover,
182 | .btn-danger:focus {
183 | background-color: #c12e2a;
184 | background-position: 0 -15px;
185 | }
186 | .btn-danger:active,
187 | .btn-danger.active {
188 | background-color: #c12e2a;
189 | border-color: #b92c28;
190 | }
191 | .btn-danger:disabled,
192 | .btn-danger[disabled] {
193 | background-color: #c12e2a;
194 | background-image: none;
195 | }
196 | .thumbnail,
197 | .img-thumbnail {
198 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
199 | box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
200 | }
201 | .dropdown-menu > li > a:hover,
202 | .dropdown-menu > li > a:focus {
203 | background-color: #e8e8e8;
204 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
205 | background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
206 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
207 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
208 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
209 | background-repeat: repeat-x;
210 | }
211 | .dropdown-menu > .active > a,
212 | .dropdown-menu > .active > a:hover,
213 | .dropdown-menu > .active > a:focus {
214 | background-color: #357ebd;
215 | background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
216 | background-image: -o-linear-gradient(top, #428bca 0%, #357ebd 100%);
217 | background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#357ebd));
218 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
219 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
220 | background-repeat: repeat-x;
221 | }
222 | .navbar-default {
223 | background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
224 | background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
225 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
226 | background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
227 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
228 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
229 | background-repeat: repeat-x;
230 | border-radius: 4px;
231 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
232 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
233 | }
234 | .navbar-default .navbar-nav > .open > a,
235 | .navbar-default .navbar-nav > .active > a {
236 | background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
237 | background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
238 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
239 | background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
240 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
241 | background-repeat: repeat-x;
242 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
243 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
244 | }
245 | .navbar-brand,
246 | .navbar-nav > li > a {
247 | text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
248 | }
249 | .navbar-inverse {
250 | background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
251 | background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
252 | background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
253 | background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
254 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
255 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
256 | background-repeat: repeat-x;
257 | }
258 | .navbar-inverse .navbar-nav > .open > a,
259 | .navbar-inverse .navbar-nav > .active > a {
260 | background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
261 | background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
262 | background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
263 | background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
264 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
265 | background-repeat: repeat-x;
266 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
267 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
268 | }
269 | .navbar-inverse .navbar-brand,
270 | .navbar-inverse .navbar-nav > li > a {
271 | text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
272 | }
273 | .navbar-static-top,
274 | .navbar-fixed-top,
275 | .navbar-fixed-bottom {
276 | border-radius: 0;
277 | }
278 | .alert {
279 | text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
280 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
281 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
282 | }
283 | .alert-success {
284 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
285 | background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
286 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
287 | background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
288 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
289 | background-repeat: repeat-x;
290 | border-color: #b2dba1;
291 | }
292 | .alert-info {
293 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
294 | background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
295 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
296 | background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
297 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
298 | background-repeat: repeat-x;
299 | border-color: #9acfea;
300 | }
301 | .alert-warning {
302 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
303 | background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
304 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
305 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
306 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
307 | background-repeat: repeat-x;
308 | border-color: #f5e79e;
309 | }
310 | .alert-danger {
311 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
312 | background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
313 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
314 | background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
315 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
316 | background-repeat: repeat-x;
317 | border-color: #dca7a7;
318 | }
319 | .progress {
320 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
321 | background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
322 | background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
323 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
324 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
325 | background-repeat: repeat-x;
326 | }
327 | .progress-bar {
328 | background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%);
329 | background-image: -o-linear-gradient(top, #428bca 0%, #3071a9 100%);
330 | background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#3071a9));
331 | background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);
332 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);
333 | background-repeat: repeat-x;
334 | }
335 | .progress-bar-success {
336 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
337 | background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
338 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
339 | background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
340 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
341 | background-repeat: repeat-x;
342 | }
343 | .progress-bar-info {
344 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
345 | background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
346 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
347 | background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
348 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
349 | background-repeat: repeat-x;
350 | }
351 | .progress-bar-warning {
352 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
353 | background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
354 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
355 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
356 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
357 | background-repeat: repeat-x;
358 | }
359 | .progress-bar-danger {
360 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
361 | background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
362 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
363 | background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
364 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
365 | background-repeat: repeat-x;
366 | }
367 | .progress-bar-striped {
368 | background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
369 | background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
370 | background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
371 | }
372 | .list-group {
373 | border-radius: 4px;
374 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
375 | box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
376 | }
377 | .list-group-item.active,
378 | .list-group-item.active:hover,
379 | .list-group-item.active:focus {
380 | text-shadow: 0 -1px 0 #3071a9;
381 | background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%);
382 | background-image: -o-linear-gradient(top, #428bca 0%, #3278b3 100%);
383 | background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#3278b3));
384 | background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);
385 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);
386 | background-repeat: repeat-x;
387 | border-color: #3278b3;
388 | }
389 | .list-group-item.active .badge,
390 | .list-group-item.active:hover .badge,
391 | .list-group-item.active:focus .badge {
392 | text-shadow: none;
393 | }
394 | .panel {
395 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
396 | box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
397 | }
398 | .panel-default > .panel-heading {
399 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
400 | background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
401 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
402 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
403 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
404 | background-repeat: repeat-x;
405 | }
406 | .panel-primary > .panel-heading {
407 | background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);
408 | background-image: -o-linear-gradient(top, #428bca 0%, #357ebd 100%);
409 | background-image: -webkit-gradient(linear, left top, left bottom, from(#428bca), to(#357ebd));
410 | background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
411 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);
412 | background-repeat: repeat-x;
413 | }
414 | .panel-success > .panel-heading {
415 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
416 | background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
417 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
418 | background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
419 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
420 | background-repeat: repeat-x;
421 | }
422 | .panel-info > .panel-heading {
423 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
424 | background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
425 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
426 | background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
427 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
428 | background-repeat: repeat-x;
429 | }
430 | .panel-warning > .panel-heading {
431 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
432 | background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
433 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
434 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
435 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
436 | background-repeat: repeat-x;
437 | }
438 | .panel-danger > .panel-heading {
439 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
440 | background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
441 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
442 | background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
443 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
444 | background-repeat: repeat-x;
445 | }
446 | .well {
447 | background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
448 | background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
449 | background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
450 | background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
451 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
452 | background-repeat: repeat-x;
453 | border-color: #dcdcdc;
454 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
455 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
456 | }
457 | /*# sourceMappingURL=bootstrap-theme.css.map */
458 |
--------------------------------------------------------------------------------
/example/library/bootstrap/css/bootstrap-theme.min.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.3.0 (http://getbootstrap.com)
3 | * Copyright 2011-2014 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */.btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-default .badge,.btn-primary .badge,.btn-success .badge,.btn-info .badge,.btn-warning .badge,.btn-danger .badge{text-shadow:none}.btn:active,.btn.active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default:disabled,.btn-default[disabled]{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:-o-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#2d6ca2));background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#2b669a}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-primary:disabled,.btn-primary[disabled]{background-color:#2d6ca2;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-success:disabled,.btn-success[disabled]{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.btn-info:disabled,.btn-info[disabled]{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-warning:disabled,.btn-warning[disabled]{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.btn-danger:disabled,.btn-danger[disabled]{background-color:#c12e2a;background-image:none}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-color:#357ebd;background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-o-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#357ebd));background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:-o-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#3071a9));background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:-o-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#3278b3));background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);background-repeat:repeat-x;border-color:#3278b3}.list-group-item.active .badge,.list-group-item.active:hover .badge,.list-group-item.active:focus .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-o-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#357ebd));background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
--------------------------------------------------------------------------------
/example/library/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/library/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/example/library/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/library/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/example/library/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/library/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/example/library/bootstrap/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/example/library/bootstrap/js/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 2,
3 | "icons": { "16": "icon16.png",
4 | "48": "icon48.png",
5 | "128": "icon128.png" },
6 | "name":"myCollec",
7 | "version":"0.1.0",
8 | "description":"a collection application",
9 | "browser_action": {
10 | "default_icon": "icon.png",
11 | "default_title": "myCollec",
12 | "default_popup": "index.html"
13 | },
14 | "permissions":["tabs"]
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/example/models/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/models/.DS_Store
--------------------------------------------------------------------------------
/example/models/051.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: ''
2 | # Material Count: 2
3 | newmtl mtl0511
4 | Ka 0.000000 0.000000 0.000000
5 | Kd 0.93 0.6235 0.3529
6 | Ks 0.000000 0.000000 0.000000
7 | Ns 96.078431
8 | Ni 1.000000
9 | d 1.000000
10 | illum 0
11 | newmtl mtl0512
12 | Ka 0.000000 0.000000 0.000000
13 | Kd 0.993333 0.996000 0.994117
14 | Ks 0.000000 0.000000 0.000000
15 | Ns 96.078431
16 | Ni 1.000000
17 | d 1.000000
18 | illum 0
19 | newmtl light1
20 | Ka 0.000000 0.000000 0.000000
21 | Kd 0.733333 0.596000 0.494117
22 | Ks 0.000000 0.000000 0.000000
23 | Ns 96.078431
24 | Ni 1.000000
25 | d 1.000000
26 | illum 0
--------------------------------------------------------------------------------
/example/models/052.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: ''
2 | # Material Count: 2
3 | newmtl mtl0521
4 | Ka 0.000000 0.000000 0.000000
5 | Kd 0.93 0.6235 0.3529
6 | Ks 0.000000 0.000000 0.000000
7 | Ns 96.078431
8 | Ni 1.000000
9 | d 1.000000
10 | illum 0
11 | newmtl mtl0522
12 | Ka 0.000000 0.000000 0.000000
13 | Kd 0.993333 0.996000 0.994117
14 | Ks 0.000000 0.000000 0.000000
15 | Ns 96.078431
16 | Ni 1.000000
17 | d 1.000000
18 | illum 0
19 | newmtl light1
20 | Ka 0.000000 0.000000 0.000000
21 | Kd 0.733333 0.596000 0.494117
22 | Ks 0.000000 0.000000 0.000000
23 | Ns 96.078431
24 | Ni 1.000000
25 | d 1.000000
26 | illum 0
--------------------------------------------------------------------------------
/example/models/10.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
2 | # File Created: 14.02.2014 19:42:21
3 |
4 | newmtl wire_032032032
5 | Ns 32
6 | d 1
7 | Tr 0
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.1255 0.1255 0.1255
11 | Kd 0.1255 0.1255 0.1255
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/example/models/12.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
2 | # File Created: 14.02.2014 19:47:05
3 |
4 | newmtl wire_032032032
5 | Ns 32
6 | d 1
7 | Tr 0
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.1255 0.1255 0.1255
11 | Kd 0.1255 0.1255 0.1255
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/example/models/box1.obj:
--------------------------------------------------------------------------------
1 | mtllib cube.mtl
2 | g SciFi_Prop_25_27
3 |
4 | #begin 82 vertices
5 | v 100.150666 33.595274 -67.114794
6 | v 100.150666 33.449720 -67.156380
7 | v 100.150666 33.411980 -67.024290
8 | v 100.150666 33.557534 -66.982703
9 | v 100.131222 33.402729 -66.991912
10 | v 100.111781 33.401297 -66.986901
11 | v 100.111781 33.546851 -66.945314
12 | v 100.131222 33.548283 -66.950325
13 | v 100.145455 33.552192 -66.964009
14 | v 100.145455 33.406639 -67.005596
15 | v 100.150666 33.557534 -66.982703
16 | v 100.150666 33.411980 -67.024290
17 | v 100.111781 33.546851 -66.945314
18 | v 100.111781 33.401297 -66.986901
19 | v 99.743446 33.401297 -66.986901
20 | v 99.743446 33.546851 -66.945314
21 | v 99.709772 33.406639 -67.005596
22 | v 99.704561 33.411980 -67.024290
23 | v 99.704561 33.557534 -66.982703
24 | v 99.709772 33.552193 -66.964009
25 | v 99.724004 33.548283 -66.950324
26 | v 99.724004 33.402729 -66.991911
27 | v 99.743446 33.546851 -66.945314
28 | v 99.743446 33.401297 -66.986901
29 | v 99.704561 33.557534 -66.982703
30 | v 99.704561 33.411980 -67.024290
31 | v 99.704561 33.449720 -67.156380
32 | v 99.704561 33.595274 -67.114794
33 | v 99.724004 33.458971 -67.188758
34 | v 99.743446 33.460403 -67.193769
35 | v 99.743446 33.605956 -67.152183
36 | v 99.724004 33.604525 -67.147172
37 | v 99.709771 33.600615 -67.133488
38 | v 99.709771 33.455061 -67.175074
39 | v 99.704561 33.595274 -67.114794
40 | v 99.704561 33.449720 -67.156380
41 | v 99.743446 33.605956 -67.152183
42 | v 99.743446 33.460403 -67.193769
43 | v 100.111781 33.460403 -67.193769
44 | v 100.111781 33.605956 -67.152183
45 | v 99.704561 33.595274 -67.114794
46 | v 99.704561 33.557534 -66.982703
47 | v 99.743446 33.546851 -66.945314
48 | v 100.111781 33.546851 -66.945314
49 | v 100.150666 33.557534 -66.982703
50 | v 100.150666 33.595274 -67.114794
51 | v 100.111781 33.605956 -67.152183
52 | v 99.743446 33.605956 -67.152183
53 | v 99.709772 33.552193 -66.964009
54 | v 99.724004 33.548283 -66.950324
55 | v 100.131222 33.548283 -66.950325
56 | v 100.145455 33.552192 -66.964009
57 | v 100.145454 33.600615 -67.133487
58 | v 100.131222 33.604525 -67.147172
59 | v 99.724004 33.604525 -67.147172
60 | v 99.709771 33.600615 -67.133488
61 | v 99.927613 33.576404 -67.048748
62 | v 100.145454 33.455061 -67.175074
63 | v 100.150666 33.449720 -67.156380
64 | v 100.150666 33.595274 -67.114794
65 | v 100.145454 33.600615 -67.133487
66 | v 100.131222 33.604525 -67.147172
67 | v 100.131222 33.458971 -67.188759
68 | v 100.111781 33.605956 -67.152183
69 | v 100.111781 33.460403 -67.193769
70 | v 99.704561 33.449720 -67.156380
71 | v 99.704561 33.411980 -67.024290
72 | v 99.743446 33.401297 -66.986901
73 | v 100.111781 33.401297 -66.986901
74 | v 100.150666 33.411980 -67.024290
75 | v 100.150666 33.449720 -67.156380
76 | v 100.111781 33.460403 -67.193769
77 | v 99.743446 33.460403 -67.193769
78 | v 100.131222 33.458971 -67.188759
79 | v 100.145454 33.455061 -67.175074
80 | v 100.145455 33.406639 -67.005596
81 | v 100.131222 33.402729 -66.991912
82 | v 99.724004 33.402729 -66.991911
83 | v 99.709772 33.406639 -67.005596
84 | v 99.709771 33.455061 -67.175074
85 | v 99.724004 33.458971 -67.188758
86 | v 99.927613 33.430850 -67.090335
87 | #end 82 vertices
88 |
89 | #begin 160 normals
90 | vn 1.000000 0.000000 0.000000
91 | vn 1.000000 0.000000 0.000000
92 | vn 1.000000 0.000000 0.000000
93 | vn 1.000000 0.000000 0.000000
94 | vn 0.500030 -0.237911 0.832687
95 | vn 0.258922 -0.265353 0.928734
96 | vn 0.258922 -0.265353 0.928734
97 | vn 0.500030 -0.237911 0.832687
98 | vn 0.500030 -0.237911 0.832687
99 | vn 0.865999 -0.137373 0.480806
100 | vn 0.865999 -0.137373 0.480806
101 | vn 0.500030 -0.237911 0.832687
102 | vn 0.865999 -0.137373 0.480806
103 | vn 0.965908 -0.071122 0.248925
104 | vn 0.965908 -0.071122 0.248925
105 | vn 0.865999 -0.137373 0.480806
106 | vn 0.000000 -0.274721 0.961524
107 | vn 0.000000 -0.274721 0.961524
108 | vn 0.000000 -0.274721 0.961524
109 | vn 0.000000 -0.274721 0.961524
110 | vn -0.866008 -0.137369 0.480791
111 | vn -0.965898 -0.071131 0.248959
112 | vn -0.965898 -0.071131 0.248959
113 | vn -0.866008 -0.137369 0.480791
114 | vn -0.866008 -0.137369 0.480791
115 | vn -0.500046 -0.237908 0.832679
116 | vn -0.500046 -0.237908 0.832679
117 | vn -0.866008 -0.137369 0.480791
118 | vn -0.500046 -0.237908 0.832679
119 | vn -0.258886 -0.265355 0.928744
120 | vn -0.258886 -0.265355 0.928744
121 | vn -0.500046 -0.237908 0.832679
122 | vn -1.000000 0.000000 0.000000
123 | vn -1.000000 0.000000 0.000000
124 | vn -1.000000 0.000000 0.000000
125 | vn -1.000000 0.000000 0.000000
126 | vn -0.500030 0.237911 -0.832687
127 | vn -0.258922 0.265353 -0.928734
128 | vn -0.258922 0.265353 -0.928734
129 | vn -0.500030 0.237911 -0.832687
130 | vn -0.500030 0.237911 -0.832687
131 | vn -0.865999 0.137373 -0.480806
132 | vn -0.865999 0.137373 -0.480806
133 | vn -0.500030 0.237911 -0.832687
134 | vn -0.865999 0.137373 -0.480806
135 | vn -0.965908 0.071122 -0.248925
136 | vn -0.965908 0.071122 -0.248925
137 | vn -0.865999 0.137373 -0.480806
138 | vn 0.000000 0.274721 -0.961524
139 | vn 0.000000 0.274721 -0.961524
140 | vn 0.000000 0.274721 -0.961524
141 | vn 0.000000 0.274721 -0.961524
142 | vn -0.000000 0.961524 0.274721
143 | vn 0.000000 0.961524 0.274721
144 | vn 0.000000 0.961524 0.274721
145 | vn 0.000000 0.961524 0.274721
146 | vn -0.000000 0.961524 0.274721
147 | vn 0.000000 0.961524 0.274721
148 | vn 0.000000 0.961524 0.274721
149 | vn 0.000000 0.961524 0.274721
150 | vn 0.000000 0.961524 0.274721
151 | vn 0.000000 0.961524 0.274721
152 | vn 0.000000 0.961524 0.274721
153 | vn 0.000000 0.961524 0.274721
154 | vn 0.000000 0.961524 0.274721
155 | vn 0.000000 0.961524 0.274721
156 | vn 0.000000 0.961524 0.274721
157 | vn -0.000000 0.961524 0.274721
158 | vn 0.000000 0.961524 0.274721
159 | vn 0.000000 0.961524 0.274721
160 | vn -0.000000 0.961524 0.274721
161 | vn -0.000000 0.961524 0.274721
162 | vn 0.000000 0.961524 0.274721
163 | vn -0.000000 0.961524 0.274721
164 | vn -0.000000 0.961524 0.274721
165 | vn 0.000000 0.961524 0.274721
166 | vn -0.000000 0.961524 0.274721
167 | vn -0.000000 0.961524 0.274721
168 | vn 0.000000 0.961524 0.274721
169 | vn -0.000000 0.961524 0.274721
170 | vn -0.000000 0.961524 0.274721
171 | vn 0.000000 0.961524 0.274721
172 | vn -0.000000 0.961524 0.274721
173 | vn -0.000000 0.961524 0.274721
174 | vn 0.000000 0.961524 0.274721
175 | vn -0.000000 0.961524 0.274721
176 | vn -0.000000 0.961524 0.274721
177 | vn 0.000000 0.961524 0.274721
178 | vn -0.000000 0.961524 0.274721
179 | vn -0.000000 0.961524 0.274721
180 | vn 0.000000 0.961524 0.274721
181 | vn 0.000000 0.961524 0.274721
182 | vn -0.000000 0.961524 0.274721
183 | vn 0.000000 0.961524 0.274721
184 | vn 0.000000 0.961524 0.274721
185 | vn 0.000000 0.961524 0.274721
186 | vn 0.000000 0.961524 0.274721
187 | vn -0.000000 0.961524 0.274721
188 | vn -0.000000 0.961524 0.274721
189 | vn 0.000000 0.961524 0.274721
190 | vn 0.866008 0.137369 -0.480791
191 | vn 0.965898 0.071131 -0.248960
192 | vn 0.965898 0.071131 -0.248960
193 | vn 0.866008 0.137369 -0.480791
194 | vn 0.866008 0.137369 -0.480791
195 | vn 0.500046 0.237908 -0.832679
196 | vn 0.500046 0.237908 -0.832679
197 | vn 0.866008 0.137369 -0.480791
198 | vn 0.500046 0.237908 -0.832679
199 | vn 0.258886 0.265355 -0.928744
200 | vn 0.258886 0.265355 -0.928744
201 | vn 0.500046 0.237908 -0.832679
202 | vn 0.000000 -0.961524 -0.274721
203 | vn 0.000000 -0.961524 -0.274721
204 | vn 0.000000 -0.961524 -0.274721
205 | vn -0.000000 -0.961524 -0.274721
206 | vn 0.000000 -0.961524 -0.274721
207 | vn 0.000000 -0.961524 -0.274721
208 | vn -0.000000 -0.961524 -0.274721
209 | vn -0.000000 -0.961524 -0.274721
210 | vn 0.000000 -0.961524 -0.274721
211 | vn 0.000000 -0.961524 -0.274721
212 | vn -0.000000 -0.961524 -0.274721
213 | vn 0.000000 -0.961524 -0.274721
214 | vn 0.000000 -0.961524 -0.274721
215 | vn 0.000000 -0.961524 -0.274721
216 | vn 0.000000 -0.961524 -0.274721
217 | vn 0.000000 -0.961524 -0.274721
218 | vn 0.000000 -0.961524 -0.274721
219 | vn 0.000000 -0.961524 -0.274721
220 | vn 0.000000 -0.961524 -0.274721
221 | vn 0.000000 -0.961524 -0.274721
222 | vn 0.000000 -0.961524 -0.274721
223 | vn 0.000000 -0.961524 -0.274721
224 | vn 0.000000 -0.961524 -0.274721
225 | vn 0.000000 -0.961524 -0.274721
226 | vn 0.000000 -0.961524 -0.274721
227 | vn 0.000000 -0.961524 -0.274721
228 | vn 0.000000 -0.961524 -0.274721
229 | vn -0.000000 -0.961524 -0.274721
230 | vn 0.000000 -0.961524 -0.274721
231 | vn 0.000000 -0.961524 -0.274721
232 | vn -0.000000 -0.961524 -0.274721
233 | vn -0.000000 -0.961524 -0.274721
234 | vn 0.000000 -0.961524 -0.274721
235 | vn 0.000000 -0.961524 -0.274721
236 | vn -0.000000 -0.961524 -0.274721
237 | vn 0.000000 -0.961524 -0.274721
238 | vn 0.000000 -0.961524 -0.274721
239 | vn 0.000000 -0.961524 -0.274721
240 | vn 0.000000 -0.961524 -0.274721
241 | vn 0.000000 -0.961524 -0.274721
242 | vn 0.000000 -0.961524 -0.274721
243 | vn 0.000000 -0.961524 -0.274721
244 | vn 0.000000 -0.961524 -0.274721
245 | vn 0.000000 -0.961524 -0.274721
246 | vn 0.000000 -0.961524 -0.274721
247 | vn 0.000000 -0.961524 -0.274721
248 | vn 0.000000 -0.961524 -0.274721
249 | vn 0.000000 -0.961524 -0.274721
250 | #end 160 vertex normals
251 |
252 | #begin 48 faces
253 | usemtl light1
254 | f 4//1 3//2 2//3 1//4
255 | usemtl light1
256 | f 8//5 7//6 6//7 5//8
257 | usemtl light1
258 | f 5//9 10//10 9//11 8//12
259 | usemtl light1
260 | f 10//13 12//14 11//15 9//16
261 | usemtl light1
262 | f 16//17 15//18 14//19 13//20
263 | usemtl light1
264 | f 20//21 19//22 18//23 17//24
265 | usemtl light1
266 | f 17//25 22//26 21//27 20//28
267 | usemtl light1
268 | f 22//29 24//30 23//31 21//32
269 | usemtl light1
270 | f 28//33 27//34 26//35 25//36
271 | usemtl light1
272 | f 32//37 31//38 30//39 29//40
273 | usemtl light1
274 | f 29//41 34//42 33//43 32//44
275 | usemtl light1
276 | f 34//45 36//46 35//47 33//48
277 | usemtl light1
278 | f 40//49 39//50 38//51 37//52
279 | usemtl light1
280 | f 41//53 42//54 57//55
281 | usemtl light1
282 | f 55//56 56//57 57//58
283 | usemtl light1
284 | f 48//59 55//60 57//61
285 | usemtl light1
286 | f 47//62 48//63 57//64
287 | usemtl light1
288 | f 54//65 47//66 57//67
289 | usemtl light1
290 | f 53//68 54//69 57//70
291 | usemtl light1
292 | f 46//71 53//72 57//73
293 | usemtl light1
294 | f 45//74 46//75 57//76
295 | usemtl light1
296 | f 52//77 45//78 57//79
297 | usemtl light1
298 | f 51//80 52//81 57//82
299 | usemtl light1
300 | f 44//83 51//84 57//85
301 | usemtl light1
302 | f 43//86 44//87 57//88
303 | usemtl light1
304 | f 50//89 43//90 57//91
305 | usemtl light1
306 | f 49//92 50//93 57//94
307 | usemtl light1
308 | f 42//95 49//96 57//97
309 | usemtl light1
310 | f 56//98 41//99 57//100
311 | usemtl light1
312 | f 61//101 60//102 59//103 58//104
313 | usemtl light1
314 | f 58//105 63//106 62//107 61//108
315 | usemtl light1
316 | f 63//109 65//110 64//111 62//112
317 | usemtl light1
318 | f 73//113 72//114 82//115
319 | usemtl light1
320 | f 80//116 81//117 82//118
321 | usemtl light1
322 | f 66//119 80//120 82//121
323 | usemtl light1
324 | f 67//122 66//123 82//124
325 | usemtl light1
326 | f 79//125 67//126 82//127
327 | usemtl light1
328 | f 78//128 79//129 82//130
329 | usemtl light1
330 | f 68//131 78//132 82//133
331 | usemtl light1
332 | f 69//134 68//135 82//136
333 | usemtl light1
334 | f 77//137 69//138 82//139
335 | usemtl light1
336 | f 76//140 77//141 82//142
337 | usemtl light1
338 | f 70//143 76//144 82//145
339 | usemtl light1
340 | f 71//146 70//147 82//148
341 | usemtl light1
342 | f 75//149 71//150 82//151
343 | usemtl light1
344 | f 74//152 75//153 82//154
345 | usemtl light1
346 | f 72//155 74//156 82//157
347 | usemtl light1
348 | f 81//158 73//159 82//160
349 | #end 48 faces
350 |
351 | # Hierarchy (from self to top father)
352 |
--------------------------------------------------------------------------------
/example/models/box2.obj:
--------------------------------------------------------------------------------
1 | mtllib 25_SciFi_Props.mtl
2 | g SciFi_Prop_25_3
3 |
4 | #begin 54 vertices
5 | v 104.067387 36.190984 -82.232577
6 | v 104.491141 36.190984 -82.232577
7 | v 104.491141 36.190984 -82.718548
8 | v 104.067387 36.190984 -82.718548
9 | v 104.491141 36.162681 -82.126953
10 | v 104.491141 36.190984 -82.232577
11 | v 104.067387 36.190984 -82.232577
12 | v 104.067387 36.162681 -82.126953
13 | v 104.067387 36.085360 -82.049631
14 | v 104.491141 36.085360 -82.049631
15 | v 104.067387 35.979735 -82.021329
16 | v 104.491141 35.979735 -82.021329
17 | v 104.067387 34.882422 -82.021329
18 | v 104.491141 34.882422 -82.021329
19 | v 104.491141 35.979735 -82.021329
20 | v 104.067387 35.979735 -82.021329
21 | v 104.067387 34.882422 -82.929797
22 | v 104.491141 34.882422 -82.929797
23 | v 104.491141 34.882422 -82.021329
24 | v 104.067387 34.882422 -82.021329
25 | v 104.067387 35.979735 -82.929797
26 | v 104.491141 35.979735 -82.929797
27 | v 104.491141 34.882422 -82.929797
28 | v 104.067387 34.882422 -82.929797
29 | v 104.067387 34.882422 -82.021329
30 | v 104.067387 34.882422 -82.929797
31 | v 104.067387 35.979735 -82.929797
32 | v 104.067387 36.190984 -82.718548
33 | v 104.067387 36.190984 -82.232577
34 | v 104.067387 35.979735 -82.021329
35 | v 104.067387 36.085360 -82.049631
36 | v 104.067387 36.162681 -82.126953
37 | v 104.067387 36.162681 -82.824172
38 | v 104.067387 36.085360 -82.901494
39 | v 104.067387 35.860236 -82.475563
40 | v 104.491141 36.085360 -82.901494
41 | v 104.491141 35.979735 -82.929797
42 | v 104.067387 35.979735 -82.929797
43 | v 104.067387 36.085360 -82.901494
44 | v 104.067387 36.162681 -82.824172
45 | v 104.491141 36.162681 -82.824172
46 | v 104.067387 36.190984 -82.718548
47 | v 104.491141 36.190984 -82.718548
48 | v 104.491141 34.882422 -82.021329
49 | v 104.491141 34.882422 -82.929797
50 | v 104.491141 35.979735 -82.929797
51 | v 104.491141 36.190984 -82.718548
52 | v 104.491141 36.190984 -82.232577
53 | v 104.491141 35.979735 -82.021329
54 | v 104.491141 36.085360 -82.901494
55 | v 104.491141 36.162681 -82.824172
56 | v 104.491141 36.162681 -82.126953
57 | v 104.491141 36.085360 -82.049631
58 | v 104.491141 35.860236 -82.475563
59 | #end 54 vertices
60 |
61 | #begin 100 normals
62 | vn 0.000000 1.000000 0.000000
63 | vn 0.000000 1.000000 0.000000
64 | vn 0.000000 1.000000 0.000000
65 | vn 0.000000 1.000000 0.000000
66 | vn 0.000000 0.866025 0.500000
67 | vn 0.000000 0.965926 0.258820
68 | vn 0.000000 0.965926 0.258820
69 | vn 0.000000 0.866025 0.500000
70 | vn 0.000000 0.866025 0.500000
71 | vn 0.000000 0.500000 0.866025
72 | vn 0.000000 0.500000 0.866025
73 | vn 0.000000 0.866025 0.500000
74 | vn 0.000000 0.500000 0.866025
75 | vn 0.000000 0.258820 0.965926
76 | vn 0.000000 0.258820 0.965926
77 | vn 0.000000 0.500000 0.866025
78 | vn 0.000000 0.000000 1.000000
79 | vn 0.000000 0.000000 1.000000
80 | vn 0.000000 0.000000 1.000000
81 | vn 0.000000 0.000000 1.000000
82 | vn 0.000000 -1.000000 0.000000
83 | vn 0.000000 -1.000000 0.000000
84 | vn 0.000000 -1.000000 0.000000
85 | vn 0.000000 -1.000000 0.000000
86 | vn 0.000000 0.000000 -1.000000
87 | vn 0.000000 0.000000 -1.000000
88 | vn 0.000000 0.000000 -1.000000
89 | vn 0.000000 0.000000 -1.000000
90 | vn -1.000000 0.000000 0.000000
91 | vn -1.000000 0.000000 0.000000
92 | vn -1.000000 0.000000 0.000000
93 | vn -1.000000 0.000000 0.000000
94 | vn -1.000000 0.000000 0.000000
95 | vn -1.000000 0.000000 0.000000
96 | vn -1.000000 0.000000 0.000000
97 | vn -1.000000 0.000000 0.000000
98 | vn -1.000000 0.000000 0.000000
99 | vn -1.000000 0.000000 0.000000
100 | vn -1.000000 0.000000 0.000000
101 | vn -1.000000 0.000000 0.000000
102 | vn -1.000000 0.000000 0.000000
103 | vn -1.000000 0.000000 0.000000
104 | vn -1.000000 0.000000 0.000000
105 | vn -1.000000 0.000000 0.000000
106 | vn -1.000000 0.000000 0.000000
107 | vn -1.000000 0.000000 0.000000
108 | vn -1.000000 0.000000 0.000000
109 | vn -1.000000 0.000000 0.000000
110 | vn -1.000000 0.000000 0.000000
111 | vn -1.000000 0.000000 0.000000
112 | vn -1.000000 0.000000 0.000000
113 | vn -1.000000 0.000000 0.000000
114 | vn -1.000000 0.000000 0.000000
115 | vn -1.000000 0.000000 0.000000
116 | vn -1.000000 0.000000 0.000000
117 | vn -1.000000 0.000000 0.000000
118 | vn -1.000000 0.000000 0.000000
119 | vn -1.000000 0.000000 0.000000
120 | vn 0.000000 0.500000 -0.866025
121 | vn 0.000000 0.258820 -0.965926
122 | vn 0.000000 0.258820 -0.965926
123 | vn 0.000000 0.500000 -0.866025
124 | vn 0.000000 0.500000 -0.866025
125 | vn 0.000000 0.866025 -0.500000
126 | vn 0.000000 0.866025 -0.500000
127 | vn 0.000000 0.500000 -0.866025
128 | vn 0.000000 0.866025 -0.500000
129 | vn 0.000000 0.965926 -0.258820
130 | vn 0.000000 0.965926 -0.258820
131 | vn 0.000000 0.866025 -0.500000
132 | vn 1.000000 0.000000 0.000000
133 | vn 1.000000 0.000000 0.000000
134 | vn 1.000000 0.000000 0.000000
135 | vn 1.000000 0.000000 0.000000
136 | vn 1.000000 0.000000 0.000000
137 | vn 1.000000 0.000000 0.000000
138 | vn 1.000000 0.000000 0.000000
139 | vn 1.000000 0.000000 0.000000
140 | vn 1.000000 0.000000 0.000000
141 | vn 1.000000 0.000000 0.000000
142 | vn 1.000000 0.000000 0.000000
143 | vn 1.000000 0.000000 0.000000
144 | vn 1.000000 0.000000 0.000000
145 | vn 1.000000 0.000000 0.000000
146 | vn 1.000000 0.000000 0.000000
147 | vn 1.000000 0.000000 0.000000
148 | vn 1.000000 0.000000 0.000000
149 | vn 1.000000 0.000000 0.000000
150 | vn 1.000000 0.000000 0.000000
151 | vn 1.000000 0.000000 0.000000
152 | vn 1.000000 0.000000 0.000000
153 | vn 1.000000 0.000000 0.000000
154 | vn 1.000000 0.000000 0.000000
155 | vn 1.000000 0.000000 0.000000
156 | vn 1.000000 0.000000 0.000000
157 | vn 1.000000 0.000000 0.000000
158 | vn 1.000000 0.000000 0.000000
159 | vn 1.000000 0.000000 0.000000
160 | vn 1.000000 0.000000 0.000000
161 | vn 1.000000 0.000000 0.000000
162 | #end 100 vertex normals
163 |
164 | #begin 30 faces
165 | usemtl scene_material1
166 | f 1//1 2//2 3//3 4//4
167 | usemtl scene_material1
168 | f 5//5 6//6 7//7 8//8
169 | usemtl scene_material1
170 | f 8//9 9//10 10//11 5//12
171 | usemtl scene_material1
172 | f 9//13 11//14 12//15 10//16
173 | usemtl scene_material1
174 | f 13//17 14//18 15//19 16//20
175 | usemtl scene_material1
176 | f 17//21 18//22 19//23 20//24
177 | usemtl scene_material1
178 | f 21//25 22//26 23//27 24//28
179 | usemtl scene_material1
180 | f 30//29 31//30 35//31
181 | usemtl scene_material1
182 | f 26//32 25//33 35//34
183 | usemtl scene_material1
184 | f 27//35 26//36 35//37
185 | usemtl scene_material1
186 | f 34//38 27//39 35//40
187 | usemtl scene_material1
188 | f 33//41 34//42 35//43
189 | usemtl scene_material1
190 | f 28//44 33//45 35//46
191 | usemtl scene_material1
192 | f 29//47 28//48 35//49
193 | usemtl scene_material1
194 | f 32//50 29//51 35//52
195 | usemtl scene_material1
196 | f 31//53 32//54 35//55
197 | usemtl scene_material1
198 | f 25//56 30//57 35//58
199 | usemtl scene_material1
200 | f 36//59 37//60 38//61 39//62
201 | usemtl scene_material1
202 | f 39//63 40//64 41//65 36//66
203 | usemtl scene_material1
204 | f 40//67 42//68 43//69 41//70
205 | usemtl scene_material1
206 | f 44//71 45//72 54//73
207 | usemtl scene_material1
208 | f 53//74 49//75 54//76
209 | usemtl scene_material1
210 | f 52//77 53//78 54//79
211 | usemtl scene_material1
212 | f 48//80 52//81 54//82
213 | usemtl scene_material1
214 | f 47//83 48//84 54//85
215 | usemtl scene_material1
216 | f 51//86 47//87 54//88
217 | usemtl scene_material1
218 | f 50//89 51//90 54//91
219 | usemtl scene_material1
220 | f 46//92 50//93 54//94
221 | usemtl scene_material1
222 | f 45//95 46//96 54//97
223 | usemtl scene_material1
224 | f 49//98 44//99 54//100
225 | #end 30 faces
226 |
227 | # Hierarchy (from self to top father)
228 |
--------------------------------------------------------------------------------
/example/models/chair3.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: ''
2 | # Material Count: 2
3 | newmtl chair_color1
4 | Ka 0.000000 0.000000 0.000000
5 | Kd 1.000000 0.100000 0.100000
6 | Ks 0.000000 0.000000 0.000000
7 | Ns 96.078431
8 | Ni 1.000000
9 | d 1.000000
10 | illum 0
11 | newmtl chair_color2
12 | Ka 0.000000 0.000000 0.000000
13 | Kd 0.300000 0.300000 0.300000
14 | Ks 0.000000 0.000000 0.000000
15 | Ns 96.078431
16 | Ni 1.000000
17 | d 1.000000
18 | illum 0
19 | newmtl chair_color3
20 | Ka 0.000000 0.000000 0.000000
21 | Kd 0.130000 0.130000 1.000000
22 | Ks 0.000000 0.000000 0.000000
23 | Ns 96.078431
24 | Ni 1.000000
25 | d 1.000000
26 | illum 0
27 | newmtl chair_color4
28 | Ka 0.000000 0.000000 0.000000
29 | Kd 0.000000 0.00000 1.000000
30 | Ks 0.000000 0.000000 0.000000
31 | Ns 96.078431
32 | Ni 1.000000
33 | d 1.000000
34 | illum 0
35 | newmtl chair_color5
36 | Ka 0.000000 0.000000 0.000000
37 | Kd 0.000000 1.000000 1.000000
38 | Ks 0.000000 0.000000 0.000000
39 | Ns 96.078431
40 | Ni 1.000000
41 | d 1.000000
42 | illum 0
43 | newmtl chair_color6
44 | Ka 0.000000 0.000000 0.000000
45 | Kd 1.000000 1.000000 0.000000
46 | Ks 0.000000 0.000000 0.000000
47 | Ns 96.078431
48 | Ni 1.000000
49 | d 1.000000
50 | illum 0
51 |
--------------------------------------------------------------------------------
/example/models/cube.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: ''
2 | # Material Count: 2
3 | newmtl Material
4 | Ka 0.000000 0.000000 0.000000
5 | Kd 0.733333 0.596000 0.494117
6 | Ks 0.000000 0.000000 0.000000
7 | Ns 96.078431
8 | Ni 1.000000
9 | d 1.000000
10 | illum 0
11 | newmtl Material.001
12 | Ka 0.000000 0.000000 0.000000
13 | Kd 0.733333 0.596000 0.494117
14 | Ks 0.000000 0.000000 0.000000
15 | Ns 96.078431
16 | Ni 1.000000
17 | d 1.000000
18 | illum 0
19 | newmtl light1
20 | Ka 0.000000 0.000000 0.000000
21 | Kd 0.733333 0.596000 0.494117
22 | Ks 0.000000 0.000000 0.000000
23 | Ns 96.078431
24 | Ni 1.000000
25 | d 1.000000
26 | illum 0
--------------------------------------------------------------------------------
/example/models/cube.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.60 (sub 0) OBJ File: ''
2 | # www.blender.org
3 | mtllib cube.mtl
4 | o Cube
5 | v 1.000000 -1.000000 -1.000000
6 | v 1.000000 -1.000000 1.000000
7 | v -1.000000 -1.000000 1.000000
8 | v -1.000000 -1.000000 -1.000000
9 | v 1.000000 1.000000 -1.000000
10 | v 1.000000 1.000000 1.000001
11 | v -1.000000 1.000000 1.000000
12 | v -1.000000 1.000000 -1.000000
13 | vt 0.0 0.0
14 | vt 0.0 1.0
15 | vt 1.0 0.0
16 | vt 1.0 1.0
17 | usemtl Material
18 | f 1/1 2/2 3/3 4/4
19 | f 5/1 8/2 7/3 6/4
20 | f 2/1 6/2 7/3 3/4
21 | f 3/1 7/2 8/3 4/4
22 | f 5/1 1/2 4/3 8/4
23 | usemtl Material.001
24 | f 1/1 5/2 6/3 2/4
25 |
--------------------------------------------------------------------------------
/example/models/pad.obj:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 14.05.2010 12:10:16
3 |
4 | mtllib 044.mtl
5 |
6 | #
7 | # object archmodels87_044_001
8 | #
9 |
10 | v -27.559055328369 -17.716535568237 -0.000000774414
11 | v -27.559055328369 17.716535568237 0.000000774414
12 | v 27.559055328369 17.716535568237 0.000000774414
13 | v 27.559055328369 -17.716535568237 -0.000000774414
14 | v -27.559055328369 -17.716535568237 0.196849614382
15 | v 27.559055328369 -17.716535568237 0.196849614382
16 | v 27.559055328369 17.716535568237 0.196851164103
17 | v -27.559055328369 17.716535568237 0.196851164103
18 | # 8 vertices
19 |
20 | vt 0.000499546528 0.000499814749 0.000499516726
21 | vt 0.000499725342 0.999500513077 0.000499516726
22 | vt 0.999500453472 0.999500155449 0.000499516726
23 | vt 0.999500274658 0.000499457121 0.000499516726
24 | vt 0.000499546528 0.000499814749 0.999500513077
25 | vt 0.999500274658 0.000499457121 0.999500513077
26 | vt 0.999500453472 0.999500155449 0.999500513077
27 | vt 0.000499725342 0.999500513077 0.999500513077
28 | # 8 texture coords
29 |
30 | g archmodels87_044_001
31 | usemtl Standard_20
32 | s 2
33 | f -8/-8 -7/-7 -6/-6 -5/-5
34 | s 4
35 | f -4/-4 -3/-3 -2/-2 -1/-1
36 | s 8
37 | f -8/-8 -5/-5 -3/-3 -4/-4
38 | s 16
39 | f -5/-5 -6/-6 -2/-2 -3/-3
40 | s 32
41 | f -6/-6 -7/-7 -1/-1 -2/-2
42 | s 64
43 | f -7/-7 -8/-8 -4/-4 -1/-1
44 | # 6 polygons
45 |
46 | g archmodels87_044_002
47 | usemtl Standard_20
48 | s 2
49 | f -8/-8 -7/-7 -6/-6 -5/-5
50 | s 4
51 | f -4/-4 -3/-3 -2/-2 -1/-1
52 | s 8
53 | f -8/-8 -5/-5 -3/-3 -4/-4
54 | s 16
55 | f -5/-5 -6/-6 -2/-2 -3/-3
56 | s 32
57 | f -6/-6 -7/-7 -1/-1 -2/-2
58 | s 64
59 | f -7/-7 -8/-8 -4/-4 -1/-1
60 | # 6 polygons
61 |
--------------------------------------------------------------------------------
/example/models/paper1.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.60 (sub 0) OBJ File: ''
2 | # www.blender.org
3 | o Cube
4 | v 0.000000 0.000000 -0.100000
5 | v 0.000000 0.000000 0.100000
6 | v -1.000000 -0.2.000000 0.100000
7 | v -1.000000 -0.2.000000 -0.100000
8 | v -0.200000 1.000000 -0.100000
9 | v -0.200000 1.000000 0.100001
10 | v -1.000000 1.000000 0.100000
11 | v -1.000000 1.000000 -0.100000
12 | vt 0.5 0.5
13 | vt 0.4 0.0
14 | vt 0.0 0.0
15 | vt 0.0 0.6
16 | f 1/4 2/4 3/4 4/4
17 | f 5/4 8/4 7/4 6/4
18 | f 2/1 6/2 7/3 3/4
19 | f 3/4 7/4 8/4 4/4
20 | f 1/1 5/2 8/3 4/4
21 | f 1/4 5/4 6/4 2/4
22 |
--------------------------------------------------------------------------------
/example/models/paper2.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.60 (sub 0) OBJ File: ''
2 | # www.blender.org
3 | o Cube
4 | v 0.000000 0.000000 -0.100000
5 | v 0.000000 0.000000 0.100000
6 | v -1.000000 -0.2.000000 0.100000
7 | v -1.000000 -0.2.000000 -0.100000
8 | v -0.200000 1.000000 -0.100000
9 | v -0.200000 1.000000 0.100001
10 | v -1.000000 1.000000 0.100000
11 | v -1.000000 1.000000 -0.100000
12 | vt 0.5 0.5
13 | vt 0.6 1.0
14 | vt 0.0 1.0
15 | vt 0.0 0.6
16 | f 1/4 2/4 3/4 4/4
17 | f 5/4 8/4 7/4 6/4
18 | f 2/1 3/2 7/3 6/4
19 | f 3/4 7/4 8/4 4/4
20 | f 1/1 4/2 8/3 5/4
21 | f 1/4 5/4 6/4 2/4
22 |
--------------------------------------------------------------------------------
/example/models/paper3.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.60 (sub 0) OBJ File: ''
2 | # www.blender.org
3 | o Cube
4 | v 0.000000 0.000000 -0.100000
5 | v 0.000000 0.000000 0.100000
6 | v -1.000000 -0.2.000000 0.100000
7 | v -1.000000 -0.2.000000 -0.100000
8 | v -0.200000 1.000000 -0.100000
9 | v -0.200000 1.000000 0.100001
10 | v -1.000000 1.000000 0.100000
11 | v -1.000000 1.000000 -0.100000
12 | vt 0.5 0.5
13 | vt 0.6 1.0
14 | vt 1.0 1.0
15 | vt 1.0 0.4
16 | f 1/4 2/4 3/4 4/4
17 | f 5/4 8/4 7/4 6/4
18 | f 2/1 6/2 7/3 3/4
19 | f 3/4 7/4 8/4 4/4
20 | f 1/1 5/2 8/3 4/4
21 | f 1/4 5/4 6/4 2/4
--------------------------------------------------------------------------------
/example/models/paper4.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.60 (sub 0) OBJ File: ''
2 | # www.blender.org
3 | o Cube
4 | v 0.000000 0.000000 -0.100000
5 | v 0.000000 0.000000 0.100000
6 | v -1.000000 -0.2.000000 0.100000
7 | v -1.000000 -0.2.000000 -0.100000
8 | v -0.200000 1.000000 -0.100000
9 | v -0.200000 1.000000 0.100001
10 | v -1.000000 1.000000 0.100000
11 | v -1.000000 1.000000 -0.100000
12 | vt 0.5 0.5
13 | vt 1.0 0.4
14 | vt 1.0 0.0
15 | vt 0.4 0.0
16 | f 1/4 2/4 3/4 4/4
17 | f 5/4 8/4 7/4 6/4
18 | f 2/1 6/2 7/3 3/4
19 | f 3/4 7/4 8/4 4/4
20 | f 1/1 5/2 8/3 4/4
21 | f 1/4 5/4 6/4 2/4
--------------------------------------------------------------------------------
/example/models/table3.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 02.03.2011 20:13:57
3 |
4 | newmtl wire_000000000
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.0000 0.0000 0.0000
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/example/textTures/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/.DS_Store
--------------------------------------------------------------------------------
/example/textTures/004_033.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/004_033.jpg
--------------------------------------------------------------------------------
/example/textTures/1440.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/1440.jpg
--------------------------------------------------------------------------------
/example/textTures/1440.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/1440.png
--------------------------------------------------------------------------------
/example/textTures/2048.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/2048.jpg
--------------------------------------------------------------------------------
/example/textTures/2048_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/2048_2.jpg
--------------------------------------------------------------------------------
/example/textTures/6427.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/6427.jpg
--------------------------------------------------------------------------------
/example/textTures/6427.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/6427.png
--------------------------------------------------------------------------------
/example/textTures/bump.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/bump.jpg
--------------------------------------------------------------------------------
/example/textTures/colorful.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/colorful.jpg
--------------------------------------------------------------------------------
/example/textTures/colorful2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/colorful2.jpg
--------------------------------------------------------------------------------
/example/textTures/lastics1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/lastics1.jpg
--------------------------------------------------------------------------------
/example/textTures/metal1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal1.jpg
--------------------------------------------------------------------------------
/example/textTures/metal10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal10.jpg
--------------------------------------------------------------------------------
/example/textTures/metal2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal2.jpg
--------------------------------------------------------------------------------
/example/textTures/metal3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal3.jpg
--------------------------------------------------------------------------------
/example/textTures/metal4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal4.jpg
--------------------------------------------------------------------------------
/example/textTures/metal5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal5.jpg
--------------------------------------------------------------------------------
/example/textTures/metal6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal6.jpg
--------------------------------------------------------------------------------
/example/textTures/metal7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal7.jpg
--------------------------------------------------------------------------------
/example/textTures/metal8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal8.jpg
--------------------------------------------------------------------------------
/example/textTures/metal9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/metal9.jpg
--------------------------------------------------------------------------------
/example/textTures/pure1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/pure1.png
--------------------------------------------------------------------------------
/example/textTures/texture1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/texture1.jpg
--------------------------------------------------------------------------------
/example/textTures/wood1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood1.jpg
--------------------------------------------------------------------------------
/example/textTures/wood10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood10.jpg
--------------------------------------------------------------------------------
/example/textTures/wood11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood11.jpg
--------------------------------------------------------------------------------
/example/textTures/wood2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood2.jpg
--------------------------------------------------------------------------------
/example/textTures/wood3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood3.jpg
--------------------------------------------------------------------------------
/example/textTures/wood4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood4.jpg
--------------------------------------------------------------------------------
/example/textTures/wood5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood5.jpg
--------------------------------------------------------------------------------
/example/textTures/wood6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood6.jpg
--------------------------------------------------------------------------------
/example/textTures/wood7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood7.jpg
--------------------------------------------------------------------------------
/example/textTures/wood8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood8.jpg
--------------------------------------------------------------------------------
/example/textTures/wood9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/example/textTures/wood9.jpg
--------------------------------------------------------------------------------
/lib/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aircloud/WebGL-obj-loader/76c9799a7e00fccc40da2f22ef4501b83df69a5a/lib/.DS_Store
--------------------------------------------------------------------------------
/lib/cuon-matrix.js:
--------------------------------------------------------------------------------
1 | // cuon-matrix.js (c) 2012 kanda and matsuda
2 | /**
3 | * This is a class treating 4x4 matrix.
4 | * This class contains the function that is equivalent to OpenGL matrix stack.
5 | * The matrix after conversion is calculated by multiplying a conversion matrix from the right.
6 | * The matrix is replaced by the calculated result.
7 | */
8 |
9 | /**
10 | * Constructor of Matrix4
11 | * If opt_src is specified, new matrix is initialized by opt_src.
12 | * Otherwise, new matrix is initialized by identity matrix.
13 | * @param opt_src source matrix(option)
14 | */
15 | var Matrix4 = function(opt_src) {
16 | var i, s, d;
17 | if (opt_src && typeof opt_src === 'object' && opt_src.hasOwnProperty('elements')) {
18 | s = opt_src.elements;
19 | d = new Float32Array(16);
20 | for (i = 0; i < 16; ++i) {
21 | d[i] = s[i];
22 | }
23 | this.elements = d;
24 | } else {
25 | this.elements = new Float32Array([1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]);
26 | }
27 | };
28 |
29 | /**
30 | * Set the identity matrix.
31 | * @return this
32 | */
33 | Matrix4.prototype.setIdentity = function() {
34 | var e = this.elements;
35 | e[0] = 1; e[4] = 0; e[8] = 0; e[12] = 0;
36 | e[1] = 0; e[5] = 1; e[9] = 0; e[13] = 0;
37 | e[2] = 0; e[6] = 0; e[10] = 1; e[14] = 0;
38 | e[3] = 0; e[7] = 0; e[11] = 0; e[15] = 1;
39 | return this;
40 | };
41 |
42 | /**
43 | * Copy matrix.
44 | * @param src source matrix
45 | * @return this
46 | */
47 | Matrix4.prototype.set = function(src) {
48 | var i, s, d;
49 |
50 | s = src.elements;
51 | d = this.elements;
52 |
53 | if (s === d) {
54 | return;
55 | }
56 |
57 | for (i = 0; i < 16; ++i) {
58 | d[i] = s[i];
59 | }
60 |
61 | return this;
62 | };
63 |
64 | /**
65 | * Multiply the matrix from the right.
66 | * @param other The multiply matrix
67 | * @return this
68 | */
69 | Matrix4.prototype.concat = function(other) {
70 | var i, e, a, b, ai0, ai1, ai2, ai3;
71 |
72 | // Calculate e = a * b
73 | e = this.elements;
74 | a = this.elements;
75 | b = other.elements;
76 |
77 | // If e equals b, copy b to temporary matrix.
78 | if (e === b) {
79 | b = new Float32Array(16);
80 | for (i = 0; i < 16; ++i) {
81 | b[i] = e[i];
82 | }
83 | }
84 |
85 | for (i = 0; i < 4; i++) {
86 | ai0=a[i]; ai1=a[i+4]; ai2=a[i+8]; ai3=a[i+12];
87 | e[i] = ai0 * b[0] + ai1 * b[1] + ai2 * b[2] + ai3 * b[3];
88 | e[i+4] = ai0 * b[4] + ai1 * b[5] + ai2 * b[6] + ai3 * b[7];
89 | e[i+8] = ai0 * b[8] + ai1 * b[9] + ai2 * b[10] + ai3 * b[11];
90 | e[i+12] = ai0 * b[12] + ai1 * b[13] + ai2 * b[14] + ai3 * b[15];
91 | }
92 |
93 | return this;
94 | };
95 | Matrix4.prototype.multiply = Matrix4.prototype.concat;
96 |
97 | /**
98 | * Multiply the three-dimensional vector.
99 | * @param pos The multiply vector
100 | * @return The result of multiplication(Float32Array)
101 | */
102 | Matrix4.prototype.multiplyVector3 = function(pos) {
103 | var e = this.elements;
104 | var p = pos.elements;
105 | var v = new Vector3();
106 | var result = v.elements;
107 |
108 | result[0] = p[0] * e[0] + p[1] * e[4] + p[2] * e[ 8] + e[12];
109 | result[1] = p[0] * e[1] + p[1] * e[5] + p[2] * e[ 9] + e[13];
110 | result[2] = p[0] * e[2] + p[1] * e[6] + p[2] * e[10] + e[14];
111 |
112 | return v;
113 | };
114 |
115 | /**
116 | * Multiply the four-dimensional vector.
117 | * @param pos The multiply vector
118 | * @return The result of multiplication(Float32Array)
119 | */
120 | Matrix4.prototype.multiplyVector4 = function(pos) {
121 | var e = this.elements;
122 | var p = pos.elements;
123 | var v = new Vector4();
124 | var result = v.elements;
125 |
126 | result[0] = p[0] * e[0] + p[1] * e[4] + p[2] * e[ 8] + p[3] * e[12];
127 | result[1] = p[0] * e[1] + p[1] * e[5] + p[2] * e[ 9] + p[3] * e[13];
128 | result[2] = p[0] * e[2] + p[1] * e[6] + p[2] * e[10] + p[3] * e[14];
129 | result[3] = p[0] * e[3] + p[1] * e[7] + p[2] * e[11] + p[3] * e[15];
130 |
131 | return v;
132 | };
133 |
134 | /**
135 | * Transpose the matrix.
136 | * @return this
137 | */
138 | Matrix4.prototype.transpose = function() {
139 | var e, t;
140 |
141 | e = this.elements;
142 |
143 | t = e[ 1]; e[ 1] = e[ 4]; e[ 4] = t;
144 | t = e[ 2]; e[ 2] = e[ 8]; e[ 8] = t;
145 | t = e[ 3]; e[ 3] = e[12]; e[12] = t;
146 | t = e[ 6]; e[ 6] = e[ 9]; e[ 9] = t;
147 | t = e[ 7]; e[ 7] = e[13]; e[13] = t;
148 | t = e[11]; e[11] = e[14]; e[14] = t;
149 |
150 | return this;
151 | };
152 |
153 | /**
154 | * Calculate the inverse matrix of specified matrix, and set to this.
155 | * @param other The source matrix
156 | * @return this
157 | */
158 | Matrix4.prototype.setInverseOf = function(other) {
159 | var i, s, d, inv, det;
160 |
161 | s = other.elements;
162 | d = this.elements;
163 | inv = new Float32Array(16);
164 |
165 | inv[0] = s[5]*s[10]*s[15] - s[5] *s[11]*s[14] - s[9] *s[6]*s[15]
166 | + s[9]*s[7] *s[14] + s[13]*s[6] *s[11] - s[13]*s[7]*s[10];
167 | inv[4] = - s[4]*s[10]*s[15] + s[4] *s[11]*s[14] + s[8] *s[6]*s[15]
168 | - s[8]*s[7] *s[14] - s[12]*s[6] *s[11] + s[12]*s[7]*s[10];
169 | inv[8] = s[4]*s[9] *s[15] - s[4] *s[11]*s[13] - s[8] *s[5]*s[15]
170 | + s[8]*s[7] *s[13] + s[12]*s[5] *s[11] - s[12]*s[7]*s[9];
171 | inv[12] = - s[4]*s[9] *s[14] + s[4] *s[10]*s[13] + s[8] *s[5]*s[14]
172 | - s[8]*s[6] *s[13] - s[12]*s[5] *s[10] + s[12]*s[6]*s[9];
173 |
174 | inv[1] = - s[1]*s[10]*s[15] + s[1] *s[11]*s[14] + s[9] *s[2]*s[15]
175 | - s[9]*s[3] *s[14] - s[13]*s[2] *s[11] + s[13]*s[3]*s[10];
176 | inv[5] = s[0]*s[10]*s[15] - s[0] *s[11]*s[14] - s[8] *s[2]*s[15]
177 | + s[8]*s[3] *s[14] + s[12]*s[2] *s[11] - s[12]*s[3]*s[10];
178 | inv[9] = - s[0]*s[9] *s[15] + s[0] *s[11]*s[13] + s[8] *s[1]*s[15]
179 | - s[8]*s[3] *s[13] - s[12]*s[1] *s[11] + s[12]*s[3]*s[9];
180 | inv[13] = s[0]*s[9] *s[14] - s[0] *s[10]*s[13] - s[8] *s[1]*s[14]
181 | + s[8]*s[2] *s[13] + s[12]*s[1] *s[10] - s[12]*s[2]*s[9];
182 |
183 | inv[2] = s[1]*s[6]*s[15] - s[1] *s[7]*s[14] - s[5] *s[2]*s[15]
184 | + s[5]*s[3]*s[14] + s[13]*s[2]*s[7] - s[13]*s[3]*s[6];
185 | inv[6] = - s[0]*s[6]*s[15] + s[0] *s[7]*s[14] + s[4] *s[2]*s[15]
186 | - s[4]*s[3]*s[14] - s[12]*s[2]*s[7] + s[12]*s[3]*s[6];
187 | inv[10] = s[0]*s[5]*s[15] - s[0] *s[7]*s[13] - s[4] *s[1]*s[15]
188 | + s[4]*s[3]*s[13] + s[12]*s[1]*s[7] - s[12]*s[3]*s[5];
189 | inv[14] = - s[0]*s[5]*s[14] + s[0] *s[6]*s[13] + s[4] *s[1]*s[14]
190 | - s[4]*s[2]*s[13] - s[12]*s[1]*s[6] + s[12]*s[2]*s[5];
191 |
192 | inv[3] = - s[1]*s[6]*s[11] + s[1]*s[7]*s[10] + s[5]*s[2]*s[11]
193 | - s[5]*s[3]*s[10] - s[9]*s[2]*s[7] + s[9]*s[3]*s[6];
194 | inv[7] = s[0]*s[6]*s[11] - s[0]*s[7]*s[10] - s[4]*s[2]*s[11]
195 | + s[4]*s[3]*s[10] + s[8]*s[2]*s[7] - s[8]*s[3]*s[6];
196 | inv[11] = - s[0]*s[5]*s[11] + s[0]*s[7]*s[9] + s[4]*s[1]*s[11]
197 | - s[4]*s[3]*s[9] - s[8]*s[1]*s[7] + s[8]*s[3]*s[5];
198 | inv[15] = s[0]*s[5]*s[10] - s[0]*s[6]*s[9] - s[4]*s[1]*s[10]
199 | + s[4]*s[2]*s[9] + s[8]*s[1]*s[6] - s[8]*s[2]*s[5];
200 |
201 | det = s[0]*inv[0] + s[1]*inv[4] + s[2]*inv[8] + s[3]*inv[12];
202 | if (det === 0) {
203 | return this;
204 | }
205 |
206 | det = 1 / det;
207 | for (i = 0; i < 16; i++) {
208 | d[i] = inv[i] * det;
209 | }
210 |
211 | return this;
212 | };
213 |
214 | /**
215 | * Calculate the inverse matrix of this, and set to this.
216 | * @return this
217 | */
218 | Matrix4.prototype.invert = function() {
219 | return this.setInverseOf(this);
220 | };
221 |
222 | /**
223 | * Set the orthographic projection matrix.
224 | * @param left The coordinate of the left of clipping plane.
225 | * @param right The coordinate of the right of clipping plane.
226 | * @param bottom The coordinate of the bottom of clipping plane.
227 | * @param top The coordinate of the top top clipping plane.
228 | * @param near The distances to the nearer depth clipping plane. This value is minus if the plane is to be behind the viewer.
229 | * @param far The distances to the farther depth clipping plane. This value is minus if the plane is to be behind the viewer.
230 | * @return this
231 | */
232 | Matrix4.prototype.setOrtho = function(left, right, bottom, top, near, far) {
233 | var e, rw, rh, rd;
234 |
235 | if (left === right || bottom === top || near === far) {
236 | throw 'null frustum';
237 | }
238 |
239 | rw = 1 / (right - left);
240 | rh = 1 / (top - bottom);
241 | rd = 1 / (far - near);
242 |
243 | e = this.elements;
244 |
245 | e[0] = 2 * rw;
246 | e[1] = 0;
247 | e[2] = 0;
248 | e[3] = 0;
249 |
250 | e[4] = 0;
251 | e[5] = 2 * rh;
252 | e[6] = 0;
253 | e[7] = 0;
254 |
255 | e[8] = 0;
256 | e[9] = 0;
257 | e[10] = -2 * rd;
258 | e[11] = 0;
259 |
260 | e[12] = -(right + left) * rw;
261 | e[13] = -(top + bottom) * rh;
262 | e[14] = -(far + near) * rd;
263 | e[15] = 1;
264 |
265 | return this;
266 | };
267 |
268 | /**
269 | * Multiply the orthographic projection matrix from the right.
270 | * @param left The coordinate of the left of clipping plane.
271 | * @param right The coordinate of the right of clipping plane.
272 | * @param bottom The coordinate of the bottom of clipping plane.
273 | * @param top The coordinate of the top top clipping plane.
274 | * @param near The distances to the nearer depth clipping plane. This value is minus if the plane is to be behind the viewer.
275 | * @param far The distances to the farther depth clipping plane. This value is minus if the plane is to be behind the viewer.
276 | * @return this
277 | */
278 | Matrix4.prototype.ortho = function(left, right, bottom, top, near, far) {
279 | return this.concat(new Matrix4().setOrtho(left, right, bottom, top, near, far));
280 | };
281 |
282 | /**
283 | * Set the perspective projection matrix.
284 | * @param left The coordinate of the left of clipping plane.
285 | * @param right The coordinate of the right of clipping plane.
286 | * @param bottom The coordinate of the bottom of clipping plane.
287 | * @param top The coordinate of the top top clipping plane.
288 | * @param near The distances to the nearer depth clipping plane. This value must be plus value.
289 | * @param far The distances to the farther depth clipping plane. This value must be plus value.
290 | * @return this
291 | */
292 | Matrix4.prototype.setFrustum = function(left, right, bottom, top, near, far) {
293 | var e, rw, rh, rd;
294 |
295 | if (left === right || top === bottom || near === far) {
296 | throw 'null frustum';
297 | }
298 | if (near <= 0) {
299 | throw 'near <= 0';
300 | }
301 | if (far <= 0) {
302 | throw 'far <= 0';
303 | }
304 |
305 | rw = 1 / (right - left);
306 | rh = 1 / (top - bottom);
307 | rd = 1 / (far - near);
308 |
309 | e = this.elements;
310 |
311 | e[ 0] = 2 * near * rw;
312 | e[ 1] = 0;
313 | e[ 2] = 0;
314 | e[ 3] = 0;
315 |
316 | e[ 4] = 0;
317 | e[ 5] = 2 * near * rh;
318 | e[ 6] = 0;
319 | e[ 7] = 0;
320 |
321 | e[ 8] = (right + left) * rw;
322 | e[ 9] = (top + bottom) * rh;
323 | e[10] = -(far + near) * rd;
324 | e[11] = -1;
325 |
326 | e[12] = 0;
327 | e[13] = 0;
328 | e[14] = -2 * near * far * rd;
329 | e[15] = 0;
330 |
331 | return this;
332 | };
333 |
334 | /**
335 | * Multiply the perspective projection matrix from the right.
336 | * @param left The coordinate of the left of clipping plane.
337 | * @param right The coordinate of the right of clipping plane.
338 | * @param bottom The coordinate of the bottom of clipping plane.
339 | * @param top The coordinate of the top top clipping plane.
340 | * @param near The distances to the nearer depth clipping plane. This value must be plus value.
341 | * @param far The distances to the farther depth clipping plane. This value must be plus value.
342 | * @return this
343 | */
344 | Matrix4.prototype.frustum = function(left, right, bottom, top, near, far) {
345 | return this.concat(new Matrix4().setFrustum(left, right, bottom, top, near, far));
346 | };
347 |
348 | /**
349 | * Set the perspective projection matrix by fovy and aspect.
350 | * @param fovy The angle between the upper and lower sides of the frustum.
351 | * @param aspect The aspect ratio of the frustum. (width/height)
352 | * @param near The distances to the nearer depth clipping plane. This value must be plus value.
353 | * @param far The distances to the farther depth clipping plane. This value must be plus value.
354 | * @return this
355 | */
356 | Matrix4.prototype.setPerspective = function(fovy, aspect, near, far) {
357 | var e, rd, s, ct;
358 |
359 | if (near === far || aspect === 0) {
360 | throw 'null frustum';
361 | }
362 | if (near <= 0) {
363 | throw 'near <= 0';
364 | }
365 | if (far <= 0) {
366 | throw 'far <= 0';
367 | }
368 |
369 | fovy = Math.PI * fovy / 180 / 2;
370 | s = Math.sin(fovy);
371 | if (s === 0) {
372 | throw 'null frustum';
373 | }
374 |
375 | rd = 1 / (far - near);
376 | ct = Math.cos(fovy) / s;
377 |
378 | e = this.elements;
379 |
380 | e[0] = ct / aspect;
381 | e[1] = 0;
382 | e[2] = 0;
383 | e[3] = 0;
384 |
385 | e[4] = 0;
386 | e[5] = ct;
387 | e[6] = 0;
388 | e[7] = 0;
389 |
390 | e[8] = 0;
391 | e[9] = 0;
392 | e[10] = -(far + near) * rd;
393 | e[11] = -1;
394 |
395 | e[12] = 0;
396 | e[13] = 0;
397 | e[14] = -2 * near * far * rd;
398 | e[15] = 0;
399 |
400 | return this;
401 | };
402 |
403 | /**
404 | * Multiply the perspective projection matrix from the right.
405 | * @param fovy The angle between the upper and lower sides of the frustum.
406 | * @param aspect The aspect ratio of the frustum. (width/height)
407 | * @param near The distances to the nearer depth clipping plane. This value must be plus value.
408 | * @param far The distances to the farther depth clipping plane. This value must be plus value.
409 | * @return this
410 | */
411 | Matrix4.prototype.perspective = function(fovy, aspect, near, far) {
412 | return this.concat(new Matrix4().setPerspective(fovy, aspect, near, far));
413 | };
414 |
415 | /**
416 | * Set the matrix for scaling.
417 | * @param x The scale factor along the X axis
418 | * @param y The scale factor along the Y axis
419 | * @param z The scale factor along the Z axis
420 | * @return this
421 | */
422 | Matrix4.prototype.setScale = function(x, y, z) {
423 | var e = this.elements;
424 | e[0] = x; e[4] = 0; e[8] = 0; e[12] = 0;
425 | e[1] = 0; e[5] = y; e[9] = 0; e[13] = 0;
426 | e[2] = 0; e[6] = 0; e[10] = z; e[14] = 0;
427 | e[3] = 0; e[7] = 0; e[11] = 0; e[15] = 1;
428 | return this;
429 | };
430 |
431 | /**
432 | * Multiply the matrix for scaling from the right.
433 | * @param x The scale factor along the X axis
434 | * @param y The scale factor along the Y axis
435 | * @param z The scale factor along the Z axis
436 | * @return this
437 | */
438 | Matrix4.prototype.scale = function(x, y, z) {
439 | var e = this.elements;
440 | e[0] *= x; e[4] *= y; e[8] *= z;
441 | e[1] *= x; e[5] *= y; e[9] *= z;
442 | e[2] *= x; e[6] *= y; e[10] *= z;
443 | e[3] *= x; e[7] *= y; e[11] *= z;
444 | return this;
445 | };
446 |
447 | /**
448 | * Set the matrix for translation.
449 | * @param x The X value of a translation.
450 | * @param y The Y value of a translation.
451 | * @param z The Z value of a translation.
452 | * @return this
453 | */
454 | Matrix4.prototype.setTranslate = function(x, y, z) {
455 | var e = this.elements;
456 | e[0] = 1; e[4] = 0; e[8] = 0; e[12] = x;
457 | e[1] = 0; e[5] = 1; e[9] = 0; e[13] = y;
458 | e[2] = 0; e[6] = 0; e[10] = 1; e[14] = z;
459 | e[3] = 0; e[7] = 0; e[11] = 0; e[15] = 1;
460 | return this;
461 | };
462 |
463 | /**
464 | * Multiply the matrix for translation from the right.
465 | * @param x The X value of a translation.
466 | * @param y The Y value of a translation.
467 | * @param z The Z value of a translation.
468 | * @return this
469 | */
470 | Matrix4.prototype.translate = function(x, y, z) {
471 | var e = this.elements;
472 | e[12] += e[0] * x + e[4] * y + e[8] * z;
473 | e[13] += e[1] * x + e[5] * y + e[9] * z;
474 | e[14] += e[2] * x + e[6] * y + e[10] * z;
475 | e[15] += e[3] * x + e[7] * y + e[11] * z;
476 | return this;
477 | };
478 |
479 | /**
480 | * Set the matrix for rotation.
481 | * The vector of rotation axis may not be normalized.
482 | * @param angle The angle of rotation (degrees)
483 | * @param x The X coordinate of vector of rotation axis.
484 | * @param y The Y coordinate of vector of rotation axis.
485 | * @param z The Z coordinate of vector of rotation axis.
486 | * @return this
487 | */
488 | Matrix4.prototype.setRotate = function(angle, x, y, z) {
489 | var e, s, c, len, rlen, nc, xy, yz, zx, xs, ys, zs;
490 |
491 | angle = Math.PI * angle / 180;
492 | e = this.elements;
493 |
494 | s = Math.sin(angle);
495 | c = Math.cos(angle);
496 |
497 | if (0 !== x && 0 === y && 0 === z) {
498 | // Rotation around X axis
499 | if (x < 0) {
500 | s = -s;
501 | }
502 | e[0] = 1; e[4] = 0; e[ 8] = 0; e[12] = 0;
503 | e[1] = 0; e[5] = c; e[ 9] =-s; e[13] = 0;
504 | e[2] = 0; e[6] = s; e[10] = c; e[14] = 0;
505 | e[3] = 0; e[7] = 0; e[11] = 0; e[15] = 1;
506 | } else if (0 === x && 0 !== y && 0 === z) {
507 | // Rotation around Y axis
508 | if (y < 0) {
509 | s = -s;
510 | }
511 | e[0] = c; e[4] = 0; e[ 8] = s; e[12] = 0;
512 | e[1] = 0; e[5] = 1; e[ 9] = 0; e[13] = 0;
513 | e[2] =-s; e[6] = 0; e[10] = c; e[14] = 0;
514 | e[3] = 0; e[7] = 0; e[11] = 0; e[15] = 1;
515 | } else if (0 === x && 0 === y && 0 !== z) {
516 | // Rotation around Z axis
517 | if (z < 0) {
518 | s = -s;
519 | }
520 | e[0] = c; e[4] =-s; e[ 8] = 0; e[12] = 0;
521 | e[1] = s; e[5] = c; e[ 9] = 0; e[13] = 0;
522 | e[2] = 0; e[6] = 0; e[10] = 1; e[14] = 0;
523 | e[3] = 0; e[7] = 0; e[11] = 0; e[15] = 1;
524 | } else {
525 | // Rotation around another axis
526 | len = Math.sqrt(x*x + y*y + z*z);
527 | if (len !== 1) {
528 | rlen = 1 / len;
529 | x *= rlen;
530 | y *= rlen;
531 | z *= rlen;
532 | }
533 | nc = 1 - c;
534 | xy = x * y;
535 | yz = y * z;
536 | zx = z * x;
537 | xs = x * s;
538 | ys = y * s;
539 | zs = z * s;
540 |
541 | e[ 0] = x*x*nc + c;
542 | e[ 1] = xy *nc + zs;
543 | e[ 2] = zx *nc - ys;
544 | e[ 3] = 0;
545 |
546 | e[ 4] = xy *nc - zs;
547 | e[ 5] = y*y*nc + c;
548 | e[ 6] = yz *nc + xs;
549 | e[ 7] = 0;
550 |
551 | e[ 8] = zx *nc + ys;
552 | e[ 9] = yz *nc - xs;
553 | e[10] = z*z*nc + c;
554 | e[11] = 0;
555 |
556 | e[12] = 0;
557 | e[13] = 0;
558 | e[14] = 0;
559 | e[15] = 1;
560 | }
561 |
562 | return this;
563 | };
564 |
565 | /**
566 | * Multiply the matrix for rotation from the right.
567 | * The vector of rotation axis may not be normalized.
568 | * @param angle The angle of rotation (degrees)
569 | * @param x The X coordinate of vector of rotation axis.
570 | * @param y The Y coordinate of vector of rotation axis.
571 | * @param z The Z coordinate of vector of rotation axis.
572 | * @return this
573 | */
574 | Matrix4.prototype.rotate = function(angle, x, y, z) {
575 | return this.concat(new Matrix4().setRotate(angle, x, y, z));
576 | };
577 |
578 | /**
579 | * Set the viewing matrix.
580 | * @param eyeX, eyeY, eyeZ The position of the eye point.
581 | * @param centerX, centerY, centerZ The position of the reference point.
582 | * @param upX, upY, upZ The direction of the up vector.
583 | * @return this
584 | */
585 | Matrix4.prototype.setLookAt = function(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ) {
586 | var e, fx, fy, fz, rlf, sx, sy, sz, rls, ux, uy, uz;
587 |
588 | fx = centerX - eyeX;
589 | fy = centerY - eyeY;
590 | fz = centerZ - eyeZ;
591 |
592 | // Normalize f.
593 | rlf = 1 / Math.sqrt(fx*fx + fy*fy + fz*fz);
594 | fx *= rlf;
595 | fy *= rlf;
596 | fz *= rlf;
597 |
598 | // Calculate cross product of f and up.
599 | sx = fy * upZ - fz * upY;
600 | sy = fz * upX - fx * upZ;
601 | sz = fx * upY - fy * upX;
602 |
603 | // Normalize s.
604 | rls = 1 / Math.sqrt(sx*sx + sy*sy + sz*sz);
605 | sx *= rls;
606 | sy *= rls;
607 | sz *= rls;
608 |
609 | // Calculate cross product of s and f.
610 | ux = sy * fz - sz * fy;
611 | uy = sz * fx - sx * fz;
612 | uz = sx * fy - sy * fx;
613 |
614 | // Set to this.
615 | e = this.elements;
616 | e[0] = sx;
617 | e[1] = ux;
618 | e[2] = -fx;
619 | e[3] = 0;
620 |
621 | e[4] = sy;
622 | e[5] = uy;
623 | e[6] = -fy;
624 | e[7] = 0;
625 |
626 | e[8] = sz;
627 | e[9] = uz;
628 | e[10] = -fz;
629 | e[11] = 0;
630 |
631 | e[12] = 0;
632 | e[13] = 0;
633 | e[14] = 0;
634 | e[15] = 1;
635 |
636 | // Translate.
637 | return this.translate(-eyeX, -eyeY, -eyeZ);
638 | };
639 |
640 | /**
641 | * Multiply the viewing matrix from the right.
642 | * @param eyeX, eyeY, eyeZ The position of the eye point.
643 | * @param centerX, centerY, centerZ The position of the reference point.
644 | * @param upX, upY, upZ The direction of the up vector.
645 | * @return this
646 | */
647 | Matrix4.prototype.lookAt = function(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ) {
648 | return this.concat(new Matrix4().setLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ));
649 | };
650 |
651 | /**
652 | * Multiply the matrix for project vertex to plane from the right.
653 | * @param plane The array[A, B, C, D] of the equation of plane "Ax + By + Cz + D = 0".
654 | * @param light The array which stored coordinates of the light. if light[3]=0, treated as parallel light.
655 | * @return this
656 | */
657 | Matrix4.prototype.dropShadow = function(plane, light) {
658 | var mat = new Matrix4();
659 | var e = mat.elements;
660 |
661 | var dot = plane[0] * light[0] + plane[1] * light[1] + plane[2] * light[2] + plane[3] * light[3];
662 |
663 | e[ 0] = dot - light[0] * plane[0];
664 | e[ 1] = - light[1] * plane[0];
665 | e[ 2] = - light[2] * plane[0];
666 | e[ 3] = - light[3] * plane[0];
667 |
668 | e[ 4] = - light[0] * plane[1];
669 | e[ 5] = dot - light[1] * plane[1];
670 | e[ 6] = - light[2] * plane[1];
671 | e[ 7] = - light[3] * plane[1];
672 |
673 | e[ 8] = - light[0] * plane[2];
674 | e[ 9] = - light[1] * plane[2];
675 | e[10] = dot - light[2] * plane[2];
676 | e[11] = - light[3] * plane[2];
677 |
678 | e[12] = - light[0] * plane[3];
679 | e[13] = - light[1] * plane[3];
680 | e[14] = - light[2] * plane[3];
681 | e[15] = dot - light[3] * plane[3];
682 |
683 | return this.concat(mat);
684 | }
685 |
686 | /**
687 | * Multiply the matrix for project vertex to plane from the right.(Projected by parallel light.)
688 | * @param normX, normY, normZ The normal vector of the plane.(Not necessary to be normalized.)
689 | * @param planeX, planeY, planeZ The coordinate of arbitrary points on a plane.
690 | * @param lightX, lightY, lightZ The vector of the direction of light.(Not necessary to be normalized.)
691 | * @return this
692 | */
693 | Matrix4.prototype.dropShadowDirectionally = function(normX, normY, normZ, planeX, planeY, planeZ, lightX, lightY, lightZ) {
694 | var a = planeX * normX + planeY * normY + planeZ * normZ;
695 | return this.dropShadow([normX, normY, normZ, -a], [lightX, lightY, lightZ, 0]);
696 | };
697 |
698 | /**
699 | * Constructor of Vector3
700 | * If opt_src is specified, new vector is initialized by opt_src.
701 | * @param opt_src source vector(option)
702 | */
703 | var Vector3 = function(opt_src) {
704 | var v = new Float32Array(3);
705 | if (opt_src && typeof opt_src === 'object') {
706 | v[0] = opt_src[0]; v[1] = opt_src[1]; v[2] = opt_src[2];
707 | }
708 | this.elements = v;
709 | }
710 |
711 | /**
712 | * Normalize.
713 | * @return this
714 | */
715 | Vector3.prototype.normalize = function() {
716 | var v = this.elements;
717 | var c = v[0], d = v[1], e = v[2], g = Math.sqrt(c*c+d*d+e*e);
718 | if(g){
719 | if(g == 1)
720 | return this;
721 | } else {
722 | v[0] = 0; v[1] = 0; v[2] = 0;
723 | return this;
724 | }
725 | g = 1/g;
726 | v[0] = c*g; v[1] = d*g; v[2] = e*g;
727 | return this;
728 | };
729 |
730 | /**
731 | * Constructor of Vector4
732 | * If opt_src is specified, new vector is initialized by opt_src.
733 | * @param opt_src source vector(option)
734 | */
735 | var Vector4 = function(opt_src) {
736 | var v = new Float32Array(4);
737 | if (opt_src && typeof opt_src === 'object') {
738 | v[0] = opt_src[0]; v[1] = opt_src[1]; v[2] = opt_src[2]; v[3] = opt_src[3];
739 | }
740 | this.elements = v;
741 | }
742 |
--------------------------------------------------------------------------------
/lib/cuon-utils.js:
--------------------------------------------------------------------------------
1 | // cuon-utils.js (c) 2012 kanda and matsuda
2 | /**
3 | * Create a program object and make current
4 | * @param gl GL context
5 | * @param vshader a vertex shader program (string)
6 | * @param fshader a fragment shader program (string)
7 | * @return true, if the program object was created and successfully made current
8 | */
9 | function initShaders(gl, vshader, fshader) {
10 | var program = createProgram(gl, vshader, fshader);
11 | if (!program) {
12 | console.log('Failed to create program');
13 | return false;
14 | }
15 |
16 | gl.useProgram(program);
17 | gl.program = program;
18 |
19 | return true;
20 | }
21 |
22 | /**
23 | * Create the linked program object
24 | * @param gl GL context
25 | * @param vshader a vertex shader program (string)
26 | * @param fshader a fragment shader program (string)
27 | * @return created program object, or null if the creation has failed
28 | */
29 | function createProgram(gl, vshader, fshader) {
30 | // Create shader object
31 | var vertexShader = loadShader(gl, gl.VERTEX_SHADER, vshader);
32 | var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fshader);
33 | if (!vertexShader || !fragmentShader) {
34 | return null;
35 | }
36 |
37 | // Create a program object
38 | var program = gl.createProgram();
39 | if (!program) {
40 | return null;
41 | }
42 |
43 | // Attach the shader objects
44 | gl.attachShader(program, vertexShader);
45 | gl.attachShader(program, fragmentShader);
46 |
47 | // Link the program object
48 | gl.linkProgram(program);
49 |
50 | // Check the result of linking
51 | var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
52 | if (!linked) {
53 | var error = gl.getProgramInfoLog(program);
54 | console.log('Failed to link program: ' + error);
55 | gl.deleteProgram(program);
56 | gl.deleteShader(fragmentShader);
57 | gl.deleteShader(vertexShader);
58 | return null;
59 | }
60 | return program;
61 | }
62 |
63 | /**
64 | * Create a shader object
65 | * @param gl GL context
66 | * @param type the type of the shader object to be created
67 | * @param source shader program (string)
68 | * @return created shader object, or null if the creation has failed.
69 | */
70 | function loadShader(gl, type, source) {
71 | // Create shader object
72 | var shader = gl.createShader(type);
73 | if (shader == null) {
74 | console.log('unable to create shader');
75 | return null;
76 | }
77 |
78 | // Set the shader program
79 | gl.shaderSource(shader, source);
80 |
81 | // Compile the shader
82 | gl.compileShader(shader);
83 |
84 | // Check the result of compilation
85 | var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
86 | if (!compiled) {
87 | var error = gl.getShaderInfoLog(shader);
88 | console.log('Failed to compile shader: ' + error);
89 | gl.deleteShader(shader);
90 | return null;
91 | }
92 |
93 | return shader;
94 | }
95 |
96 | /**
97 | * Initialize and get the rendering for WebGL
98 | * @param canvas element
99 | * @param opt_debug flag to initialize the context for debugging
100 | * @return the rendering context for WebGL
101 | */
102 | function getWebGLContext(canvas, opt_debug) {
103 | // Get the rendering context for WebGL
104 | var gl = WebGLUtils .setupWebGL(canvas);
105 | if (!gl) return null;
106 |
107 | // if opt_debug is explicitly false, create the context for debugging
108 | if (arguments.length < 2 || opt_debug) {
109 | gl = WebGLDebugUtils.makeDebugContext(gl);
110 | }
111 |
112 | return gl;
113 | }
114 |
--------------------------------------------------------------------------------
/lib/objLoader.min.js:
--------------------------------------------------------------------------------
1 | var StringParser=function(b){this.str=null;this.index=0;this.init(b)};StringParser.prototype.init=function(b){this.str=b;this.index=0};StringParser.prototype.skipDelimiters=function(){for(var b=this.index,a=this.str.length;bparseInt(e[0])?c.length+parseInt(e[0]):parseInt(e[0])-1;4>iiii&&console.log(l,"vi",parseInt(e[0]),e,h,h.replace(/^\s+|\s+$/g,""));a.vIndices.push(l)}2<=e.length&&e[1]&&(h=0>parseInt(e[1])?d.length+parseInt(e[1]):parseInt(e[1])-1,a.tIndices.push(h));3<=e.length?(e=0>parseInt(e[2])?g.length+parseInt(e[2]):parseInt(e[2])-1,a.nIndices.push(e)):a.nIndices.push(-1)}4>
8 | iiii&&console.log(a.vIndices,"face.vIndices",c[a.vIndices[0]],c[a.vIndices[1]],c[a.vIndices[2]]);e=[c[a.vIndices[0]].x,c[a.vIndices[0]].y,c[a.vIndices[0]].z];b=[c[a.vIndices[1]].x,c[a.vIndices[1]].y,c[a.vIndices[1]].z];g=[c[a.vIndices[2]].x,c[a.vIndices[2]].y,c[a.vIndices[2]].z];var m,n,f;if(3<=a.tIndices.length){if(!d[a.tIndices[0]])throw console.log("textureVt.length:",d.length,"face.tIndices[0]",a.tIndices,"face.tIndices.length",a.tIndices.length),"hhhh";m=[d[a.tIndices[0]].x,d[a.tIndices[0]].y];
9 | n=[d[a.tIndices[1]].x,d[a.tIndices[1]].y];f=[d[a.tIndices[2]].x,d[a.tIndices[2]].y]}d=calcNormal(e,b,g);null==d&&(4<=a.vIndices.length&&(d=calcNormal(b,g,[c[a.vIndices[3]].x,c[a.vIndices[3]].y,c[a.vIndices[3]].z])),null==d&&(d=[0,1,0]));k&&(d[0]=-d[0],d[1]=-d[1],d[2]=-d[2]);a.normal=new Normal(d[0],d[1],d[2]);a.textureVt=[m,n,f];if(3iiii&&console.log("face.vIndices",a.vIndices)}a.numIndices=a.vIndices.length;iiii++;return a}
11 | function onReadMTLFile(b,a,c,d,g){b=b.split("\n");b.push(null);for(var k=0,h,e="",l=new StringParser;null!=(h=b[k++]);)if(l.init(h),h=l.getWord(),null!=h)switch(h){case "#":continue;case "newmtl":e=a.parseNewmtl(l);continue;case "Kd":""!=e&&(e=a.parseRGB(l,e),a.materials.push(e),e="")}a.complete=!0;a=0;b=!1;for(console.log("modelObject[index]",c[d].mtls);ak;k++)d[k]=b[k]-a[k],g[k]=c[k]-a[k];b=new Float32Array(3);b[0]=d[1]*g[2]-d[2]*g[1];b[1]=d[2]*g[0]-d[0]*g[2];b[2]=d[0]*g[1]-d[1]*g[0];d=new Vector3(b);d.normalize();return d.elements}
15 | function findColor(b,a){for(var c=0;c}
22 | */
23 | var glValidEnumContexts = {
24 |
25 | // Generic setters and getters
26 |
27 | 'enable': { 0:true },
28 | 'disable': { 0:true },
29 | 'getParameter': { 0:true },
30 |
31 | // Rendering
32 |
33 | 'drawArrays': { 0:true },
34 | 'drawElements': { 0:true, 2:true },
35 |
36 | // Shaders
37 |
38 | 'createShader': { 0:true },
39 | 'getShaderParameter': { 1:true },
40 | 'getProgramParameter': { 1:true },
41 |
42 | // Vertex attributes
43 |
44 | 'getVertexAttrib': { 1:true },
45 | 'vertexAttribPointer': { 2:true },
46 |
47 | // Textures
48 |
49 | 'bindTexture': { 0:true },
50 | 'activeTexture': { 0:true },
51 | 'getTexParameter': { 0:true, 1:true },
52 | 'texParameterf': { 0:true, 1:true },
53 | 'texParameteri': { 0:true, 1:true, 2:true },
54 | 'texImage2D': { 0:true, 2:true, 6:true, 7:true },
55 | 'texSubImage2D': { 0:true, 6:true, 7:true },
56 | 'copyTexImage2D': { 0:true, 2:true },
57 | 'copyTexSubImage2D': { 0:true },
58 | 'generateMipmap': { 0:true },
59 |
60 | // Buffer objects
61 |
62 | 'bindBuffer': { 0:true },
63 | 'bufferData': { 0:true, 2:true },
64 | 'bufferSubData': { 0:true },
65 | 'getBufferParameter': { 0:true, 1:true },
66 |
67 | // Renderbuffers and framebuffers
68 |
69 | 'pixelStorei': { 0:true, 1:true },
70 | 'readPixels': { 4:true, 5:true },
71 | 'bindRenderbuffer': { 0:true },
72 | 'bindFramebuffer': { 0:true },
73 | 'checkFramebufferStatus': { 0:true },
74 | 'framebufferRenderbuffer': { 0:true, 1:true, 2:true },
75 | 'framebufferTexture2D': { 0:true, 1:true, 2:true },
76 | 'getFramebufferAttachmentParameter': { 0:true, 1:true, 2:true },
77 | 'getRenderbufferParameter': { 0:true, 1:true },
78 | 'renderbufferStorage': { 0:true, 1:true },
79 |
80 | // Frame buffer operations (clear, blend, depth test, stencil)
81 |
82 | 'clear': { 0:true },
83 | 'depthFunc': { 0:true },
84 | 'blendFunc': { 0:true, 1:true },
85 | 'blendFuncSeparate': { 0:true, 1:true, 2:true, 3:true },
86 | 'blendEquation': { 0:true },
87 | 'blendEquationSeparate': { 0:true, 1:true },
88 | 'stencilFunc': { 0:true },
89 | 'stencilFuncSeparate': { 0:true, 1:true },
90 | 'stencilMaskSeparate': { 0:true },
91 | 'stencilOp': { 0:true, 1:true, 2:true },
92 | 'stencilOpSeparate': { 0:true, 1:true, 2:true, 3:true },
93 |
94 | // Culling
95 |
96 | 'cullFace': { 0:true },
97 | 'frontFace': { 0:true },
98 | };
99 |
100 | /**
101 | * Map of numbers to names.
102 | * @type {Object}
103 | */
104 | var glEnums = null;
105 |
106 | /**
107 | * Initializes this module. Safe to call more than once.
108 | * @param {!WebGLRenderingContext} ctx A WebGL context. If
109 | * you have more than one context it doesn't matter which one
110 | * you pass in, it is only used to pull out constants.
111 | */
112 | function init(ctx) {
113 | if (glEnums == null) {
114 | glEnums = { };
115 | for (var propertyName in ctx) {
116 | if (typeof ctx[propertyName] == 'number') {
117 | glEnums[ctx[propertyName]] = propertyName;
118 | }
119 | }
120 | }
121 | }
122 |
123 | /**
124 | * Checks the utils have been initialized.
125 | */
126 | function checkInit() {
127 | if (glEnums == null) {
128 | throw 'WebGLDebugUtils.init(ctx) not called';
129 | }
130 | }
131 |
132 | /**
133 | * Returns true or false if value matches any WebGL enum
134 | * @param {*} value Value to check if it might be an enum.
135 | * @return {boolean} True if value matches one of the WebGL defined enums
136 | */
137 | function mightBeEnum(value) {
138 | checkInit();
139 | return (glEnums[value] !== undefined);
140 | }
141 |
142 | /**
143 | * Gets an string version of an WebGL enum.
144 | *
145 | * Example:
146 | * var str = WebGLDebugUtil.glEnumToString(ctx.getError());
147 | *
148 | * @param {number} value Value to return an enum for
149 | * @return {string} The string version of the enum.
150 | */
151 | function glEnumToString(value) {
152 | checkInit();
153 | var name = glEnums[value];
154 | return (name !== undefined) ? name :
155 | ("*UNKNOWN WebGL ENUM (0x" + value.toString(16) + ")");
156 | }
157 |
158 | /**
159 | * Returns the string version of a WebGL argument.
160 | * Attempts to convert enum arguments to strings.
161 | * @param {string} functionName the name of the WebGL function.
162 | * @param {number} argumentIndx the index of the argument.
163 | * @param {*} value The value of the argument.
164 | * @return {string} The value as a string.
165 | */
166 | function glFunctionArgToString(functionName, argumentIndex, value) {
167 | var funcInfo = glValidEnumContexts[functionName];
168 | if (funcInfo !== undefined) {
169 | if (funcInfo[argumentIndex]) {
170 | return glEnumToString(value);
171 | }
172 | }
173 | return value.toString();
174 | }
175 |
176 | /**
177 | * Given a WebGL context returns a wrapped context that calls
178 | * gl.getError after every command and calls a function if the
179 | * result is not gl.NO_ERROR.
180 | *
181 | * @param {!WebGLRenderingContext} ctx The webgl context to
182 | * wrap.
183 | * @param {!function(err, funcName, args): void} opt_onErrorFunc
184 | * The function to call when gl.getError returns an
185 | * error. If not specified the default function calls
186 | * console.log with a message.
187 | */
188 | function makeDebugContext(ctx, opt_onErrorFunc) {
189 | init(ctx);
190 | opt_onErrorFunc = opt_onErrorFunc || function(err, functionName, args) {
191 | // apparently we can't do args.join(",");
192 | var argStr = "";
193 | for (var ii = 0; ii < args.length; ++ii) {
194 | argStr += ((ii == 0) ? '' : ', ') +
195 | glFunctionArgToString(functionName, ii, args[ii]);
196 | }
197 | log("WebGL error "+ glEnumToString(err) + " in "+ functionName +
198 | "(" + argStr + ")");
199 | };
200 |
201 | // Holds booleans for each GL error so after we get the error ourselves
202 | // we can still return it to the client app.
203 | var glErrorShadow = { };
204 |
205 | // Makes a function that calls a WebGL function and then calls getError.
206 | function makeErrorWrapper(ctx, functionName) {
207 | return function() {
208 | var result = ctx[functionName].apply(ctx, arguments);
209 | var err = ctx.getError();
210 | if (err != 0) {
211 | glErrorShadow[err] = true;
212 | opt_onErrorFunc(err, functionName, arguments);
213 | }
214 | return result;
215 | };
216 | }
217 |
218 | // Make a an object that has a copy of every property of the WebGL context
219 | // but wraps all functions.
220 | var wrapper = {};
221 | for (var propertyName in ctx) {
222 | if (typeof ctx[propertyName] == 'function') {
223 | wrapper[propertyName] = makeErrorWrapper(ctx, propertyName);
224 | } else {
225 | wrapper[propertyName] = ctx[propertyName];
226 | }
227 | }
228 |
229 | // Override the getError function with one that returns our saved results.
230 | wrapper.getError = function() {
231 | for (var err in glErrorShadow) {
232 | if (glErrorShadow[err]) {
233 | glErrorShadow[err] = false;
234 | return err;
235 | }
236 | }
237 | return ctx.NO_ERROR;
238 | };
239 |
240 | return wrapper;
241 | }
242 |
243 | function resetToInitialState(ctx) {
244 | var numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
245 | var tmp = ctx.createBuffer();
246 | ctx.bindBuffer(ctx.ARRAY_BUFFER, tmp);
247 | for (var ii = 0; ii < numAttribs; ++ii) {
248 | ctx.disableVertexAttribArray(ii);
249 | ctx.vertexAttribPointer(ii, 4, ctx.FLOAT, false, 0, 0);
250 | ctx.vertexAttrib1f(ii, 0);
251 | }
252 | ctx.deleteBuffer(tmp);
253 |
254 | var numTextureUnits = ctx.getParameter(ctx.MAX_TEXTURE_IMAGE_UNITS);
255 | for (var ii = 0; ii < numTextureUnits; ++ii) {
256 | ctx.activeTexture(ctx.TEXTURE0 + ii);
257 | ctx.bindTexture(ctx.TEXTURE_CUBE_MAP, null);
258 | ctx.bindTexture(ctx.TEXTURE_2D, null);
259 | }
260 |
261 | ctx.activeTexture(ctx.TEXTURE0);
262 | ctx.useProgram(null);
263 | ctx.bindBuffer(ctx.ARRAY_BUFFER, null);
264 | ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, null);
265 | ctx.bindFramebuffer(ctx.FRAMEBUFFER, null);
266 | ctx.bindRenderbuffer(ctx.RENDERBUFFER, null);
267 | ctx.disable(ctx.BLEND);
268 | ctx.disable(ctx.CULL_FACE);
269 | ctx.disable(ctx.DEPTH_TEST);
270 | ctx.disable(ctx.DITHER);
271 | ctx.disable(ctx.SCISSOR_TEST);
272 | ctx.blendColor(0, 0, 0, 0);
273 | ctx.blendEquation(ctx.FUNC_ADD);
274 | ctx.blendFunc(ctx.ONE, ctx.ZERO);
275 | ctx.clearColor(0, 0, 0, 0);
276 | ctx.clearDepth(1);
277 | ctx.clearStencil(-1);
278 | ctx.colorMask(true, true, true, true);
279 | ctx.cullFace(ctx.BACK);
280 | ctx.depthFunc(ctx.LESS);
281 | ctx.depthMask(true);
282 | ctx.depthRange(0, 1);
283 | ctx.frontFace(ctx.CCW);
284 | ctx.hint(ctx.GENERATE_MIPMAP_HINT, ctx.DONT_CARE);
285 | ctx.lineWidth(1);
286 | ctx.pixelStorei(ctx.PACK_ALIGNMENT, 4);
287 | ctx.pixelStorei(ctx.UNPACK_ALIGNMENT, 4);
288 | ctx.pixelStorei(ctx.UNPACK_FLIP_Y_WEBGL, false);
289 | ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
290 | // TODO: Delete this IF.
291 | if (ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL) {
292 | ctx.pixelStorei(ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL, ctx.BROWSER_DEFAULT_WEBGL);
293 | }
294 | ctx.polygonOffset(0, 0);
295 | ctx.sampleCoverage(1, false);
296 | ctx.scissor(0, 0, ctx.canvas.width, ctx.canvas.height);
297 | ctx.stencilFunc(ctx.ALWAYS, 0, 0xFFFFFFFF);
298 | ctx.stencilMask(0xFFFFFFFF);
299 | ctx.stencilOp(ctx.KEEP, ctx.KEEP, ctx.KEEP);
300 | ctx.viewport(0, 0, ctx.canvas.clientWidth, ctx.canvas.clientHeight);
301 | ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT | ctx.STENCIL_BUFFER_BIT);
302 |
303 | // TODO: This should NOT be needed but Firefox fails with 'hint'
304 | while(ctx.getError());
305 | }
306 |
307 | function makeLostContextSimulatingContext(ctx) {
308 | var wrapper_ = {};
309 | var contextId_ = 1;
310 | var contextLost_ = false;
311 | var resourceId_ = 0;
312 | var resourceDb_ = [];
313 | var onLost_ = undefined;
314 | var onRestored_ = undefined;
315 | var nextOnRestored_ = undefined;
316 |
317 | // Holds booleans for each GL error so can simulate errors.
318 | var glErrorShadow_ = { };
319 |
320 | function isWebGLObject(obj) {
321 | //return false;
322 | return (obj instanceof WebGLBuffer ||
323 | obj instanceof WebGLFramebuffer ||
324 | obj instanceof WebGLProgram ||
325 | obj instanceof WebGLRenderbuffer ||
326 | obj instanceof WebGLShader ||
327 | obj instanceof WebGLTexture);
328 | }
329 |
330 | function checkResources(args) {
331 | for (var ii = 0; ii < args.length; ++ii) {
332 | var arg = args[ii];
333 | if (isWebGLObject(arg)) {
334 | return arg.__webglDebugContextLostId__ == contextId_;
335 | }
336 | }
337 | return true;
338 | }
339 |
340 | function clearErrors() {
341 | var k = Object.keys(glErrorShadow_);
342 | for (var ii = 0; ii < k.length; ++ii) {
343 | delete glErrorShdow_[k];
344 | }
345 | }
346 |
347 | // Makes a function that simulates WebGL when out of context.
348 | function makeLostContextWrapper(ctx, functionName) {
349 | var f = ctx[functionName];
350 | return function() {
351 | // Only call the functions if the context is not lost.
352 | if (!contextLost_) {
353 | if (!checkResources(arguments)) {
354 | glErrorShadow_[ctx.INVALID_OPERATION] = true;
355 | return;
356 | }
357 | var result = f.apply(ctx, arguments);
358 | return result;
359 | }
360 | };
361 | }
362 |
363 | for (var propertyName in ctx) {
364 | if (typeof ctx[propertyName] == 'function') {
365 | wrapper_[propertyName] = makeLostContextWrapper(ctx, propertyName);
366 | } else {
367 | wrapper_[propertyName] = ctx[propertyName];
368 | }
369 | }
370 |
371 | function makeWebGLContextEvent(statusMessage) {
372 | return {statusMessage: statusMessage};
373 | }
374 |
375 | function freeResources() {
376 | for (var ii = 0; ii < resourceDb_.length; ++ii) {
377 | var resource = resourceDb_[ii];
378 | if (resource instanceof WebGLBuffer) {
379 | ctx.deleteBuffer(resource);
380 | } else if (resource instanceof WebctxFramebuffer) {
381 | ctx.deleteFramebuffer(resource);
382 | } else if (resource instanceof WebctxProgram) {
383 | ctx.deleteProgram(resource);
384 | } else if (resource instanceof WebctxRenderbuffer) {
385 | ctx.deleteRenderbuffer(resource);
386 | } else if (resource instanceof WebctxShader) {
387 | ctx.deleteShader(resource);
388 | } else if (resource instanceof WebctxTexture) {
389 | ctx.deleteTexture(resource);
390 | }
391 | }
392 | }
393 |
394 | wrapper_.loseContext = function() {
395 | if (!contextLost_) {
396 | contextLost_ = true;
397 | ++contextId_;
398 | while (ctx.getError());
399 | clearErrors();
400 | glErrorShadow_[ctx.CONTEXT_LOST_WEBGL] = true;
401 | setTimeout(function() {
402 | if (onLost_) {
403 | onLost_(makeWebGLContextEvent("context lost"));
404 | }
405 | }, 0);
406 | }
407 | };
408 |
409 | wrapper_.restoreContext = function() {
410 | if (contextLost_) {
411 | if (onRestored_) {
412 | setTimeout(function() {
413 | freeResources();
414 | resetToInitialState(ctx);
415 | contextLost_ = false;
416 | if (onRestored_) {
417 | var callback = onRestored_;
418 | onRestored_ = nextOnRestored_;
419 | nextOnRestored_ = undefined;
420 | callback(makeWebGLContextEvent("context restored"));
421 | }
422 | }, 0);
423 | } else {
424 | throw "You can not restore the context without a listener"
425 | }
426 | }
427 | };
428 |
429 | // Wrap a few functions specially.
430 | wrapper_.getError = function() {
431 | if (!contextLost_) {
432 | var err;
433 | while (err = ctx.getError()) {
434 | glErrorShadow_[err] = true;
435 | }
436 | }
437 | for (var err in glErrorShadow_) {
438 | if (glErrorShadow_[err]) {
439 | delete glErrorShadow_[err];
440 | return err;
441 | }
442 | }
443 | return ctx.NO_ERROR;
444 | };
445 |
446 | var creationFunctions = [
447 | "createBuffer",
448 | "createFramebuffer",
449 | "createProgram",
450 | "createRenderbuffer",
451 | "createShader",
452 | "createTexture"
453 | ];
454 | for (var ii = 0; ii < creationFunctions.length; ++ii) {
455 | var functionName = creationFunctions[ii];
456 | wrapper_[functionName] = function(f) {
457 | return function() {
458 | if (contextLost_) {
459 | return null;
460 | }
461 | var obj = f.apply(ctx, arguments);
462 | obj.__webglDebugContextLostId__ = contextId_;
463 | resourceDb_.push(obj);
464 | return obj;
465 | };
466 | }(ctx[functionName]);
467 | }
468 |
469 | var functionsThatShouldReturnNull = [
470 | "getActiveAttrib",
471 | "getActiveUniform",
472 | "getBufferParameter",
473 | "getContextAttributes",
474 | "getAttachedShaders",
475 | "getFramebufferAttachmentParameter",
476 | "getParameter",
477 | "getProgramParameter",
478 | "getProgramInfoLog",
479 | "getRenderbufferParameter",
480 | "getShaderParameter",
481 | "getShaderInfoLog",
482 | "getShaderSource",
483 | "getTexParameter",
484 | "getUniform",
485 | "getUniformLocation",
486 | "getVertexAttrib"
487 | ];
488 | for (var ii = 0; ii < functionsThatShouldReturnNull.length; ++ii) {
489 | var functionName = functionsThatShouldReturnNull[ii];
490 | wrapper_[functionName] = function(f) {
491 | return function() {
492 | if (contextLost_) {
493 | return null;
494 | }
495 | return f.apply(ctx, arguments);
496 | }
497 | }(wrapper_[functionName]);
498 | }
499 |
500 | var isFunctions = [
501 | "isBuffer",
502 | "isEnabled",
503 | "isFramebuffer",
504 | "isProgram",
505 | "isRenderbuffer",
506 | "isShader",
507 | "isTexture"
508 | ];
509 | for (var ii = 0; ii < isFunctions.length; ++ii) {
510 | var functionName = isFunctions[ii];
511 | wrapper_[functionName] = function(f) {
512 | return function() {
513 | if (contextLost_) {
514 | return false;
515 | }
516 | return f.apply(ctx, arguments);
517 | }
518 | }(wrapper_[functionName]);
519 | }
520 |
521 | wrapper_.checkFramebufferStatus = function(f) {
522 | return function() {
523 | if (contextLost_) {
524 | return ctx.FRAMEBUFFER_UNSUPPORTED;
525 | }
526 | return f.apply(ctx, arguments);
527 | };
528 | }(wrapper_.checkFramebufferStatus);
529 |
530 | wrapper_.getAttribLocation = function(f) {
531 | return function() {
532 | if (contextLost_) {
533 | return -1;
534 | }
535 | return f.apply(ctx, arguments);
536 | };
537 | }(wrapper_.getAttribLocation);
538 |
539 | wrapper_.getVertexAttribOffset = function(f) {
540 | return function() {
541 | if (contextLost_) {
542 | return 0;
543 | }
544 | return f.apply(ctx, arguments);
545 | };
546 | }(wrapper_.getVertexAttribOffset);
547 |
548 | wrapper_.isContextLost = function() {
549 | return contextLost_;
550 | };
551 |
552 | function wrapEvent(listener) {
553 | if (typeof(listener) == "function") {
554 | return listener;
555 | } else {
556 | return function(info) {
557 | listener.handleEvent(info);
558 | }
559 | }
560 | }
561 |
562 | wrapper_.registerOnContextLostListener = function(listener) {
563 | onLost_ = wrapEvent(listener);
564 | };
565 |
566 | wrapper_.registerOnContextRestoredListener = function(listener) {
567 | if (contextLost_) {
568 | nextOnRestored_ = wrapEvent(listener);
569 | } else {
570 | onRestored_ = wrapEvent(listener);
571 | }
572 | }
573 |
574 | return wrapper_;
575 | }
576 |
577 | return {
578 | /**
579 | * Initializes this module. Safe to call more than once.
580 | * @param {!WebGLRenderingContext} ctx A WebGL context. If
581 | * you have more than one context it doesn't matter which one
582 | * you pass in, it is only used to pull out constants.
583 | */
584 | 'init': init,
585 |
586 | /**
587 | * Returns true or false if value matches any WebGL enum
588 | * @param {*} value Value to check if it might be an enum.
589 | * @return {boolean} True if value matches one of the WebGL defined enums
590 | */
591 | 'mightBeEnum': mightBeEnum,
592 |
593 | /**
594 | * Gets an string version of an WebGL enum.
595 | *
596 | * Example:
597 | * WebGLDebugUtil.init(ctx);
598 | * var str = WebGLDebugUtil.glEnumToString(ctx.getError());
599 | *
600 | * @param {number} value Value to return an enum for
601 | * @return {string} The string version of the enum.
602 | */
603 | 'glEnumToString': glEnumToString,
604 |
605 | /**
606 | * Converts the argument of a WebGL function to a string.
607 | * Attempts to convert enum arguments to strings.
608 | *
609 | * Example:
610 | * WebGLDebugUtil.init(ctx);
611 | * var str = WebGLDebugUtil.glFunctionArgToString('bindTexture', 0, gl.TEXTURE_2D);
612 | *
613 | * would return 'TEXTURE_2D'
614 | *
615 | * @param {string} functionName the name of the WebGL function.
616 | * @param {number} argumentIndx the index of the argument.
617 | * @param {*} value The value of the argument.
618 | * @return {string} The value as a string.
619 | */
620 | 'glFunctionArgToString': glFunctionArgToString,
621 |
622 | /**
623 | * Given a WebGL context returns a wrapped context that calls
624 | * gl.getError after every command and calls a function if the
625 | * result is not NO_ERROR.
626 | *
627 | * You can supply your own function if you want. For example, if you'd like
628 | * an exception thrown on any GL error you could do this
629 | *
630 | * function throwOnGLError(err, funcName, args) {
631 | * throw WebGLDebugUtils.glEnumToString(err) + " was caused by call to" +
632 | * funcName;
633 | * };
634 | *
635 | * ctx = WebGLDebugUtils.makeDebugContext(
636 | * canvas.getContext("webgl"), throwOnGLError);
637 | *
638 | * @param {!WebGLRenderingContext} ctx The webgl context to wrap.
639 | * @param {!function(err, funcName, args): void} opt_onErrorFunc The function
640 | * to call when gl.getError returns an error. If not specified the default
641 | * function calls console.log with a message.
642 | */
643 | 'makeDebugContext': makeDebugContext,
644 |
645 | /**
646 | * Given a WebGL context returns a wrapped context that adds 4
647 | * functions.
648 | *
649 | * ctx.loseContext:
650 | * simulates a lost context event.
651 | *
652 | * ctx.restoreContext:
653 | * simulates the context being restored.
654 | *
655 | * ctx.registerOnContextLostListener(listener):
656 | * lets you register a listener for context lost. Use instead
657 | * of addEventListener('webglcontextlostevent', listener);
658 | *
659 | * ctx.registerOnContextRestoredListener(listener):
660 | * lets you register a listener for context restored. Use
661 | * instead of addEventListener('webglcontextrestored',
662 | * listener);
663 | *
664 | * @param {!WebGLRenderingContext} ctx The webgl context to wrap.
665 | */
666 | 'makeLostContextSimulatingContext': makeLostContextSimulatingContext,
667 |
668 | /**
669 | * Resets a context to the initial state.
670 | * @param {!WebGLRenderingContext} ctx The webgl context to
671 | * reset.
672 | */
673 | 'resetToInitialState': resetToInitialState
674 | };
675 |
676 | }();
677 |
678 |
--------------------------------------------------------------------------------
/lib/webgl-utils.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010, Google Inc.
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are
7 | * met:
8 | *
9 | * * Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * * Redistributions in binary form must reproduce the above
12 | * copyright notice, this list of conditions and the following disclaimer
13 | * in the documentation and/or other materials provided with the
14 | * distribution.
15 | * * Neither the name of Google Inc. nor the names of its
16 | * contributors may be used to endorse or promote products derived from
17 | * this software without specific prior written permission.
18 | *
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | */
31 |
32 |
33 | /**
34 | * @fileoverview This file contains functions every webgl program will need
35 | * a version of one way or another.
36 | *
37 | * Instead of setting up a context manually it is recommended to
38 | * use. This will check for success or failure. On failure it
39 | * will attempt to present an approriate message to the user.
40 | *
41 | * gl = WebGLUtils.setupWebGL(canvas);
42 | *
43 | * For animated WebGL apps use of setTimeout or setInterval are
44 | * discouraged. It is recommended you structure your rendering
45 | * loop like this.
46 | *
47 | * function render() {
48 | * window.requestAnimationFrame(render, canvas);
49 | *
50 | * // do rendering
51 | * ...
52 | * }
53 | * render();
54 | *
55 | * This will call your rendering function up to the refresh rate
56 | * of your display but will stop rendering if your app is not
57 | * visible.
58 | */
59 |
60 | WebGLUtils = function() {
61 |
62 | /**
63 | * Creates the HTLM for a failure message
64 | * @param {string} canvasContainerId id of container of th
65 | * canvas.
66 | * @return {string} The html.
67 | */
68 | var makeFailHTML = function(msg) {
69 | return '' +
70 | '
' + msg + '
';
71 | return '' +
72 | '
' +
73 | '
' +
74 | '
' +
75 | '
' + msg + '
' +
76 | '
' +
77 | '
';
78 | };
79 |
80 | /**
81 | * Mesasge for getting a webgl browser
82 | * @type {string}
83 | */
84 | var GET_A_WEBGL_BROWSER = '' +
85 | 'This page requires a browser that supports WebGL. ' +
86 | 'Click here to upgrade your browser.';
87 |
88 | /**
89 | * Mesasge for need better hardware
90 | * @type {string}
91 | */
92 | var OTHER_PROBLEM = '' +
93 | "It doesn't appear your computer can support WebGL. " +
94 | 'Click here for more information.';
95 |
96 | /**
97 | * Creates a webgl context. If creation fails it will
98 | * change the contents of the container of the