aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-04-22 09:21:55 +1000
committerDavid Walter Seikel2012-04-22 09:21:55 +1000
commit90a85c0d8def4e9b5d847124a80506c1ceab76c3 (patch)
treeb0abf578bb81dc389aa27013f82e7bb41fa45906
parentAnd actually include new files, plus elementary libraries. (diff)
downloadSledjHamr-90a85c0d8def4e9b5d847124a80506c1ceab76c3.zip
SledjHamr-90a85c0d8def4e9b5d847124a80506c1ceab76c3.tar.gz
SledjHamr-90a85c0d8def4e9b5d847124a80506c1ceab76c3.tar.bz2
SledjHamr-90a85c0d8def4e9b5d847124a80506c1ceab76c3.tar.xz
Some actual extantz source code. With test data for now.
-rw-r--r--ClientHamr/extantz/README58
-rw-r--r--ClientHamr/extantz/extantz.c868
-rw-r--r--ClientHamr/extantz/images/animated_logo.gifbin0 -> 81411 bytes
-rw-r--r--ClientHamr/extantz/images/bubble.pngbin0 -> 4878 bytes
-rw-r--r--ClientHamr/extantz/images/bubble_sh.pngbin0 -> 1600 bytes
-rw-r--r--ClientHamr/extantz/images/logo.pngbin0 -> 81162 bytes
-rw-r--r--ClientHamr/extantz/images/logo_small.pngbin0 -> 5655 bytes
-rw-r--r--ClientHamr/extantz/images/plant_01.jpgbin0 -> 165867 bytes
-rw-r--r--ClientHamr/extantz/images/pt.pngbin0 -> 875 bytes
-rw-r--r--ClientHamr/extantz/images/rock_01.jpgbin0 -> 330094 bytes
-rw-r--r--ClientHamr/extantz/images/rock_02.jpgbin0 -> 285555 bytes
-rw-r--r--ClientHamr/extantz/images/sky_01.jpgbin0 -> 134813 bytes
-rw-r--r--ClientHamr/extantz/images/sky_02.jpgbin0 -> 31413 bytes
-rw-r--r--ClientHamr/extantz/images/sky_03.jpgbin0 -> 73364 bytes
-rw-r--r--ClientHamr/extantz/images/sky_04.jpgbin0 -> 25078 bytes
-rw-r--r--ClientHamr/extantz/images/wood_01.jpgbin0 -> 96136 bytes
-rwxr-xr-xClientHamr/extantz/make.sh3
17 files changed, 928 insertions, 1 deletions
diff --git a/ClientHamr/extantz/README b/ClientHamr/extantz/README
index b6ba67a..ddd284a 100644
--- a/ClientHamr/extantz/README
+++ b/ClientHamr/extantz/README
@@ -38,7 +38,7 @@ custom viewers, but the user wants to use a more generic viewer for all
38the other grids. Or if the user wants to use one viewer for OpenSim 38the other grids. Or if the user wants to use one viewer for OpenSim
39grids, but another for LL (Linden Labs) grids. Coz perhaps their chosen 39grids, but another for LL (Linden Labs) grids. Coz perhaps their chosen
40viewer is not TPVP (Third Party Viewer Policy, an LL thing) compliant, 40viewer is not TPVP (Third Party Viewer Policy, an LL thing) compliant,
41and Ll are just more anal than the rest of the universe. 41and LL are just more anal than the rest of the universe.
42 42
43The grid manager will also include some sort of search capability, as is 43The grid manager will also include some sort of search capability, as is
44currently being discussed by various people in the OpenSim universe. 44currently being discussed by various people in the OpenSim universe.
@@ -102,6 +102,62 @@ which is different from the "gets out of the way" it usually does, still
102running, just not on screen. 102running, just not on screen.
103 103
104 104
105The problem with the web.
106-------------------------
105 107
108At least that's the theory. In practice, a web browser takes up almost
109one third of the viewer, and is only used for three things. Login
110pages, simple built in browser window, and MOAP (Media On A Prim). For
111the first two full blown web browsers are massive overkill. MOAP is not
112supported by meta-impy yet anyway.
106 113
114WebKit is a pain to compile at the moment, for reasons I wont go into
115right now. At the opposite of the spectrum is dillo, which is not quite
116up to spec enough for login pages that have fancy stuff. There does not
117appear to be any middle ground. So right now, I'll work on using random
118web browsers as external windows. That will suffice for everything but
119MOAP, which I can leave until later.
120
121The web is a bloated mess, so it's not surprising that a fully featured
122web browser component like WebKit is also a bloated mess.
123
124
125Design.
126-------
127
128A thin window on the left.
129
130Menus across the top.
131View tabs.
132 Grids Accounts Viewers Landmarks
133
134Grids tab is the grid manager, though you can also drill down / tree out
135the accounts list per grid.
136
137Accounts shows accounts, though can drill down to grid list per account.
138Also consider launching thin viewers, text only ones and such. The
139account view is almost a natural for extending into a IM style thingy.
140
141Viewers lists the installed viewers, can install more, and allows
142preferences editing. It can handle viewer installs, upgrades, even
143compiling them from source.
144
145Landmarks manages LMs from viewers, or log in spots, or SLURLs etc.
146
147A user configurable web browser can open up to fill the right of the
148screen.
149
150Might be good to allow Lua scripting. One way of dealing with viewer
151prefs perhaps? Certainly think about Lua for the UI, and a built in
152editor, etc. ala skang. All the fancy stuff like development and such
153should be kept in some sort of module, so as not to bloat the main
154proggy. See if it's possible to disable the Emerald/Phoenix/Firestorm
155LSL bridge when connecting to OpenSim. See if we can do it from Lua,
156with some sort of generic Lua system for munging things.
157
158Log file management features, including viewer stdout, check if only
159Linux viewers do that. Including chat logs.
160
161Dillo and uzbl can insert themselves into the windows of others. Should
162check that out.
107 163
diff --git a/ClientHamr/extantz/extantz.c b/ClientHamr/extantz/extantz.c
new file mode 100644
index 0000000..3f6a296
--- /dev/null
+++ b/ClientHamr/extantz/extantz.c
@@ -0,0 +1,868 @@
1#include <Elementary.h>
2#ifndef M_PI
3#define M_PI 3.14159265
4#endif
5
6typedef enum
7{
8 EZP_NONE,
9 EZP_AURORA,
10 EZP_OPENSIM,
11 EZP_SECOND_LIFE,
12 EZP_SLEDJHAMR,
13 EZP_TRITIUM
14} ezPlatform;
15
16typedef struct
17{
18 char *name;
19 char *version; // Version string.
20 char *path; // OS filesystem path to the viewer install.
21 char *icon;
22 uint16_t tag; // The UUID of the texture used in the avatar bake hack.
23 uint8_t r, g, b; // Colour used for the in world tag.
24} ezViewer;
25
26typedef struct
27{
28 Eina_Clist accounts;
29 Eina_Clist landmarks;
30 char *name;
31 char *loginURI;
32 char *splashPage;
33 char *helperURI;
34 char *website;
35 char *supportPage;
36 char *registerPage;
37 char *passwordPage;
38 char *icon;
39 ezPlatform platform;
40 ezViewer *viewer;
41 Elm_Object_Item *item;
42} ezGrid;
43
44typedef struct
45{
46 Eina_Clist grid;
47 char *name;
48 char *password; // Think we need to pass unencrypted passwords to the viewer. B-(
49 char *icon;
50 ezViewer *viewer;
51} ezAccount;
52
53typedef struct
54{
55 Eina_Clist grid;
56 char *name;
57 char *sim;
58 char *screenshot;
59 short x, y, z;
60} ezLandmark;
61
62Eina_Hash *grids;
63Eina_Hash *viewers;
64
65static char *gridTest[][3] =
66{
67 {"3rd Rock Grid", "http://grid.3rdrockgrid.com:8002/", "http://grid.3rdrockgrid.com/3rg_login"},
68 {"Infinite Grid", "http://grid.infinitegrid.org:8002/", "http://www.infinitegrid.org/loginscreen.php"},
69 {"Second Life Grid", "https://login.agni.lindenlab.com/cgi-bin/login.cgi", "http://secondlife.com/"},
70 {NULL, NULL, NULL}
71};
72
73static char *accountTest[][3] =
74{
75 {"3rd Rock Grid", "onefang rejected", "password"},
76 {"Infinite Grid", "infinite onefang", "MyB1GSecrit"},
77 {"Infinite Grid", "onefang rejected", "MySecrit"},
78 {NULL, NULL, NULL}
79};
80
81
82static Elm_Genlist_Item_Class *grid_gic = NULL;
83static Elm_Genlist_Item_Class *account_gic = NULL;
84
85static int x, y, w, h;
86
87
88static const char *img0 = PACKAGE_DATA_DIR "/images/logo.png";
89static const char *img1 = PACKAGE_DATA_DIR "/images/plant_01.jpg";
90static const char *img2 = PACKAGE_DATA_DIR "/images/rock_01.jpg";
91static const char *img3 = PACKAGE_DATA_DIR "/images/sky_01.jpg";
92
93
94typedef struct _Gear Gear;
95typedef struct _GLData GLData;
96struct _Gear
97{
98 GLfloat *vertices;
99 GLuint vbo;
100 int count;
101};
102
103// GL related data here..
104struct _GLData
105{
106 Evas_GL_API *glapi;
107 GLuint program;
108 GLuint vtx_shader;
109 GLuint fgmt_shader;
110 int initialized : 1;
111 int mouse_down : 1;
112
113 // Gear Stuff
114 GLfloat view_rotx;
115 GLfloat view_roty;
116 GLfloat view_rotz;
117
118 Gear *gear1;
119 Gear *gear2;
120 Gear *gear3;
121
122 GLfloat angle;
123
124 GLuint proj_location;
125 GLuint light_location;
126 GLuint color_location;
127
128 GLfloat proj[16];
129 GLfloat light[3];
130};
131
132static void gears_init(GLData *gld);
133static void free_gear(Gear *gear);
134static void gears_reshape(GLData *gld, int width, int height);
135static void render_gears(GLData *gld);
136
137//--------------------------------//
138// Gear Stuff....
139static GLfloat *vert(GLfloat *p, GLfloat x, GLfloat y, GLfloat z, GLfloat *n)
140{
141 p[0] = x;
142 p[1] = y;
143 p[2] = z;
144 p[3] = n[0];
145 p[4] = n[1];
146 p[5] = n[2];
147
148 return p + 6;
149}
150
151/* Draw a gear wheel. You'll probably want to call this function when
152 * building a display list since we do a lot of trig here.
153 *
154 * Input: inner_radius - radius of hole at center
155 * outer_radius - radius at center of teeth
156 * width - width of gear
157 * teeth - number of teeth
158 * tooth_depth - depth of tooth
159 */
160static Gear *make_gear(GLData *gld, GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
161{
162 GLint i;
163 GLfloat r0, r1, r2;
164 GLfloat da;
165 GLfloat *v;
166 Gear *gear;
167 double s[5], c[5];
168 GLfloat normal[3];
169 const int tris_per_tooth = 20;
170 Evas_GL_API *gl = gld->glapi;
171
172 gear = (Gear*)malloc(sizeof(Gear));
173 if (gear == NULL)
174 return NULL;
175
176 r0 = inner_radius;
177 r1 = outer_radius - tooth_depth / 2.0;
178 r2 = outer_radius + tooth_depth / 2.0;
179
180 da = 2.0 * M_PI / teeth / 4.0;
181
182 gear->vertices = calloc(teeth * tris_per_tooth * 3 * 6, sizeof *gear->vertices);
183 s[4] = 0;
184 c[4] = 1;
185 v = gear->vertices;
186 for (i = 0; i < teeth; i++)
187 {
188 s[0] = s[4];
189 c[0] = c[4];
190 s[1] = sin(i * 2.0 * M_PI / teeth + da);
191 c[1] = cos(i * 2.0 * M_PI / teeth + da);
192 s[2] = sin(i * 2.0 * M_PI / teeth + da * 2);
193 c[2] = cos(i * 2.0 * M_PI / teeth + da * 2);
194 s[3] = sin(i * 2.0 * M_PI / teeth + da * 3);
195 c[3] = cos(i * 2.0 * M_PI / teeth + da * 3);
196 s[4] = sin(i * 2.0 * M_PI / teeth + da * 4);
197 c[4] = cos(i * 2.0 * M_PI / teeth + da * 4);
198
199 normal[0] = 0.0;
200 normal[1] = 0.0;
201 normal[2] = 1.0;
202
203 v = vert(v, r2 * c[1], r2 * s[1], width * 0.5, normal);
204
205 v = vert(v, r2 * c[1], r2 * s[1], width * 0.5, normal);
206 v = vert(v, r2 * c[2], r2 * s[2], width * 0.5, normal);
207 v = vert(v, r1 * c[0], r1 * s[0], width * 0.5, normal);
208 v = vert(v, r1 * c[3], r1 * s[3], width * 0.5, normal);
209 v = vert(v, r0 * c[0], r0 * s[0], width * 0.5, normal);
210 v = vert(v, r1 * c[4], r1 * s[4], width * 0.5, normal);
211 v = vert(v, r0 * c[4], r0 * s[4], width * 0.5, normal);
212
213 v = vert(v, r0 * c[4], r0 * s[4], width * 0.5, normal);
214 v = vert(v, r0 * c[0], r0 * s[0], width * 0.5, normal);
215 v = vert(v, r0 * c[4], r0 * s[4], -width * 0.5, normal);
216 v = vert(v, r0 * c[0], r0 * s[0], -width * 0.5, normal);
217
218 normal[0] = 0.0;
219 normal[1] = 0.0;
220 normal[2] = -1.0;
221
222 v = vert(v, r0 * c[4], r0 * s[4], -width * 0.5, normal);
223
224 v = vert(v, r0 * c[4], r0 * s[4], -width * 0.5, normal);
225 v = vert(v, r1 * c[4], r1 * s[4], -width * 0.5, normal);
226 v = vert(v, r0 * c[0], r0 * s[0], -width * 0.5, normal);
227 v = vert(v, r1 * c[3], r1 * s[3], -width * 0.5, normal);
228 v = vert(v, r1 * c[0], r1 * s[0], -width * 0.5, normal);
229 v = vert(v, r2 * c[2], r2 * s[2], -width * 0.5, normal);
230 v = vert(v, r2 * c[1], r2 * s[1], -width * 0.5, normal);
231
232 v = vert(v, r1 * c[0], r1 * s[0], width * 0.5, normal);
233
234 v = vert(v, r1 * c[0], r1 * s[0], width * 0.5, normal);
235 v = vert(v, r1 * c[0], r1 * s[0], -width * 0.5, normal);
236 v = vert(v, r2 * c[1], r2 * s[1], width * 0.5, normal);
237 v = vert(v, r2 * c[1], r2 * s[1], -width * 0.5, normal);
238 v = vert(v, r2 * c[2], r2 * s[2], width * 0.5, normal);
239 v = vert(v, r2 * c[2], r2 * s[2], -width * 0.5, normal);
240 v = vert(v, r1 * c[3], r1 * s[3], width * 0.5, normal);
241 v = vert(v, r1 * c[3], r1 * s[3], -width * 0.5, normal);
242 v = vert(v, r1 * c[4], r1 * s[4], width * 0.5, normal);
243 v = vert(v, r1 * c[4], r1 * s[4], -width * 0.5, normal);
244
245 v = vert(v, r1 * c[4], r1 * s[4], -width * 0.5, normal);
246 }
247
248 gear->count = (v - gear->vertices) / 6;
249
250 gl->glGenBuffers(1, &gear->vbo);
251 gl->glBindBuffer(GL_ARRAY_BUFFER, gear->vbo);
252 gl->glBufferData(GL_ARRAY_BUFFER, gear->count * 6 * 4, gear->vertices, GL_STATIC_DRAW);
253
254
255 return gear;
256}
257
258static void free_gear(Gear *gear)
259{
260 free(gear->vertices);
261 free(gear);
262 gear = NULL;
263}
264
265static void multiply(GLfloat *m, const GLfloat *n)
266{
267 GLfloat tmp[16];
268 const GLfloat *row, *column;
269 div_t d;
270 int i, j;
271
272 for (i = 0; i < 16; i++)
273 {
274 tmp[i] = 0;
275 d = div(i, 4);
276 row = n + d.quot * 4;
277 column = m + d.rem;
278 for (j = 0; j < 4; j++)
279 tmp[i] += row[j] * column[j * 4];
280 }
281 memcpy(m, &tmp, sizeof tmp);
282}
283
284static void rotate(GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
285{
286 double s, c;
287
288 s = sin(angle);
289 c = cos(angle);
290 GLfloat r[16] =
291 {
292 x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0,
293 x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
294 x * z * (1 - c) + y * s, y * z * (1 - c) - x * s, z * z * (1 - c) + c, 0,
295 0, 0, 0, 1
296 };
297
298 multiply(m, r);
299}
300
301static void translate(GLfloat *m, GLfloat x, GLfloat y, GLfloat z)
302{
303 GLfloat t[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 };
304
305 multiply(m, t);
306}
307
308static void draw_gear(GLData *gld, Gear *gear, GLfloat *m, GLfloat x, GLfloat y, GLfloat angle, const GLfloat *color)
309{
310 Evas_GL_API *gl = gld->glapi;
311 GLfloat tmp[16];
312
313 memcpy(tmp, m, sizeof tmp);
314 translate(tmp, x, y, 0);
315 rotate(tmp, 2 * M_PI * angle / 360.0, 0, 0, 1);
316 gl->glUniformMatrix4fv(gld->proj_location, 1, GL_FALSE, tmp);
317 gl->glUniform3fv(gld->light_location, 1, gld->light);
318 gl->glUniform4fv(gld->color_location, 1, color);
319
320 gl->glBindBuffer(GL_ARRAY_BUFFER, gear->vbo);
321
322 gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), NULL);
323 gl->glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLfloat *) 0 + 3);
324 gl->glEnableVertexAttribArray(0);
325 gl->glEnableVertexAttribArray(1);
326 gl->glDrawArrays(GL_TRIANGLE_STRIP, 0, gear->count);
327}
328
329static void gears_draw(GLData *gld)
330{
331 Evas_GL_API *gl = gld->glapi;
332
333 static const GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
334 static const GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
335 static const GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
336 GLfloat m[16];
337
338 gl->glClearColor(0.8, 0.8, 0.1, 0.5);
339 gl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
340
341 memcpy(m, gld->proj, sizeof m);
342 rotate(m, 2 * M_PI * gld->view_rotx / 360.0, 1, 0, 0);
343 rotate(m, 2 * M_PI * gld->view_roty / 360.0, 0, 1, 0);
344 rotate(m, 2 * M_PI * gld->view_rotz / 360.0, 0, 0, 1);
345
346 draw_gear(gld, gld->gear1, m, -3.0, -2.0, gld->angle, red);
347 draw_gear(gld, gld->gear2, m, 3.1, -2.0, -2 * gld->angle - 9.0, green);
348 draw_gear(gld, gld->gear3, m, -3.1, 4.2, -2 * gld->angle - 25.0, blue);
349}
350
351static void render_gears(GLData *gld)
352{
353 gears_draw(gld);
354
355 gld->angle += 2.0;
356}
357
358/* new window size or exposure */
359static void gears_reshape(GLData *gld, int width, int height)
360{
361 Evas_GL_API *gl = gld->glapi;
362
363 GLfloat ar, m[16] = {
364 1.0, 0.0, 0.0, 0.0,
365 0.0, 1.0, 0.0, 0.0,
366 0.0, 0.0, 0.1, 0.0,
367 0.0, 0.0, 0.0, 1.0
368 };
369
370 if (width < height)
371 ar = width;
372 else
373 ar = height;
374
375 m[0] = 0.1 * ar / width;
376 m[5] = 0.1 * ar / height;
377 memcpy(gld->proj, m, sizeof gld->proj);
378 gl->glViewport(0, 0, (GLint) width, (GLint) height);
379}
380
381static const char vertex_shader[] =
382 "uniform mat4 proj;\n"
383 "attribute vec4 position;\n"
384 "attribute vec4 normal;\n"
385 "varying vec3 rotated_normal;\n"
386 "varying vec3 rotated_position;\n"
387 "vec4 tmp;\n"
388 "void main()\n"
389 "{\n"
390 " gl_Position = proj * position;\n"
391 " rotated_position = gl_Position.xyz;\n"
392 " tmp = proj * normal;\n"
393 " rotated_normal = tmp.xyz;\n"
394 "}\n";
395
396 static const char fragment_shader[] =
397 "#ifdef GL_ES\n"
398 "precision mediump float;\n"
399 "#endif\n"
400 "uniform vec4 color;\n"
401 "uniform vec3 light;\n"
402 "varying vec3 rotated_normal;\n"
403 "varying vec3 rotated_position;\n"
404 "vec3 light_direction;\n"
405 "vec4 white = vec4(0.5, 0.5, 0.5, 1.0);\n"
406 "void main()\n"
407 "{\n"
408 " light_direction = normalize(light - rotated_position);\n"
409 " gl_FragColor = color + white * dot(light_direction, rotated_normal);\n"
410 "}\n";
411
412static void gears_init(GLData *gld)
413{
414 Evas_GL_API *gl = gld->glapi;
415
416 const char *p;
417 char msg[512];
418
419 gl->glEnable(GL_CULL_FACE);
420 gl->glEnable(GL_DEPTH_TEST);
421
422 p = vertex_shader;
423 gld->vtx_shader = gl->glCreateShader(GL_VERTEX_SHADER);
424 gl->glShaderSource(gld->vtx_shader, 1, &p, NULL);
425 gl->glCompileShader(gld->vtx_shader);
426 gl->glGetShaderInfoLog(gld->vtx_shader, sizeof msg, NULL, msg);
427 printf("vertex shader info: %s\n", msg);
428
429 p = fragment_shader;
430 gld->fgmt_shader = gl->glCreateShader(GL_FRAGMENT_SHADER);
431 gl->glShaderSource(gld->fgmt_shader, 1, &p, NULL);
432 gl->glCompileShader(gld->fgmt_shader);
433 gl->glGetShaderInfoLog(gld->fgmt_shader, sizeof msg, NULL, msg);
434 printf("fragment shader info: %s\n", msg);
435
436 gld->program = gl->glCreateProgram();
437 gl->glAttachShader(gld->program, gld->vtx_shader);
438 gl->glAttachShader(gld->program, gld->fgmt_shader);
439 gl->glBindAttribLocation(gld->program, 0, "position");
440 gl->glBindAttribLocation(gld->program, 1, "normal");
441
442 gl->glLinkProgram(gld->program);
443 gl->glGetProgramInfoLog(gld->program, sizeof msg, NULL, msg);
444 printf("info: %s\n", msg);
445
446 gl->glUseProgram(gld->program);
447 gld->proj_location = gl->glGetUniformLocation(gld->program, "proj");
448 gld->light_location = gl->glGetUniformLocation(gld->program, "light");
449 gld->color_location = gl->glGetUniformLocation(gld->program, "color");
450
451 /* make the gears */
452 gld->gear1 = make_gear(gld, 1.0, 4.0, 1.0, 20, 0.7);
453 gld->gear2 = make_gear(gld, 0.5, 2.0, 2.0, 10, 0.7);
454 gld->gear3 = make_gear(gld, 1.3, 2.0, 0.5, 10, 0.7);
455}
456
457static void gldata_init(GLData *gld)
458{
459 gld->initialized = 0;
460 gld->mouse_down = 0;
461
462 gld->view_rotx = -20.0;
463 gld->view_roty = -30.0;
464 gld->view_rotz = 0.0;
465 gld->angle = 0.0;
466
467 gld->light[0] = 1.0;
468 gld->light[1] = 1.0;
469 gld->light[2] = -5.0;
470}
471
472
473//-------------------------//
474
475static void _init_gl(Evas_Object *obj)
476{
477 GLData *gld = evas_object_data_get(obj, "gld");
478
479 gears_init(gld);
480}
481
482static void _del_gl(Evas_Object *obj)
483{
484 GLData *gld = evas_object_data_get(obj, "gld");
485 if (!gld)
486 {
487 printf("Unable to get GLData. \n");
488 return;
489 }
490 Evas_GL_API *gl = gld->glapi;
491
492 gl->glDeleteShader(gld->vtx_shader);
493 gl->glDeleteShader(gld->fgmt_shader);
494 gl->glDeleteProgram(gld->program);
495 gl->glDeleteBuffers(1, &gld->gear1->vbo);
496 gl->glDeleteBuffers(1, &gld->gear2->vbo);
497 gl->glDeleteBuffers(1, &gld->gear3->vbo);
498
499 free_gear(gld->gear1);
500 free_gear(gld->gear2);
501 free_gear(gld->gear3);
502
503 evas_object_data_del((Evas_Object*)obj, "..gld");
504 free(gld);
505}
506
507static void _resize_gl(Evas_Object *obj)
508{
509 int w, h;
510 GLData *gld = evas_object_data_get(obj, "gld");
511
512 elm_glview_size_get(obj, &w, &h);
513
514 // GL Viewport stuff. you can avoid doing this if viewport is all the
515 // same as last frame if you want
516 gears_reshape(gld, w, h);
517}
518
519static void _draw_gl(Evas_Object *obj)
520{
521 Evas_GL_API *gl = elm_glview_gl_api_get(obj);
522 GLData *gld = evas_object_data_get(obj, "gld");
523 if (!gld) return;
524
525 render_gears(gld);
526 gl->glFinish();
527}
528
529static Eina_Bool _anim(void *data)
530{
531 elm_glview_changed_set(data);
532 return EINA_TRUE;
533}
534
535static void _del(void *data , Evas *evas , Evas_Object *obj, void *event_info )
536{
537 Ecore_Animator *ani = evas_object_data_get(obj, "ani");
538 ecore_animator_del(ani);
539}
540
541static void _key_down(void *data , Evas *e , Evas_Object *obj, void *event_info)
542{
543 Evas_Event_Key_Down *ev;
544 ev = (Evas_Event_Key_Down *)event_info;
545 GLData *gld = evas_object_data_get(obj, "gld");
546
547 if (strcmp(ev->keyname, "Left") == 0)
548 {
549 gld->view_roty += 5.0;
550 return;
551 }
552
553 if (strcmp(ev->keyname, "Right") == 0)
554 {
555 gld->view_roty -= 5.0;
556 return;
557 }
558
559 if (strcmp(ev->keyname, "Up") == 0)
560 {
561 gld->view_rotx += 5.0;
562 return;
563 }
564
565 if (strcmp(ev->keyname, "Down") == 0)
566 {
567 gld->view_rotx -= 5.0;
568 return;
569 }
570 if ((strcmp(ev->keyname, "Escape") == 0) ||
571 (strcmp(ev->keyname, "Return") == 0))
572 {
573 //_on_done(data, obj, event_info);
574 return;
575 }
576}
577
578static void _mouse_down(void *data , Evas *e , Evas_Object *obj, void *event_info )
579{
580 GLData *gld = evas_object_data_get(obj, "gld");
581 gld->mouse_down = 1;
582}
583
584static void _mouse_move(void *data , Evas *e , Evas_Object *obj, void *event_info )
585{
586 Evas_Event_Mouse_Move *ev;
587 ev = (Evas_Event_Mouse_Move *)event_info;
588 GLData *gld = evas_object_data_get(obj, "gld");
589 float dx = 0, dy = 0;
590
591 if (gld->mouse_down)
592 {
593 dx = ev->cur.canvas.x - ev->prev.canvas.x;
594 dy = ev->cur.canvas.y - ev->prev.canvas.y;
595
596 gld->view_roty += -1.0 * dx;
597 gld->view_rotx += -1.0 * dy;
598 }
599}
600
601static void _mouse_up(void *data , Evas *e , Evas_Object *obj, void *event_info )
602{
603 GLData *gld = evas_object_data_get(obj, "gld");
604 gld->mouse_down = 0;
605}
606
607static Evas_Object *_content_image_new(Evas_Object *parent, const char *img)
608{
609 Evas_Object *ic;
610
611 ic = elm_icon_add(parent);
612 elm_icon_file_set(ic, img, NULL);
613 return ic;
614}
615
616static void _promote(void *data, Evas_Object *obj , void *event_info )
617{
618 elm_naviframe_item_promote(data);
619}
620
621static void _on_done(void *data, Evas_Object *obj, void *event_info)
622{
623 evas_object_del((Evas_Object*)data);
624 elm_exit();
625}
626
627static char *_grid_label_get(void *data, Evas_Object *obj, const char *part)
628{
629 ezGrid *thisGrid = data;
630 char buf[256];
631
632 if (!strcmp(part, "elm.text"))
633 {
634 int count = eina_clist_count(&(thisGrid->accounts));
635
636 if (0 == count)
637 snprintf(buf, sizeof(buf), "%s (no accounts)", thisGrid->name);
638 else if (1 == count)
639 snprintf(buf, sizeof(buf), "%s (%d account)", thisGrid->name, count);
640 else
641 snprintf(buf, sizeof(buf), "%s (%d accounts)", thisGrid->name, count);
642 }
643 else
644 snprintf(buf, sizeof(buf), "%s", thisGrid->loginURI);
645 return strdup(buf);
646}
647
648static Evas_Object *_grid_content_get(void *data, Evas_Object *obj, const char *part)
649{
650 ezGrid *thisGrid = data;
651 Evas_Object *ic = elm_icon_add(obj);
652
653 if (!strcmp(part, "elm.swallow.icon"))
654 elm_icon_standard_set(ic, thisGrid->icon);
655
656 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
657 return ic;
658}
659
660static char * _account_label_get(void *data, Evas_Object *obj, const char *part)
661{
662 ezAccount *thisAccount = data;
663 char buf[256];
664
665 buf[0] = '\0';
666 if (!strcmp(part, "elm.text"))
667 snprintf(buf, sizeof(buf), "%s", thisAccount->name);
668
669 return strdup(buf);
670}
671
672static Evas_Object *_account_content_get(void *data, Evas_Object *obj, const char *part)
673{
674 ezAccount *thisAccount = data;
675 Evas_Object *ic = elm_icon_add(obj);
676
677 if (!strcmp(part, "elm.swallow.icon"))
678 elm_icon_standard_set(ic, thisAccount->icon);
679
680 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
681 return ic;
682}
683
684static void _grid_sel_cb(void *data, Evas_Object *obj, void *event_info)
685{
686 ezGrid *thisGrid = data;
687 char buf[PATH_MAX];
688
689// sprintf(buf, "dillo -f -g '%dx%d+%d+%d' %s", w - (w / 5), h - 30, w / 5, y, thisGrid->splashPage);
690 sprintf(buf, "uzbl -g '%dx%d+%d+%d' -u %s", w - (w / 5), h - 30, w / 5, y, thisGrid->splashPage);
691 printf("%s ### genlist obj [%p], item pointer [%p]\n", buf, obj, event_info);
692 system(buf);
693}
694
695
696EAPI_MAIN int elm_main(int argc, char **argv)
697{
698 Evas_Object *win, *bg, *bx, *mn, *tb, *bt, *menu, *gl, *nf, *tab, *list;
699 Elm_Object_Item *tb_it, *menu_it, *tab_it;
700 Ecore_Animator *ani;
701 GLData *gld = NULL;
702 int i;
703 Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't.
704
705 elm_config_finger_size_set(0);
706 elm_config_scale_set(1.0);
707
708 // alloc a data struct to hold our relevant gl info in
709 if (!(gld = calloc(1, sizeof(GLData)))) return;
710 gldata_init(gld);
711
712 // new window - do the usual and give it a name, title and delete handler
713 // Set the engine to opengl_x11
714 elm_config_preferred_engine_set("opengl_x11");
715 win = elm_win_util_standard_add("extantz", "GLView");
716 // Set preferred engine back to default from config
717 elm_config_preferred_engine_set(NULL);
718
719 elm_win_title_set(win, "extantz virtual world manager");
720 evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);
721
722 elm_win_screen_size_get(win, &x, &y, &w, &h);
723
724 bg = elm_bg_add(win);
725 elm_win_resize_object_add(win, bg);
726 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
727 evas_object_show(bg);
728
729 bx = elm_box_add(win);
730 elm_win_resize_object_add(win, bx);
731 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
732 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
733 evas_object_show(bx);
734
735 // A tab thingy.
736 tb = elm_toolbar_add(win);
737 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
738 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
739 evas_object_show(tb);
740
741 // Menu.
742 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
743 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
744 tb_it = elm_toolbar_item_append(tb, NULL, "Menu", NULL, NULL); elm_toolbar_item_menu_set(tb_it, EINA_TRUE); menu = elm_toolbar_item_menu_get(tb_it);
745 elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL);
746 menu_it = elm_menu_item_add(menu, NULL, NULL, "advanced", NULL, NULL);
747 elm_menu_item_add(menu, menu_it, NULL, "debug settings", NULL, NULL);
748 elm_menu_item_separator_add(menu, NULL);
749 menu_it = elm_menu_item_add(menu, NULL, NULL, "help", NULL, NULL);
750 elm_menu_item_add(menu, menu_it, NULL, "grid help", NULL, NULL);
751 elm_menu_item_separator_add(menu, menu_it);
752 elm_menu_item_add(menu, menu_it, NULL, "extantz blogs", NULL, NULL);
753 elm_menu_item_add(menu, menu_it, NULL, "extantz forum", NULL, NULL);
754 elm_menu_item_separator_add(menu, menu_it);
755 elm_menu_item_add(menu, menu_it, NULL, "about extantz", NULL, NULL);
756 elm_menu_item_separator_add(menu, menu_it);
757 elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, win);
758 elm_toolbar_menu_parent_set(tb, win);
759
760 nf = elm_naviframe_add(win);
761 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
762 evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL);
763 evas_object_show(nf);
764
765 grid_gic = elm_genlist_item_class_new();
766 grid_gic->item_style = "double_label";
767 grid_gic->func.text_get = _grid_label_get;
768 grid_gic->func.content_get = _grid_content_get;
769 grid_gic->func.state_get = NULL;
770 grid_gic->func.del = NULL;
771
772 account_gic = elm_genlist_item_class_new();
773 account_gic->item_style = "default";
774 account_gic->func.text_get = _account_label_get;
775 account_gic->func.content_get = _account_content_get;
776 account_gic->func.state_get = NULL;
777 account_gic->func.del = NULL;
778
779 list = elm_genlist_add(win);
780 tab = list; tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Grids", _promote, tab_it);
781 tab = _content_image_new(win, img1); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Accounts", _promote, tab_it);
782 tab = _content_image_new(win, img2); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Viewers", _promote, tab_it);
783 tab = _content_image_new(win, img3); tab_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, tab, NULL); elm_naviframe_item_title_visible_set(tab_it, EINA_FALSE); elm_toolbar_item_append(tb, NULL, "Landmarks", _promote, tab_it);
784
785 grids = eina_hash_stringshared_new(free);
786 for (i = 0; NULL != gridTest[i][0]; i++)
787 {
788 ezGrid *thisGrid = calloc(1, sizeof(ezGrid));
789
790 if (thisGrid)
791 {
792 eina_clist_init(&(thisGrid->accounts));
793 eina_clist_init(&(thisGrid->landmarks));
794 thisGrid->name = gridTest[i][0];
795 thisGrid->loginURI = gridTest[i][1];
796 thisGrid->splashPage = gridTest[i][2];
797 thisGrid->icon = "folder";
798 thisGrid->item = elm_genlist_item_append(list, grid_gic, thisGrid, NULL, ELM_GENLIST_ITEM_TREE, _grid_sel_cb, thisGrid);
799 eina_hash_add(grids, thisGrid->name, thisGrid);
800 }
801 }
802
803 for (i = 0; NULL != accountTest[i][0]; i++)
804 {
805 ezAccount *thisAccount = calloc(1, sizeof(ezAccount));
806 ezGrid *grid = eina_hash_find(grids, accountTest[i][0]);
807
808 if (thisAccount && grid)
809 {
810 thisAccount->name = accountTest[i][1];
811 thisAccount->password = accountTest[i][2];
812 thisAccount->icon = "file";
813 elm_genlist_item_append(list, account_gic, thisAccount, grid->item, ELM_GENLIST_ITEM_NONE, NULL, NULL);
814 eina_clist_add_tail(&(grid->accounts), &(thisAccount->grid));
815 }
816 }
817
818 // Add a GLView
819 gl = elm_glview_add(win);
820 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
821 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
822 elm_glview_mode_set(gl, ELM_GLVIEW_ALPHA|ELM_GLVIEW_DEPTH);
823 elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE);
824 elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ALWAYS);
825 elm_glview_init_func_set(gl, _init_gl);
826 elm_glview_del_func_set(gl, _del_gl);
827 elm_glview_resize_func_set(gl, _resize_gl);
828 elm_glview_render_func_set(gl, (Elm_GLView_Func_Cb)_draw_gl);
829 evas_object_show(gl);
830
831 // Add Mouse/Key Event Callbacks
832 elm_object_focus_set(gl, EINA_TRUE);
833 evas_object_event_callback_add(gl, EVAS_CALLBACK_KEY_DOWN, _key_down, gl);
834 evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, gl);
835 evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, _mouse_up, gl);
836 evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, gl);
837
838 // Animator and other vars
839 ani = ecore_animator_add(_anim, gl);
840 gld->glapi = elm_glview_gl_api_get(gl);
841 evas_object_data_set(gl, "ani", ani);
842 evas_object_data_set(gl, "gld", gld);
843 evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl);
844
845 bt = elm_button_add(win);
846 elm_object_text_set(bt, "Login");
847 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
848 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
849 evas_object_show(bt);
850// evas_object_smart_callback_add(bt, "clicked", NULL, NULL);
851
852 elm_box_pack_end(bx, mn);
853 elm_box_pack_end(bx, tb);
854 elm_box_pack_end(bx, nf);
855 elm_box_pack_end(bx, bt);
856 elm_box_pack_end(bx, gl);
857
858 evas_object_move(win, x, y);
859 evas_object_resize(win, w / 5, h - 30);
860 evas_object_show(win);
861
862 elm_run();
863 elm_shutdown();
864
865 return 0;
866}
867ELM_MAIN()
868
diff --git a/ClientHamr/extantz/images/animated_logo.gif b/ClientHamr/extantz/images/animated_logo.gif
new file mode 100644
index 0000000..ef201af
--- /dev/null
+++ b/ClientHamr/extantz/images/animated_logo.gif
Binary files differ
diff --git a/ClientHamr/extantz/images/bubble.png b/ClientHamr/extantz/images/bubble.png
new file mode 100644
index 0000000..dfb71b7
--- /dev/null
+++ b/ClientHamr/extantz/images/bubble.png
Binary files differ
diff --git a/ClientHamr/extantz/images/bubble_sh.png b/ClientHamr/extantz/images/bubble_sh.png
new file mode 100644
index 0000000..b66c1e6
--- /dev/null
+++ b/ClientHamr/extantz/images/bubble_sh.png
Binary files differ
diff --git a/ClientHamr/extantz/images/logo.png b/ClientHamr/extantz/images/logo.png
new file mode 100644
index 0000000..7dbae67
--- /dev/null
+++ b/ClientHamr/extantz/images/logo.png
Binary files differ
diff --git a/ClientHamr/extantz/images/logo_small.png b/ClientHamr/extantz/images/logo_small.png
new file mode 100644
index 0000000..c7dc665
--- /dev/null
+++ b/ClientHamr/extantz/images/logo_small.png
Binary files differ
diff --git a/ClientHamr/extantz/images/plant_01.jpg b/ClientHamr/extantz/images/plant_01.jpg
new file mode 100644
index 0000000..f1714dd
--- /dev/null
+++ b/ClientHamr/extantz/images/plant_01.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/pt.png b/ClientHamr/extantz/images/pt.png
new file mode 100644
index 0000000..612d117
--- /dev/null
+++ b/ClientHamr/extantz/images/pt.png
Binary files differ
diff --git a/ClientHamr/extantz/images/rock_01.jpg b/ClientHamr/extantz/images/rock_01.jpg
new file mode 100644
index 0000000..c50ccb3
--- /dev/null
+++ b/ClientHamr/extantz/images/rock_01.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/rock_02.jpg b/ClientHamr/extantz/images/rock_02.jpg
new file mode 100644
index 0000000..04aea8a
--- /dev/null
+++ b/ClientHamr/extantz/images/rock_02.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/sky_01.jpg b/ClientHamr/extantz/images/sky_01.jpg
new file mode 100644
index 0000000..22f3050
--- /dev/null
+++ b/ClientHamr/extantz/images/sky_01.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/sky_02.jpg b/ClientHamr/extantz/images/sky_02.jpg
new file mode 100644
index 0000000..d0d7448
--- /dev/null
+++ b/ClientHamr/extantz/images/sky_02.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/sky_03.jpg b/ClientHamr/extantz/images/sky_03.jpg
new file mode 100644
index 0000000..cbad02a
--- /dev/null
+++ b/ClientHamr/extantz/images/sky_03.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/sky_04.jpg b/ClientHamr/extantz/images/sky_04.jpg
new file mode 100644
index 0000000..c5cbc18
--- /dev/null
+++ b/ClientHamr/extantz/images/sky_04.jpg
Binary files differ
diff --git a/ClientHamr/extantz/images/wood_01.jpg b/ClientHamr/extantz/images/wood_01.jpg
new file mode 100644
index 0000000..89f1006
--- /dev/null
+++ b/ClientHamr/extantz/images/wood_01.jpg
Binary files differ
diff --git a/ClientHamr/extantz/make.sh b/ClientHamr/extantz/make.sh
new file mode 100755
index 0000000..2c729b8
--- /dev/null
+++ b/ClientHamr/extantz/make.sh
@@ -0,0 +1,3 @@
1gcc -g -DPACKAGE_DATA_DIR="\"$(pwd)\"" extantz.c -o extantz $(pkg-config --cflags --libs elementary) && ./extantz
2
3