diff options
Diffstat (limited to '')
-rw-r--r-- | src/libraries/LumbrJack.c | 2 | ||||
-rw-r--r-- | src/libraries/evas_3d_utils.h (renamed from src/extantz/evas_3d_utils.h) | 0 | ||||
-rw-r--r-- | src/libraries/evas_macros.h | 217 | ||||
-rw-r--r-- | src/libraries/love.h (renamed from src/love/love.h) | 36 | ||||
-rw-r--r-- | src/libraries/winFang.h | 3 |
5 files changed, 249 insertions, 9 deletions
diff --git a/src/libraries/LumbrJack.c b/src/libraries/LumbrJack.c index 27ca524..9b072b0 100644 --- a/src/libraries/LumbrJack.c +++ b/src/libraries/LumbrJack.c | |||
@@ -3,8 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | 5 | ||
6 | #include "LumbrJack.h" | ||
7 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include "LumbrJack.h" | ||
8 | 8 | ||
9 | 9 | ||
10 | static char dateTime[DATE_TIME_LEN]; | 10 | static char dateTime[DATE_TIME_LEN]; |
diff --git a/src/extantz/evas_3d_utils.h b/src/libraries/evas_3d_utils.h index 8adc322..8adc322 100644 --- a/src/extantz/evas_3d_utils.h +++ b/src/libraries/evas_3d_utils.h | |||
diff --git a/src/libraries/evas_macros.h b/src/libraries/evas_macros.h new file mode 100644 index 0000000..ed29dbd --- /dev/null +++ b/src/libraries/evas_macros.h | |||
@@ -0,0 +1,217 @@ | |||
1 | #ifndef EVAS_MACROS_H | ||
2 | #define EVAS_MACROS_H | ||
3 | |||
4 | #undef ABS | ||
5 | #define ABS(x) (((x) < 0) ? -(x) : (x)) | ||
6 | |||
7 | #undef SGN | ||
8 | #define SGN(x) (((x) < 0) ? -1 : 1) | ||
9 | |||
10 | #undef MIN | ||
11 | #define MIN(x, y) (((x) < (y)) ? (x) : (y)) | ||
12 | |||
13 | #undef MAX | ||
14 | #define MAX(x, y) (((x) > (y)) ? (x) : (y)) | ||
15 | |||
16 | #define SWAP32(x) (x) = \ | ||
17 | ((((x) & 0x000000ff ) << 24) | \ | ||
18 | (((x) & 0x0000ff00 ) << 8) | \ | ||
19 | (((x) & 0x00ff0000 ) >> 8) | \ | ||
20 | (((x) & 0xff000000 ) >> 24)) | ||
21 | |||
22 | #define SWAP16(x) (x) = \ | ||
23 | ((((x) & 0x00ff ) << 8) | \ | ||
24 | (((x) & 0xff00 ) >> 8)) | ||
25 | |||
26 | #define SPANS_COMMON(x1, w1, x2, w2) \ | ||
27 | (!(( (int)((x2) + (int)(w2)) <= (int)(x1)) || (int)((x2) >= (int)((x1) + (int)(w1))))) | ||
28 | |||
29 | #define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \ | ||
30 | ((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh)))) | ||
31 | |||
32 | #define RECTS_CLIP_TO_RECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \ | ||
33 | { \ | ||
34 | if (RECTS_INTERSECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \ | ||
35 | { \ | ||
36 | if ((int)_x < (int)(_cx)) \ | ||
37 | { \ | ||
38 | if ((int)_w + ((int)_x - (int)(_cx)) < 0) _w = 0; \ | ||
39 | else _w += ((int)_x - (int)(_cx)); \ | ||
40 | _x = (_cx); \ | ||
41 | } \ | ||
42 | if ((int)(_x + _w) > (int)((_cx) + (_cw))) \ | ||
43 | _w = (_cx) + (_cw) - _x; \ | ||
44 | if ((int)_y < (int)(_cy)) \ | ||
45 | { \ | ||
46 | if ((int)_h + ((int)_y - (int)(_cy)) < 0) _h = 0; \ | ||
47 | else _h += ((int)_y - (int)(_cy)); \ | ||
48 | _y = (_cy); \ | ||
49 | } \ | ||
50 | if ((int)(_y + _h) > (int)((_cy) + (_ch))) \ | ||
51 | _h = (_cy) + (_ch) - _y; \ | ||
52 | } \ | ||
53 | else \ | ||
54 | { \ | ||
55 | _w = 0; _h = 0; \ | ||
56 | } \ | ||
57 | } | ||
58 | |||
59 | |||
60 | #define INTERP_VAL(out, in1, in2, in3, in4, interp_x, interp_y) \ | ||
61 | { \ | ||
62 | int _v, _vv; \ | ||
63 | \ | ||
64 | _v = (256 - (interp_x)) * (in1); \ | ||
65 | if ((interp_x) > 0) _v += (interp_x) * (in2); \ | ||
66 | _v *= (256 - (interp_y)); \ | ||
67 | if ((interp_y) > 0) \ | ||
68 | { \ | ||
69 | _vv = (256 - (interp_x)) * (in3); \ | ||
70 | if ((interp_x) > 0) _vv += (interp_x) * (in4); \ | ||
71 | _vv *= (interp_y); \ | ||
72 | (out) = ((_v + _vv) >> 16); \ | ||
73 | } \ | ||
74 | else (out) = (_v >> 16); \ | ||
75 | } | ||
76 | |||
77 | #define INTERP_2(in1, in2, interp, interp_inv) \ | ||
78 | ((in1 * interp_inv) + (in2 * interp)) >> 8 | ||
79 | |||
80 | |||
81 | #define CONVERT_LOOP_START_ROT_0() \ | ||
82 | src_ptr = src; \ | ||
83 | for (y = 0; y < h; y++) \ | ||
84 | { \ | ||
85 | for (x = 0; x < w; x++) \ | ||
86 | { | ||
87 | |||
88 | #define CONVERT_LOOP_END_ROT_0() \ | ||
89 | dst_ptr++; \ | ||
90 | src_ptr++; \ | ||
91 | } \ | ||
92 | src_ptr += src_jump; \ | ||
93 | dst_ptr += dst_jump; \ | ||
94 | } | ||
95 | |||
96 | #define CONVERT_LOOP_START_ROT_180() \ | ||
97 | src_ptr = src + (w - 1) + ((h - 1) * (w + src_jump)); \ | ||
98 | for (y = 0; y < h; y++) \ | ||
99 | { \ | ||
100 | for (x = 0; x < w; x++) \ | ||
101 | { | ||
102 | |||
103 | #define CONVERT_LOOP_END_ROT_180() \ | ||
104 | dst_ptr++; \ | ||
105 | src_ptr--; \ | ||
106 | } \ | ||
107 | src_ptr = src + (w - 1) + ((h - y - 2) * (w + src_jump)); \ | ||
108 | dst_ptr += dst_jump; \ | ||
109 | } | ||
110 | |||
111 | #define CONVERT_LOOP_START_ROT_270() \ | ||
112 | src_ptr = src + ((w - 1) * (h + src_jump)); \ | ||
113 | for (y = 0; y < h; y++) \ | ||
114 | { \ | ||
115 | for (x = 0; x < w; x++) \ | ||
116 | { | ||
117 | |||
118 | #define CONVERT_LOOP_END_ROT_270() \ | ||
119 | dst_ptr++; \ | ||
120 | src_ptr -= (h + src_jump); \ | ||
121 | } \ | ||
122 | src_ptr = src + ((w - 1) * (h + src_jump)) + (y + 1); \ | ||
123 | dst_ptr += dst_jump; \ | ||
124 | } | ||
125 | |||
126 | #define CONVERT_LOOP_START_ROT_90() \ | ||
127 | src_ptr = src + (h - 1); \ | ||
128 | for (y = 0; y < h; y++) \ | ||
129 | { \ | ||
130 | for (x = 0; x < w; x++) \ | ||
131 | { | ||
132 | |||
133 | #define CONVERT_LOOP_END_ROT_90() \ | ||
134 | dst_ptr++; \ | ||
135 | src_ptr += (h + src_jump); \ | ||
136 | } \ | ||
137 | src_ptr = src + (h - 1) - y - 1; \ | ||
138 | dst_ptr += dst_jump; \ | ||
139 | } | ||
140 | |||
141 | #define CONVERT_LOOP2_START_ROT_0() \ | ||
142 | src_ptr = src; \ | ||
143 | for (y = 0; y < h; y++) \ | ||
144 | { \ | ||
145 | for (x = 0; x < w; x++) \ | ||
146 | { | ||
147 | |||
148 | #define CONVERT_LOOP2_INC_ROT_0() \ | ||
149 | src_ptr++; \ | ||
150 | x++; | ||
151 | |||
152 | #define CONVERT_LOOP2_END_ROT_0() \ | ||
153 | dst_ptr+=2; \ | ||
154 | src_ptr++; \ | ||
155 | } \ | ||
156 | src_ptr += src_jump; \ | ||
157 | dst_ptr += dst_jump; \ | ||
158 | } | ||
159 | |||
160 | #define CONVERT_LOOP2_START_ROT_180() \ | ||
161 | src_ptr = src + (w - 1) + ((h - 1) * (w + src_jump)); \ | ||
162 | for (y = 0; y < h; y++) \ | ||
163 | { \ | ||
164 | for (x = 0; x < w; x++) \ | ||
165 | { | ||
166 | |||
167 | #define CONVERT_LOOP2_INC_ROT_180() \ | ||
168 | src_ptr--; \ | ||
169 | x++; | ||
170 | |||
171 | #define CONVERT_LOOP2_END_ROT_180() \ | ||
172 | dst_ptr+=2; \ | ||
173 | src_ptr--; \ | ||
174 | } \ | ||
175 | src_ptr = src + (w - 1) + ((h - y - 2) * (w + src_jump)); \ | ||
176 | dst_ptr += dst_jump; \ | ||
177 | } | ||
178 | |||
179 | #define CONVERT_LOOP2_START_ROT_270() \ | ||
180 | src_ptr = src + ((w - 1) * (h + src_jump)); \ | ||
181 | for (y = 0; y < h; y++) \ | ||
182 | { \ | ||
183 | for (x = 0; x < w; x++) \ | ||
184 | { | ||
185 | |||
186 | #define CONVERT_LOOP2_INC_ROT_270() \ | ||
187 | src_ptr -= (h + src_jump); \ | ||
188 | x++; | ||
189 | |||
190 | #define CONVERT_LOOP2_END_ROT_270() \ | ||
191 | dst_ptr+=2; \ | ||
192 | src_ptr -= (h + src_jump); \ | ||
193 | } \ | ||
194 | src_ptr = src + ((w - 1) * (h + src_jump)) + (y + 1); \ | ||
195 | dst_ptr += dst_jump; \ | ||
196 | } | ||
197 | |||
198 | #define CONVERT_LOOP2_START_ROT_90() \ | ||
199 | src_ptr = src + (h - 1); \ | ||
200 | for (y = 0; y < h; y++) \ | ||
201 | { \ | ||
202 | for (x = 0; x < w; x++) \ | ||
203 | { | ||
204 | |||
205 | #define CONVERT_LOOP2_INC_ROT_90() \ | ||
206 | src_ptr += (h + src_jump); \ | ||
207 | x++; | ||
208 | |||
209 | #define CONVERT_LOOP2_END_ROT_90() \ | ||
210 | dst_ptr+=2; \ | ||
211 | src_ptr += (h + src_jump); \ | ||
212 | } \ | ||
213 | src_ptr = src + (h - 1) - y - 1; \ | ||
214 | dst_ptr += dst_jump; \ | ||
215 | } | ||
216 | |||
217 | #endif | ||
diff --git a/src/love/love.h b/src/libraries/love.h index 925ad0e..5964cde 100644 --- a/src/love/love.h +++ b/src/libraries/love.h | |||
@@ -78,7 +78,33 @@ love needs | |||
78 | calling card | 78 | calling card |
79 | */ | 79 | */ |
80 | 80 | ||
81 | #include <Eina.h> | 81 | #include "evas_macros.h" |
82 | #include "evas_3d_utils.h" // TODO - Hopefully I can convince the authors to make this public. | ||
83 | |||
84 | #include "Runnr.h" | ||
85 | |||
86 | |||
87 | typedef struct _vec4 | ||
88 | { | ||
89 | float x; | ||
90 | float y; | ||
91 | float z; | ||
92 | float w; | ||
93 | } vec4; | ||
94 | |||
95 | typedef struct _vec3 | ||
96 | { | ||
97 | float x; | ||
98 | float y; | ||
99 | float z; | ||
100 | } vec3; | ||
101 | |||
102 | typedef struct _vec2 | ||
103 | { | ||
104 | float x; | ||
105 | float y; | ||
106 | } vec2; | ||
107 | |||
82 | 108 | ||
83 | typedef struct _material | 109 | typedef struct _material |
84 | { | 110 | { |
@@ -94,8 +120,8 @@ typedef struct _mesh | |||
94 | { | 120 | { |
95 | char fileName[PATH_MAX]; | 121 | char fileName[PATH_MAX]; |
96 | //type | 122 | //type |
97 | // Evas_Vec3 pos; | 123 | vec3 pos; |
98 | // Evas_Vec4 rot; | 124 | vec4 rot; |
99 | Eina_Inarray materials; // Material | 125 | Eina_Inarray materials; // Material |
100 | Eina_Inarray parts; // Mesh | 126 | Eina_Inarray parts; // Mesh |
101 | } Mesh; | 127 | } Mesh; |
@@ -107,7 +133,7 @@ typedef struct _stuffs | |||
107 | union | 133 | union |
108 | { | 134 | { |
109 | Mesh *mesh; | 135 | Mesh *mesh; |
110 | // script *script; | 136 | script *scrip; // Not a typo, C++ is fussy about reusing names like this. |
111 | void *other; | 137 | void *other; |
112 | } details; | 138 | } details; |
113 | } Stuffs; | 139 | } Stuffs; |
@@ -123,7 +149,7 @@ typedef struct _extantzStuffs | |||
123 | { | 149 | { |
124 | Stuffs stuffs; | 150 | Stuffs stuffs; |
125 | // Evas_3D_Mesh *mesh; | 151 | // Evas_3D_Mesh *mesh; |
126 | // Evas_3D_Node *mesh_node; | 152 | // Evas_3D_Node *mesh_node; // Multiple Evas_3D_Mesh's can be in one Evas_3D_Node |
127 | Eina_Inarray *materials; // Evas_3D_Material | 153 | Eina_Inarray *materials; // Evas_3D_Material |
128 | Eina_Inarray *textures; // Evas_3D_Texture | 154 | Eina_Inarray *textures; // Evas_3D_Texture |
129 | } ExtantzStuffs; | 155 | } ExtantzStuffs; |
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index 7a84a7e..f2aebfd 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -2,9 +2,6 @@ | |||
2 | #define _WINFANG_H_ | 2 | #define _WINFANG_H_ |
3 | 3 | ||
4 | 4 | ||
5 | #include <Eo.h> | ||
6 | #include <Eina.h> | ||
7 | #include <Evas.h> | ||
8 | #include <Elementary.h> | 5 | #include <Elementary.h> |
9 | #include <EPhysics.h> | 6 | #include <EPhysics.h> |
10 | 7 | ||