1
//====================================================================================
2
// Auto-generated code. Original source + changes are
3
// sphere flake bvh raytracer (c) 2005, thierry berger-perrin <tbptbp@gmail.com>
4
// (c) 2010, azakai (Emscripten)
5
// this code is released under the GNU Public License.
7
// Optimized using Closure Compiler
8
//====================================================================================
20
b = "Assertion failed: " + b;
21
print(b + ":\n" + Error().stack);
22
throw"Assertion: " + b;
30
if(!g || g.length === undefined || typeof g === "function") {
33
return g.map(d).reduce(function(i, j) {
42
c = [_malloc, aa, u][c ? c : ALLOC_STATIC](Math.max(a.length - b, 1));
43
for(var e = 0;e < a.length - b;e++) {
45
if(typeof h === "number" || typeof h === "boolean") {
56
for(var b = "", c = 0, d;;) {
57
if(a.d + c >= a.e.length) {
60
d = String.fromCharCode(a.e[a.d + c]);
74
__Znwm = __Znam = __Znaj = __Znwj = _malloc;
75
__ZdaPv = __ZdlPv = _free;
78
this.TOTAL_MEMORY || (TOTAL_MEMORY = 52428800);
80
IHEAP = new Int32Array(TOTAL_MEMORY);
81
for(var a = 0;a < HEAP.length;a++) {
87
FHEAP = this.Float64Array ? new Float64Array(TOTAL_MEMORY) : HEAP;
88
STACK_ROOT = STACKTOP = Math.ceil(10 / PAGE_SIZE) * PAGE_SIZE;
89
this.TOTAL_STACK || (TOTAL_STACK = 1048576);
90
STACK_MAX = STACK_ROOT + TOTAL_STACK;
91
STATICTOP = Math.ceil(STACK_MAX / PAGE_SIZE) * PAGE_SIZE
93
function ja(a, b, c) {
94
for(var d = 0;d < c;d++) {
95
HEAP[a + d] = HEAP[b + d];
96
IHEAP[a + d] = IHEAP[b + d];
97
FHEAP[a + d] = FHEAP[b + d]
100
_llvm_memcpy_p0i8_p0i8_i32 = _llvm_memcpy_i64 = ja;
101
_llvm_memset_p0i8_i32 = function(a, b, c) {
102
for(var d = 0;d < c;d++) {
103
HEAP[a + d] = IHEAP[a + d] = FHEAP[a + d] = b
108
for(var b = [], c = 0;c < a.length;) {
109
b.push(a.charCodeAt(c));
119
STACKTOP = Math.ceil(STACKTOP / 4) * 4;
120
q(STACKTOP < STACK_ROOT + STACK_MAX);
127
STATICTOP = Math.ceil(STATICTOP / 4) * 4;
130
var ka = [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 15, 16];
131
this.__defineGetter__("_screen", function() {
133
return _screen = r([0], 0, ALLOC_STATIC)
135
this.__defineGetter__("__ZStL8__ioinit", function() {
136
delete __ZStL8__ioinit;
137
return __ZStL8__ioinit = r([0], 0, ALLOC_STATIC)
140
this.__defineGetter__("__ZL5light", function() {
142
return __ZL5light = r([0, 0, 0], 0, ALLOC_STATIC)
144
this.__defineGetter__("__ZL4pool", function() {
146
return __ZL4pool = r([0], 0, ALLOC_STATIC)
148
this.__defineGetter__("__ZL3end", function() {
150
return __ZL3end = r([0], 0, ALLOC_STATIC)
152
this.__defineGetter__("__ZL4grid", function() {
154
return __ZL4grid = r([[-1, -0.3333333333333333], [0.3333333333333333, -1], [-0.3333333333333333, 1], [1, 0.3333333333333333]], 0, ALLOC_STATIC)
160
__ZNSt8ios_base4InitC1Ev = function() {
164
___cxa_atexit = function(a) {
167
__ZNSt8ios_base4InitD1Ev = function() {
173
_SDL_LockSurface = function(a) {
174
var b = SDL_SURFACES[a];
175
b.a = b.c.getImageData(0, 0, b.width, b.height);
176
for(var c = b.a.data.length, d = 0;d < c;d++) {
177
IHEAP[b.b + d] = b.a.data[d]
181
_SDL_UnlockSurface = function(a) {
183
for(var b = a.a.data.length, c = 0;c < b;c++) {
184
a.a.data[c] = IHEAP[a.b + c]
186
for(c = 0;c < b / 4;c++) {
187
a.a.data[c * 4 + 3] = 255
189
a.c.putImageData(a.a, 0, 0);
193
_SDL_Init = function() {
197
_SDL_SetVideoMode = function(a, b, c, d, e) {
199
SDL_SURFACES[c] = {width:a, height:b, canvas:e, c:e.getContext("2d"), g:c, b:_malloc(a * b * 4)};
203
_SDL_Quit = function() {
209
FUNCTION_TABLE[0] = B;
210
FUNCTION_TABLE[1] = function(a, b) {
213
FUNCTION_TABLE[2] = l();
215
return FHEAP[a] < FHEAP[b] ? b : a
217
FUNCTION_TABLE[3] = E;
219
return IHEAP[a] < IHEAP[b] ? b : a
221
FUNCTION_TABLE[4] = F;
223
FUNCTION_TABLE[5] = function() {
224
__ZNSt8ios_base4InitD1Ev(__ZStL8__ioinit)
226
function G(a, b, c, d) {
231
FUNCTION_TABLE[6] = G;
232
function H(a, b, c) {
233
G(a, FHEAP[b] + FHEAP[c], FHEAP[b + 1] + FHEAP[c + 1], FHEAP[b + 2] + FHEAP[c + 2])
235
FUNCTION_TABLE[7] = H;
236
function I(a, b, c) {
237
G(a, FHEAP[b] - FHEAP[c], FHEAP[b + 1] - FHEAP[c + 1], FHEAP[b + 2] - FHEAP[c + 2])
239
FUNCTION_TABLE[8] = I;
241
G(a, 0 - FHEAP[b], 0 - FHEAP[b + 1], 0 - FHEAP[b + 2])
243
FUNCTION_TABLE[9] = J;
244
function K(a, b, c) {
245
G(a, FHEAP[b] * c, FHEAP[b + 1] * c, FHEAP[b + 2] * c)
247
FUNCTION_TABLE[10] = K;
248
function L(a, b, c) {
249
G(a, FHEAP[b + 1] * FHEAP[c + 2] - FHEAP[b + 2] * FHEAP[c + 1], FHEAP[b + 2] * FHEAP[c] - FHEAP[b] * FHEAP[c + 2], FHEAP[b] * FHEAP[c + 1] - FHEAP[b + 1] * FHEAP[c])
251
FUNCTION_TABLE[11] = L;
253
return FHEAP[a] * FHEAP[b] + FHEAP[a + 1] * FHEAP[b + 1] + FHEAP[a + 2] * FHEAP[b + 2]
255
FUNCTION_TABLE[12] = M;
258
FHEAP[a + 1] = FHEAP[b + 1];
259
FHEAP[a + 2] = FHEAP[b + 2]
261
FUNCTION_TABLE[13] = P;
262
function Q(a, b, c) {
264
FHEAP[a + 1] = FHEAP[b + 1];
265
FHEAP[a + 2] = FHEAP[b + 2];
268
FHEAP[a + 1] = FHEAP[c + 1];
269
FHEAP[a + 2] = FHEAP[c + 2]
271
FUNCTION_TABLE[14] = Q;
274
FHEAP[a + 3] = Infinity
276
FUNCTION_TABLE[15] = R;
277
FUNCTION_TABLE[16] = l();
278
function S(a, b, c) {
280
FHEAP[a + 1] = FHEAP[b + 1];
281
FHEAP[a + 2] = FHEAP[b + 2];
284
FUNCTION_TABLE[17] = S;
285
function T(a, b, c) {
288
var e = 1 / FHEAP[b + 3];
293
FUNCTION_TABLE[18] = T;
294
FUNCTION_TABLE[19] = l();
295
function U(a, b, c, d) {
297
FHEAP[a + 1] = FHEAP[b + 1];
298
FHEAP[a + 2] = FHEAP[b + 2];
299
FHEAP[a + 3] = FHEAP[b + 3];
302
FHEAP[b + 1] = FHEAP[c + 1];
303
FHEAP[b + 2] = FHEAP[c + 2];
304
FHEAP[b + 3] = FHEAP[c + 3];
307
FUNCTION_TABLE[20] = U;
311
var d = c + 3, e = c + 6, h = c + 9;
313
if((FHEAP[d] * FHEAP[d] != 1 != 0 & FHEAP[d + 1] * FHEAP[d + 1] != 1 != 0 & FHEAP[d + 2] * FHEAP[d + 2] != 1) != 0) {
316
FHEAP[g + 1] = FHEAP[d + 1];
317
FHEAP[g + 2] = FHEAP[d + 2];
318
if(FHEAP[d + 1] * FHEAP[d + 1] > FHEAP[d] * FHEAP[d]) {
319
if(FHEAP[d + 1] * FHEAP[d + 1] > FHEAP[d + 2] * FHEAP[d + 2]) {
320
FHEAP[a + 3 + 1] = 0 - FHEAP[a + 3 + 1]
322
FHEAP[a + 3 + 2] = 0 - FHEAP[a + 3 + 2]
325
if(FHEAP[d + 2] * FHEAP[d + 2] > FHEAP[d] * FHEAP[d]) {
326
FHEAP[a + 3 + 2] = 0 - FHEAP[a + 3 + 2]
328
FHEAP[a + 3] = 0 - FHEAP[a + 3]
332
G(c, FHEAP[d + 2], FHEAP[d], FHEAP[d + 1]);
335
FHEAP[g + 1] = FHEAP[c + 1];
336
FHEAP[g + 2] = FHEAP[c + 2]
339
FHEAP[a + 1] = FHEAP[d + 1];
340
FHEAP[a + 2] = FHEAP[d + 2];
344
FHEAP[d + 1] = FHEAP[e + 1];
345
FHEAP[d + 2] = FHEAP[e + 2];
349
FHEAP[e + 1] = FHEAP[h + 1];
350
FHEAP[e + 2] = FHEAP[h + 2];
353
FUNCTION_TABLE[21] = V;
357
FUNCTION_TABLE[22] = X;
359
var c = 1 / _sqrt(X(b));
362
FUNCTION_TABLE[23] = W;
372
__ZNSt8ios_base4InitC1Ev(__ZStL8__ioinit);
373
___cxa_atexit(ma, 0, la);
374
G(c, -0.5, -0.65, 0.9);
380
FUNCTION_TABLE[24] = C;
387
e = d * d - X(c) + FHEAP[a + 3] * FHEAP[a + 3];
397
d = d = d > 0 ? d : e
404
FUNCTION_TABLE[25] = Y;
408
var d = c + 3, e, h, g = c + 6;
409
h = IHEAP[__ZL4pool];
411
if(!(h < IHEAP[__ZL3end])) {
414
e = Y(h, a) >= FHEAP[b + 3];
416
h += 9 * IHEAP[h + 8]
419
if(FHEAP[b + 3] > e) {
426
FHEAP[e + 1] = FHEAP[g + 1];
427
FHEAP[e + 2] = FHEAP[g + 2]
434
FUNCTION_TABLE[26] = Z;
437
e = IHEAP[__ZL4pool];
439
if(!(e < IHEAP[__ZL3end])) {
443
d = Y(e, a) >= FHEAP[b + 3];
445
e += 9 * IHEAP[e + 8]
448
if(FHEAP[b + 3] > h) {
459
FUNCTION_TABLE[27] = na;
465
var e = c + 6, h = c + 9, g = c + 12, i = c + 15, j, k = c + 19, n = c + 25;
468
j = FHEAP[i + 3] != Infinity ? 0 - M(i, __ZL5light) : 0;
474
K(c, b + 3, FHEAP[i + 3]);
480
d = d = FHEAP[n + 3] == Infinity ? j : 0
486
FUNCTION_TABLE[28] = oa;
487
function $(a, b, c, d, e, h) {
490
var i = g + 3, j = g + 6, k = g + 9, n = g + 12, s = g + 15, ca = g + 18, y = g + 21, v = g + 24, da = g + 27, ea = g + 30, fa = g + 33, ga = g + 36, ha = g + 39, t = g + 42, p = g + 43, D, z = g + 44, w = g + 48, A = g + 52, N = g + 61, O = g + 64;
503
IHEAP[t] = Math.floor((c - 9) / 9);
522
a = $(a, b - 1, c, v, N, t);
523
p += 1.0471975511965976;
526
p -= 0.3490658503988659;
542
a = $(a, b - 1, c, i, O, t);
543
p += 2.0943951023931953;
551
FUNCTION_TABLE[29] = $;
552
function pa(a, b, c) {
557
var g = d + 9, i = d + 10, j = d + 11, k = d + 17, n = d + 29, s = d + 32;
577
G(e, FHEAP[__ZL4grid + b * 2] * 0.5 + FHEAP[g] / -2, FHEAP[__ZL4grid + b * 2 + 1] * 0.5 + FHEAP[i] / -2, 0);
580
FHEAP[h + 1] = FHEAP[e + 1];
581
FHEAP[h + 2] = FHEAP[e + 2];
584
G(n, 0, c, FHEAP[E(g, i)]);
585
_SDL_LockSurface(IHEAP[_screen]);
600
FHEAP[i + 1] = FHEAP[s + 1];
601
FHEAP[i + 2] = FHEAP[s + 2];
602
e = oa(IHEAP[__ZL4pool], j) + e;
610
IHEAP[IHEAP[IHEAP[_screen] + ka[5]] + Math.floor((a - FHEAP[n + 1]) * a * 4 + FHEAP[n] * 4) + g] = Math.floor(e * 64);
616
_SDL_UnlockSurface(IHEAP[_screen]);
619
FUNCTION_TABLE[30] = pa;
623
var d = c + 3, e = c + 6, h, g, i, j = c + 9, k = c + 10;
626
g = Math.floor(Number(ba(IHEAP[b + 1])));
645
g = i = __Znaj(h * 68);
654
IHEAP[__ZL4pool] = i;
655
IHEAP[__ZL3end] = IHEAP[__ZL4pool] + 9 * k;
659
$(IHEAP[__ZL4pool], j, k, c, e, 1);
662
d = _SDL_SetVideoMode(512, 512, 32, 0);
675
FUNCTION_TABLE[31] = qa;
678
for(var h = 0;h < 0;h++) {
683
var c = a.length + 1, d = [r(x("/bin/this.program"), null)];
685
for(var e = 0;e < c - 1;e += 1) {
686
d.push(r(x(a[e]), null));
691
for(qa(c, d);o.length > 0;) {
693
if(typeof a === "number") {
694
a = FUNCTION_TABLE[a]
701
__ZL10trace_lineiii = pa;