1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
#ifndef _EXTANTZ_H_
#define _EXTANTZ_H_
#define USE_IRR 0
#define USE_DEMO 1
#define DO_GEARS 0
#include "winFang.h"
#include "GuiLua.h"
#include "scenri.h"
#include <elm_widget_glview.h>
#include <Evas_GL.h>
#include <EPhysics.h>
#include "extantzCamera.h"
#ifdef GL_GLES
#include <EGL/egl.h>
#include <EGL/eglext.h>
#else
# include <GL/glext.h>
# include <GL/glx.h>
#endif
#ifdef __cplusplus
/*
In the Irrlicht Engine, everything can be found in the namespace 'irr'. So if
you want to use a class of the engine, you have to write irr:: before the name
of the class. For example to use the IrrlichtDevice write: irr::IrrlichtDevice.
To get rid of the irr:: in front of the name of every class, we tell the
compiler that we use that namespace from now on, and we will not have to write
irr:: anymore.
*/
using namespace irr;
/*
There are 5 sub namespaces in the Irrlicht Engine. Take a look at them, you can
read a detailed description of them in the documentation by clicking on the top
menu item 'Namespace List' or by using this link:
http://irrlicht.sourceforge.net/docu/namespaces.html
Like the irr namespace, we do not want these 5 sub namespaces now, to keep this
example simple. Hence, we tell the compiler again that we do not want always to
write their names.
*/
using namespace core;
using namespace scene;
using namespace video;
extern "C"{
#else
// Irrlicht stuff. It's C++, so we gotta use incomplete types.
typedef struct IrrlichtDevice IrrlichtDevice;
typedef struct IVideoDriver IVideoDriver;
typedef struct ISceneManager ISceneManager;
typedef struct ICameraSceneNode ICameraSceneNode;
#endif
#if DO_GEARS
typedef struct _Gear
{
GLfloat *vertices;
GLuint vbo;
int count;
} Gear;
#endif
typedef enum
{
EZP_NONE,
EZP_AURORA,
EZP_OPENSIM,
EZP_SECOND_LIFE,
EZP_SLEDJHAMR,
EZP_TRITIUM
} ezPlatform;
typedef struct
{
char *name;
char *version; // Version string.
char *path; // OS filesystem path to the viewer install.
char *icon;
uint16_t tag; // The UUID of the texture used in the avatar bake hack.
uint8_t r, g, b; // Colour used for the in world tag.
Elm_Object_Item *item;
} ezViewer;
typedef struct
{
Eina_Clist accounts;
Eina_Clist landmarks;
char *name;
char *loginURI;
char *splashPage;
char *helperURI;
char *website;
char *supportPage;
char *registerPage;
char *passwordPage;
char *icon;
ezPlatform platform;
ezViewer *viewer;
Elm_Object_Item *item;
} ezGrid;
typedef struct
{
Eina_Clist grid;
char *name;
char *password; // Think we need to pass unencrypted passwords to the viewer. B-(
char *icon;
ezViewer *viewer;
} ezAccount;
typedef struct
{
Eina_Clist grid;
char *name;
char *sim;
char *screenshot;
short x, y, z;
} ezLandmark;
typedef struct _Scene_Data
{
Evas_Object *image; // Our Elm image.
Evas_3D_Scene *scene;
Evas_3D_Node *root_node;
Evas_3D_Node *camera_node;
Evas_3D_Node *light_node;
Evas_3D_Light *light;
Evas_3D_Mesh *mesh;
Evas_3D_Node *mesh_node;
Evas_3D_Material *material0;
Evas_3D_Material *material1;
Evas_3D_Texture *texture0;
Evas_3D_Texture *texture1;
Evas_3D_Texture *texture_normal;
Evas_3D_Mesh *mesh2;
Evas_3D_Node *mesh2_node;
Evas_3D_Material *material2;
Evas_3D_Texture *texture2;
Evas_3D_Mesh *mesh3;
Evas_3D_Node *mesh3_node;
Evas_3D_Material *material3;
Evas_3D_Texture *texture_diffuse;
cameraMove *move;
Evas_Object_Event_Cb clickCb;
} Scene_Data;
// Elm GL view related data here.
typedef struct _GLData
{
Evas_Object *winwin;
Evas_Object *elmGl;
Evas_GL_API *glApi;
int sfc_w, sfc_h; // This is what Irrlicht is using, size of the GL image surface / glview.
int img_w, img_h; // Size of the viewport. DON'T reuse sfc_* here. Despite the fact that sfc_* is only used in the init when Irricht is disabled? WTF?
int useIrr : 1;
int doneIrr : 1;
int gearsInited : 1;
int resized : 1;
IrrlichtDevice *device;
IVideoDriver *driver;
ISceneManager *smgr;
ICameraSceneNode *camera;
cameraMove *move;
#if DO_GEARS
GLuint program;
GLuint vtx_shader;
GLuint fgmt_shader;
GLfloat view_rotx;
GLfloat view_roty;
GLfloat view_rotz;
Gear *gear1;
Gear *gear2;
Gear *gear3;
GLfloat angle;
GLuint proj_location;
GLuint light_location;
GLuint color_location;
GLfloat proj[16];
GLfloat light[3];
#endif
} GLData;
typedef struct _globals
{
#if USE_IRR
Ecore_Evas *ee;
#endif
Evas *evas;
Evas_Object *win; // Our Elm window.
Evas_Object *tb; // Our Elm toolbar.
int logDom; // Our logging domain.
winFang *mainWindow;
int scr_w, scr_h; // The size of the screen.
int win_w, win_h; // The size of the window.
int win_x, win_y; // The position of the window.
Ecore_Animator *animator;
GLData gld;
Scene_Data *scene;
EPhysics_World *world;
winFang *files;
GuiLua *purkle;
Ecore_Con_Server *server;
const char *address;
int port;
} globals;
extern globals ourGlobals;
#if DO_GEARS
void gears_init(GLData *gld);
void drawGears(GLData *gld);
void free_gear(Gear *gear);
#endif
EPhysics_World *ephysicsAdd(globals *ourGlobals);
#if USE_IRR
EAPI int startIrr(globals *ourGlobals);
EAPI void drawIrr_start(globals *ourGlobals);
EAPI void drawIrr_end(globals *ourGlobals);
EAPI void finishIrr(globals *ourGlobals);
#endif
void overlay_add(globals *ourGlobals);
EAPI void Evas_3D_Demo_add(globals *ourGlobals);
Eina_Bool _animate_scene(globals *ourGlobals);
void Evas_3D_Demo_fini(globals *ourGlobals);
Scene_Data *scenriAdd(Evas_Object *win);
Evas_3D_Node *cameraAdd(Evas *evas, Scene_Data *scene, Evas_Object *win);
Eina_Bool animateCamera(Scene_Data *scene);
winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save);
void filesShow(winFang *me, Evas_Smart_Cb func, void *data);
winFang *woMan_add(globals *ourGlobals);
#ifdef __cplusplus
}
#endif
#endif
|