Fix for internal bug.
[profile/ivi/ico-uxf-homescreen-sample-apps.git] / ico-app-samplenavi / src / e3d.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the 
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9 /**
10  * @brief   header file oflibrary which displays 3D field of view
11  *
12  * @date    Apr-25-2013
13  */
14
15 #ifndef SAMPLENAVI_E3D_H_
16 #define SAMPLENAVI_E3D_H_
17
18 #include <Ecore_Evas.h>
19 #include <stdio.h>
20 #include <math.h>
21 #include <stdlib.h>
22 #include "define.h"
23 #include "samplenavi.h"
24
25 /* Functions */
26 void init_e3d(Evas *e3d, void *p_in, size_t len);
27 void e3d_cleanup();
28 void draw_route(Evas *e3d);
29 void draw_landmark(Evas *e3d);
30 void calc_camera_coord();
31
32 #ifdef _USE_Z_LIMIT_FIX_
33 enum Check_Route
34 {
35     NONE,
36     STARTING_POINT,        /* FIXED Z_LIMIT START POINT */
37     ENDING_POINT,          /* FIXED Z_LIMIT END POINT */
38     BOTH_POINT             /* FIXED Z_LIMIT START/END POINT */
39 };
40 #endif
41
42 /* Structs */
43 typedef struct _CsvRoute
44 {
45     double lon;
46     double lat;
47 } CsvRoute;
48
49 typedef struct _CsvLandmark
50 {
51     double lon;
52     double lat;
53     char id;
54 } CsvLandmark;
55
56 typedef struct _Point
57 {
58     double x, y, z, u, v;
59 #ifdef _USE_Z_LIMIT_FIX_
60     enum Check_Route status;
61     char enable_fix;
62 #endif
63 } Point;
64
65 typedef struct _Plane
66 {
67     Evas_Object *o;
68     Point pt[4];
69     int drawable;
70 } Plane;
71
72 typedef struct _Cube
73 {
74     Plane side[6];
75     double angle;
76 } Cube;
77
78 /* Camera Positions */
79 typedef struct _Camera
80 {
81     Evas_Coord x, y, z;
82     double angle;
83 } Camera;
84
85 typedef struct _CameraGeocode
86 {
87     double lat, lon;
88     int dir;
89 } CameraGeocode;
90
91 typedef struct _MapPos
92 {
93     double lat;
94     double lon;
95     int dir;
96 } MapPos;
97
98 /* Extern */
99 extern Camera camera;
100 extern CameraGeocode camera_geocode;
101 extern MapPos map_pos;
102 extern char set_route;
103 extern char enable_navi;
104 extern double goal_square_length;
105
106 #ifdef _SHOW_FPS_
107 extern int polygon_count;
108 #endif
109
110 /* Macros */
111 #define POINT(point, xx, yy, zz, uu, vv) \
112     point.x = xx; \
113     point.y = yy; \
114     point.z = zz; \
115     point.u = uu; \
116     point.v = vv
117
118 #define PLANE_POINT(plane, i, xx, yy, zz, uu, vv) \
119     plane->pt[i].x = xx; \
120     plane->pt[i].y = yy; \
121     plane->pt[i].z = zz; \
122     plane->pt[i].u = uu; \
123     plane->pt[i].v = vv
124
125 #define SIDE_POINT(p, xx, yy, zz, uu, vv) \
126     plane->pt[p].x = xx; \
127     plane->pt[p].y = yy; \
128     plane->pt[p].z = zz; \
129     plane->pt[p].u = uu; \
130     plane->pt[p].v = vv
131
132 #define CUBE_POINT(n, p, xx, yy, zz, uu, vv) \
133     c->side[n].pt[p].x = xx; \
134     c->side[n].pt[p].y = yy; \
135     c->side[n].pt[p].z = zz; \
136     c->side[n].pt[p].u = uu; \
137     c->side[n].pt[p].v = vv
138
139
140 #endif /* SAMPLENAVI_E3D_H_ */