aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/extantz.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/extantz/extantz.h')
-rw-r--r--src/extantz/extantz.h215
1 files changed, 215 insertions, 0 deletions
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h
new file mode 100644
index 0000000..afb94af
--- /dev/null
+++ b/src/extantz/extantz.h
@@ -0,0 +1,215 @@
1#define USE_EO 0
2#define USE_PHYSICS 1
3#define USE_EGL 1 // If using Evas_GL, though it might be via Elm.
4#define USE_ELM_GL 1
5#define USE_IRR 1
6#define USE_DEMO 1
7#define DO_GEARS 0
8
9#if USE_EO
10 /* Enable access to unstable EFL API that are still in beta */
11 #define EFL_BETA_API_SUPPORT 1
12 /* Enable access to unstable EFL EO API. */
13 #define EFL_EO_API_SUPPORT 1
14#endif
15
16#include <Elementary.h>
17#include <elm_widget_glview.h>
18#include <Evas_GL.h>
19#include <EPhysics.h>
20#include "extantzCamera.h"
21
22
23#ifdef GL_GLES
24#include <EGL/egl.h>
25#include <EGL/eglext.h>
26#else
27# include <GL/glext.h>
28# include <GL/glx.h>
29#endif
30
31
32#ifdef __cplusplus
33/*
34In the Irrlicht Engine, everything can be found in the namespace 'irr'. So if
35you want to use a class of the engine, you have to write irr:: before the name
36of the class. For example to use the IrrlichtDevice write: irr::IrrlichtDevice.
37To get rid of the irr:: in front of the name of every class, we tell the
38compiler that we use that namespace from now on, and we will not have to write
39irr:: anymore.
40*/
41using namespace irr;
42
43/*
44There are 5 sub namespaces in the Irrlicht Engine. Take a look at them, you can
45read a detailed description of them in the documentation by clicking on the top
46menu item 'Namespace List' or by using this link:
47http://irrlicht.sourceforge.net/docu/namespaces.html
48Like the irr namespace, we do not want these 5 sub namespaces now, to keep this
49example simple. Hence, we tell the compiler again that we do not want always to
50write their names.
51*/
52using namespace core;
53using namespace scene;
54using namespace video;
55
56extern "C"{
57#else
58
59// Irrlicht stuff. It's C++, so we gotta use incomplete types.
60typedef struct IrrlichtDevice IrrlichtDevice;
61typedef struct IVideoDriver IVideoDriver;
62typedef struct ISceneManager ISceneManager;
63typedef struct ICameraSceneNode ICameraSceneNode;
64
65#endif
66
67
68#define CRI(...) EINA_LOG_DOM_CRIT(_log_domain, _VA_ARGS__)
69#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
70#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
71#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
72#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
73
74extern int _log_domain;
75
76
77typedef struct _Gear Gear;
78typedef struct _GLData GLData;
79
80typedef enum
81{
82 EZP_NONE,
83 EZP_AURORA,
84 EZP_OPENSIM,
85 EZP_SECOND_LIFE,
86 EZP_SLEDJHAMR,
87 EZP_TRITIUM
88} ezPlatform;
89
90typedef struct
91{
92 char *name;
93 char *version; // Version string.
94 char *path; // OS filesystem path to the viewer install.
95 char *icon;
96 uint16_t tag; // The UUID of the texture used in the avatar bake hack.
97 uint8_t r, g, b; // Colour used for the in world tag.
98 Elm_Object_Item *item;
99} ezViewer;
100
101typedef struct
102{
103 Eina_Clist accounts;
104 Eina_Clist landmarks;
105 char *name;
106 char *loginURI;
107 char *splashPage;
108 char *helperURI;
109 char *website;
110 char *supportPage;
111 char *registerPage;
112 char *passwordPage;
113 char *icon;
114 ezPlatform platform;
115 ezViewer *viewer;
116 Elm_Object_Item *item;
117GLData *gld; // Just a temporary evil hack to pass gld to _grid_sel_cb().
118} ezGrid;
119
120typedef struct
121{
122 Eina_Clist grid;
123 char *name;
124 char *password; // Think we need to pass unencrypted passwords to the viewer. B-(
125 char *icon;
126 ezViewer *viewer;
127} ezAccount;
128
129typedef struct
130{
131 Eina_Clist grid;
132 char *name;
133 char *sim;
134 char *screenshot;
135 short x, y, z;
136} ezLandmark;
137
138
139
140struct _Gear
141{
142 GLfloat *vertices;
143 GLuint vbo;
144 int count;
145};
146
147// GL related data here.
148struct _GLData
149{
150 Evas_Object *win, *winwin;
151
152 Ecore_Evas *ee;
153 Evas *canvas;
154 Evas_Native_Surface ns;
155
156 Evas_GL_Context *ctx;
157 Evas_GL_Surface *sfc;
158 Evas_GL_Config *cfg;
159 Evas_GL *evasGl; // The Evas way.
160 Evas_Object *elmGl; // The Elm way.
161 Evas_GL_API *glApi;
162
163 GLuint program;
164 GLuint vtx_shader;
165 GLuint fgmt_shader;
166 int scr_w, scr_h; // The size of the screen.
167 int win_w, win_h; // The size of the window.
168 int win_x, win_y; // The position of the window.
169 int sfc_w, sfc_h; // This is what Irrlicht is using, size of the GL image surface / glview.
170 int img_w, img_h; // Size of the viewport. DON'T reuse sfc_* here. Despite the fach that sfc_* is only used in the init when Irricht is disabled? WTF?
171 int useEGL : 1;
172 int useIrr : 1;
173 int doneIrr : 1;
174 int gearsInited : 1;
175 int resized : 1;
176
177 Evas_Object *bx, *r1;
178 Ecore_Animator *animator;
179
180 IrrlichtDevice *device;
181 IVideoDriver *driver;
182 ISceneManager *smgr;
183 ICameraSceneNode *camera;
184
185 cameraMove *move;
186
187 // Gear Stuff
188 GLfloat view_rotx;
189 GLfloat view_roty;
190 GLfloat view_rotz;
191
192 Gear *gear1;
193 Gear *gear2;
194 Gear *gear3;
195
196 GLfloat angle;
197
198 GLuint proj_location;
199 GLuint light_location;
200 GLuint color_location;
201
202 GLfloat proj[16];
203 GLfloat light[3];
204};
205
206
207EAPI int startIrr(GLData *gld);
208EAPI void drawIrr_start(GLData *gld);
209EAPI void drawIrr_end(GLData *gld);
210EAPI void finishIrr(GLData *gld);
211
212#ifdef __cplusplus
213}
214#endif
215