summaryrefslogtreecommitdiff
path: root/src/examples/evas/shooter/evas-3d-shooter-macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/evas/shooter/evas-3d-shooter-macros.h')
-rw-r--r--src/examples/evas/shooter/evas-3d-shooter-macros.h109
1 files changed, 48 insertions, 61 deletions
diff --git a/src/examples/evas/shooter/evas-3d-shooter-macros.h b/src/examples/evas/shooter/evas-3d-shooter-macros.h
index e19a507..cae6417 100644
--- a/src/examples/evas/shooter/evas-3d-shooter-macros.h
+++ b/src/examples/evas/shooter/evas-3d-shooter-macros.h
@@ -110,111 +110,98 @@ typedef struct _vec2
110 110
111 111
112#define ENABLE_FOG(mesh) \ 112#define ENABLE_FOG(mesh) \
113 eo_do(mesh, evas_canvas3d_mesh_fog_enable_set(EINA_TRUE), \ 113 evas_canvas3d_mesh_fog_enable_set(mesh, EINA_TRUE); \
114 evas_canvas3d_mesh_fog_color_set(FOG_COLOR, FOG_FACTOR)); 114 evas_canvas3d_mesh_fog_color_set(mesh, FOG_COLOR, FOG_FACTOR);
115 115
116 116
117#define DISABLE_FOG(mesh) \ 117#define DISABLE_FOG(mesh) \
118 eo_do(mesh, evas_canvas3d_mesh_fog_enable_set(EINA_FALSE)); 118 evas_canvas3d_mesh_fog_enable_set(mesh, EINA_FALSE);
119 119
120 120
121#define ENABLE_NORMAL(mesh) \ 121#define ENABLE_NORMAL(mesh) \
122 eo_do(mesh, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP)); 122 evas_canvas3d_mesh_shade_mode_set(mesh, EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP);
123 123
124 124
125#define DISABLE_NORMAL(mesh) \ 125#define DISABLE_NORMAL(mesh) \
126 eo_do(mesh, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 126 evas_canvas3d_mesh_shade_mode_set(mesh, EVAS_CANVAS3D_SHADE_MODE_PHONG);
127 127
128 128
129#define ADD_MESH(Object, Name, a, d, s) \ 129#define ADD_MESH(Object, Name, a, d, s) \
130 data->material_##Object = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); \ 130 data->material_##Object = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); \
131 \ 131 \
132 eo_do(data->material_##Object, \ 132 evas_canvas3d_material_enable_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE); \
133 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), \ 133 evas_canvas3d_material_enable_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE); \
134 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), \ 134 evas_canvas3d_material_enable_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE); \
135 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), \ 135 evas_canvas3d_material_enable_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE); \
136 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE), \ 136 evas_canvas3d_material_color_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, a, a, a, 1.0); \
137 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, a, a, a, 1.0), \ 137 evas_canvas3d_material_color_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, d, d, d, 1.0); \
138 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, d, d, d, 1.0), \ 138 evas_canvas3d_material_color_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, s, s, s, 1.0); \
139 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, s, s, s, 1.0), \ 139 evas_canvas3d_material_shininess_set(data->material_##Object, 50.0); \
140 evas_canvas3d_material_shininess_set(50.0)); \
141 \ 140 \
142 data->mesh_##Name = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 141 data->mesh_##Name = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
143 142
144#define SETUP_DEFAULT_MESH(Object, Name, Shade_Mode) \ 143#define SETUP_DEFAULT_MESH(Object, Name, Shade_Mode) \
145 eo_do(data->mesh_##Name, \ 144 evas_canvas3d_mesh_shade_mode_set(data->mesh_##Name, EVAS_CANVAS3D_SHADE_MODE_##Shade_Mode); \
146 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_##Shade_Mode), \ 145 evas_canvas3d_mesh_vertex_assembly_set(data->mesh_##Name, EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES); \
147 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES), \ 146 evas_canvas3d_mesh_frame_material_set(data->mesh_##Name, 0, data->material_##Object);
148 evas_canvas3d_mesh_frame_material_set(0, data->material_##Object));
149 147
150 148
151#define SETUP_MESH_NODE(Name) \ 149#define SETUP_MESH_NODE(Name) \
152 data->mesh_node_##Name = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, \ 150 data->mesh_node_##Name = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH)); \
153 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); \
154 \ 151 \
155 eo_do(data->mesh_node_##Name, \ 152 evas_canvas3d_node_mesh_add(data->mesh_node_##Name, data->mesh_##Name);
156 evas_canvas3d_node_mesh_add(data->mesh_##Name));
157 153
158 154
159#define MATERIAL_TEXTURE_SET(Object, Name, file, image) \ 155#define MATERIAL_TEXTURE_SET(Object, Name, file, image) \
160 eo_do(data->mesh_##Name, \ 156 efl_file_set(data->mesh_##Name, file, NULL); \
161 efl_file_set(file, NULL)); \
162 \ 157 \
163 SETUP_DEFAULT_MESH(Object, Name, PHONG) \ 158 SETUP_DEFAULT_MESH(Object, Name, PHONG) \
164 data->texture_diffuse_##Object = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ 159 data->texture_diffuse_##Object = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \
165 \ 160 \
166 eo_do(data->texture_diffuse_##Object, \ 161 evas_canvas3d_texture_atlas_enable_set(data->texture_diffuse_##Object, EINA_FALSE); \
167 evas_canvas3d_texture_atlas_enable_set(EINA_FALSE), \ 162 evas_canvas3d_texture_file_set(data->texture_diffuse_##Object, image, NULL); \
168 evas_canvas3d_texture_file_set(image, NULL), \ 163 evas_canvas3d_texture_filter_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \
169 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ 164 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \
170 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST), \ 165 evas_canvas3d_texture_wrap_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); \
171 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT)); \
172 \ 166 \
173 eo_do(data->material_##Object, \ 167 evas_canvas3d_material_texture_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, \
174 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, \ 168 data->texture_diffuse_##Object); \
175 data->texture_diffuse_##Object), \ 169 evas_canvas3d_material_texture_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, \
176 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, \ 170 data->texture_diffuse_##Object);
177 data->texture_diffuse_##Object));
178 171
179 172
180#define CUBE_TEXTURE_SET(Object, Name, vertex, image) \ 173#define CUBE_TEXTURE_SET(Object, Name, vertex, image) \
181 eo_do(data->mesh_##Name, \ 174 evas_canvas3d_mesh_from_primitive_set(data->mesh_##Name, 0, data->cube_primitive); \
182 evas_canvas3d_mesh_from_primitive_set(0, data->cube_primitive), \ 175 evas_canvas3d_mesh_frame_vertex_data_set(data->mesh_##Name, 0, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, \
183 evas_canvas3d_mesh_frame_vertex_data_set(0, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, \ 176 2 * sizeof(float), vertex); \
184 2 * sizeof(float), vertex)); \
185 SETUP_DEFAULT_MESH(Object, Name, NORMAL_MAP) \ 177 SETUP_DEFAULT_MESH(Object, Name, NORMAL_MAP) \
186 data->texture_diffuse_##Object = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ 178 data->texture_diffuse_##Object = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \
187 \ 179 \
188 eo_do(data->texture_diffuse_##Object, \ 180 evas_canvas3d_texture_atlas_enable_set(data->texture_diffuse_##Object, EINA_FALSE); \
189 evas_canvas3d_texture_atlas_enable_set(EINA_FALSE), \ 181 evas_canvas3d_texture_file_set(data->texture_diffuse_##Object, image, NULL); \
190 evas_canvas3d_texture_file_set(image, NULL), \ 182 evas_canvas3d_texture_filter_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \
191 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ 183 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \
192 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST), \ 184 evas_canvas3d_texture_wrap_set(data->texture_diffuse_##Object, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); \
193 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT)); \
194 \ 185 \
195 eo_do(data->material_##Object, \ 186 evas_canvas3d_material_texture_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, \
196 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, \ 187 data->texture_diffuse_##Object); \
197 data->texture_diffuse_##Object), \ 188 evas_canvas3d_material_texture_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, \
198 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, \ 189 data->texture_diffuse_##Object);
199 data->texture_diffuse_##Object));
200 190
201 191
202#define NORMAL_SET(Object, Name, normal) \ 192#define NORMAL_SET(Object, Name, normal) \
203 data->texture_normal_##Object = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \ 193 data->texture_normal_##Object = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); \
204 \ 194 \
205 eo_do(data->texture_normal_##Object, \ 195 evas_canvas3d_texture_atlas_enable_set(data->texture_normal_##Object, EINA_FALSE); \
206 evas_canvas3d_texture_atlas_enable_set(EINA_FALSE), \ 196 evas_canvas3d_texture_file_set(data->texture_normal_##Object, normal, NULL); \
207 evas_canvas3d_texture_file_set(normal, NULL), \ 197 evas_canvas3d_texture_filter_set(data->texture_normal_##Object, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \
208 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, \ 198 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST); \
209 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST), \ 199 evas_canvas3d_texture_wrap_set(data->texture_normal_##Object, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT); \
210 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT)); \
211 \ 200 \
212 eo_do(data->material_##Object, \ 201 evas_canvas3d_material_texture_set(data->material_##Object, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, \
213 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, \ 202 data->texture_normal_##Object); \
214 data->texture_normal_##Object)); \
215 \ 203 \
216 eo_do(data->mesh_##Name, \ 204 evas_canvas3d_mesh_shade_mode_set(data->mesh_##Name, EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP);
217 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP));
218 205
219#define TEXTCOORDS_SET(Name, fb1, fb2, lr1, lr2, tb1, tb2) \ 206#define TEXTCOORDS_SET(Name, fb1, fb2, lr1, lr2, tb1, tb2) \
220 static float Name##_textcoords[] = \ 207 static float Name##_textcoords[] = \