1 | // |
---|
2 | // Lol Engine - Xolotl algorithm test |
---|
3 | // |
---|
4 | // Copyright: (c) 2011 Soren Renner |
---|
5 | // (c) 2011 Sam Hocevar <sam@hocevar.net> |
---|
6 | // This program is free software; you can redistribute it and/or |
---|
7 | // modify it under the terms of the Do What The Fuck You Want To |
---|
8 | // Public License, Version 2, as published by Sam Hocevar. See |
---|
9 | // http://sam.zoy.org/projects/COPYING.WTFPL for more details. |
---|
10 | // |
---|
11 | |
---|
12 | using namespace lol; |
---|
13 | |
---|
14 | struct Voxel |
---|
15 | { |
---|
16 | bool passable, lock, copymarker; |
---|
17 | struct Voxel *imposter; |
---|
18 | }; |
---|
19 | |
---|
20 | struct MSV : public Voxel |
---|
21 | { |
---|
22 | }; |
---|
23 | |
---|
24 | struct Ray |
---|
25 | { |
---|
26 | float theta, phi; |
---|
27 | vec3 origin, xyz, dxyz, ddxyz, lxyz, popdelta; |
---|
28 | struct Voxel *terminalvoxel; |
---|
29 | bool terminate; |
---|
30 | ivec3 counter; |
---|
31 | int scale; |
---|
32 | float length; |
---|
33 | bool di, dj, dk, changed, traced, far; |
---|
34 | int face; |
---|
35 | vec3 normal, bloxnorm, corner; |
---|
36 | int dtl; |
---|
37 | }; |
---|
38 | |
---|
39 | template <int M> struct Cell : public MSV |
---|
40 | { |
---|
41 | Voxel blox[M * M * M]; |
---|
42 | vec3 bloxnorm[M * M * M]; |
---|
43 | int m; |
---|
44 | |
---|
45 | void Serp(Voxel v, Voxel w) |
---|
46 | { |
---|
47 | for (int i = 0; i < M; i++) |
---|
48 | for (int j = 0; j < M; j++) |
---|
49 | for (int k = 0; k < M; k++) |
---|
50 | if ((i == M_2) + (j == M_2) + (k == M_2) >= 2) |
---|
51 | blox[(i * M + j) * M + k] = v; |
---|
52 | else |
---|
53 | blox[(i * M + j) * M + k] = w; |
---|
54 | } |
---|
55 | |
---|
56 | static const int M_2 = M / 2; |
---|
57 | }; |
---|
58 | |
---|