diff options
author | perepelits.m <perepelits.m@samsung.com> | 2015-02-20 16:33:17 +0100 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-02-20 16:33:21 +0100 |
commit | bc584cd59bab1af3654e194128436e6aba124f7e (patch) | |
tree | 203683c497a6b689358eedf5657769b51ec0efb3 /src/bin/edje | |
parent | 216397bea635d93266aca73f9e724979375f2e3b (diff) |
edje: add of material properties.
Summary: Filling of fields: "ambient", "diffuse", "specular", "material", "normal", "shininess" and "shade".
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Subscribers: cedric, artem.popov
Differential Revision: https://phab.enlightenment.org/D2011
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/bin/edje')
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 346 |
1 files changed, 346 insertions, 0 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 86316fb528..48eba89059 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -366,6 +366,13 @@ static void st_collections_group_parts_part_description_proxy_source_clip(void); | |||
366 | static void st_collections_group_parts_part_description_position_point(void); | 366 | static void st_collections_group_parts_part_description_position_point(void); |
367 | static void st_collections_group_parts_part_description_position_space(void); | 367 | static void st_collections_group_parts_part_description_position_space(void); |
368 | static void st_collections_group_parts_part_description_camera_properties(void); | 368 | static void st_collections_group_parts_part_description_camera_properties(void); |
369 | static void st_collections_group_parts_part_description_properties_ambient(void); | ||
370 | static void st_collections_group_parts_part_description_properties_diffuse(void); | ||
371 | static void st_collections_group_parts_part_description_properties_specular(void); | ||
372 | static void st_collections_group_parts_part_description_properties_material(void); | ||
373 | static void st_collections_group_parts_part_description_properties_normal(void); | ||
374 | static void st_collections_group_parts_part_description_properties_shininess(void); | ||
375 | static void st_collections_group_parts_part_description_properties_shade(void); | ||
369 | 376 | ||
370 | #ifdef HAVE_EPHYSICS | 377 | #ifdef HAVE_EPHYSICS |
371 | static void st_collections_group_parts_part_description_physics_mass(void); | 378 | static void st_collections_group_parts_part_description_physics_mass(void); |
@@ -719,6 +726,13 @@ New_Statement_Handler statement_handlers[] = | |||
719 | {"collections.group.parts.part.description.position.point", st_collections_group_parts_part_description_position_point}, | 726 | {"collections.group.parts.part.description.position.point", st_collections_group_parts_part_description_position_point}, |
720 | {"collections.group.parts.part.description.position.space", st_collections_group_parts_part_description_position_space}, | 727 | {"collections.group.parts.part.description.position.space", st_collections_group_parts_part_description_position_space}, |
721 | {"collections.group.parts.part.description.properties.perspective", st_collections_group_parts_part_description_camera_properties}, | 728 | {"collections.group.parts.part.description.properties.perspective", st_collections_group_parts_part_description_camera_properties}, |
729 | {"collections.group.parts.part.description.properties.ambient", st_collections_group_parts_part_description_properties_ambient}, | ||
730 | {"collections.group.parts.part.description.properties.diffuse", st_collections_group_parts_part_description_properties_diffuse}, | ||
731 | {"collections.group.parts.part.description.properties.specular", st_collections_group_parts_part_description_properties_specular}, | ||
732 | {"collections.group.parts.part.description.properties.material", st_collections_group_parts_part_description_properties_material}, | ||
733 | {"collections.group.parts.part.description.properties.normal", st_collections_group_parts_part_description_properties_normal}, | ||
734 | {"collections.group.parts.part.description.properties.shininess", st_collections_group_parts_part_description_properties_shininess}, | ||
735 | {"collections.group.parts.part.description.properties.shade", st_collections_group_parts_part_description_properties_shade}, | ||
722 | 736 | ||
723 | #ifdef HAVE_EPHYSICS | 737 | #ifdef HAVE_EPHYSICS |
724 | {"collections.group.parts.part.description.physics.mass", st_collections_group_parts_part_description_physics_mass}, | 738 | {"collections.group.parts.part.description.physics.mass", st_collections_group_parts_part_description_physics_mass}, |
@@ -9135,6 +9149,338 @@ st_collections_group_parts_part_description_camera_properties(void) | |||
9135 | ed->camera.camera.far = FROM_DOUBLE(parse_float(3)); | 9149 | ed->camera.camera.far = FROM_DOUBLE(parse_float(3)); |
9136 | } | 9150 | } |
9137 | 9151 | ||
9152 | /** | ||
9153 | @edcsubsection{collections_group_parts_description_properties,Properties} | ||
9154 | */ | ||
9155 | |||
9156 | /** | ||
9157 | @page edcref | ||
9158 | |||
9159 | @block | ||
9160 | properties | ||
9161 | @context | ||
9162 | part { | ||
9163 | description { | ||
9164 | .. | ||
9165 | properties { | ||
9166 | ambient: red green blue alpha; | ||
9167 | diffuse: red green blue alpha; | ||
9168 | specular: red green blue alpha; | ||
9169 | shade: PHONG; | ||
9170 | material: AMBIENT; | ||
9171 | normal: 1; | ||
9172 | shininess: 50.0; | ||
9173 | } | ||
9174 | .. | ||
9175 | } | ||
9176 | } | ||
9177 | @description | ||
9178 | A properties block defines main lighting atributes of LIGHT and MESH_NODE. | ||
9179 | @endblock | ||
9180 | |||
9181 | @property | ||
9182 | ambient | ||
9183 | @parameters | ||
9184 | [red] [green] [blue] [alpha] | ||
9185 | @effect | ||
9186 | Sets the components of the ambient color. | ||
9187 | @endproperty | ||
9188 | */ | ||
9189 | static void | ||
9190 | st_collections_group_parts_part_description_properties_ambient(void) | ||
9191 | { | ||
9192 | check_arg_count(4); | ||
9193 | |||
9194 | switch (current_part->type) | ||
9195 | { | ||
9196 | case EDJE_PART_TYPE_LIGHT: | ||
9197 | { | ||
9198 | Edje_Part_Description_Light *ed; | ||
9199 | |||
9200 | ed = (Edje_Part_Description_Light*) current_desc; | ||
9201 | |||
9202 | ed->light.properties.ambient.r = parse_float_range(0, 0.0, 1.0); | ||
9203 | ed->light.properties.ambient.g = parse_float_range(1, 0.0, 1.0); | ||
9204 | ed->light.properties.ambient.b = parse_float_range(2, 0.0, 1.0); | ||
9205 | ed->light.properties.ambient.a = parse_float_range(3, 0.0, 1.0); | ||
9206 | break; | ||
9207 | } | ||
9208 | case EDJE_PART_TYPE_MESH_NODE: | ||
9209 | { | ||
9210 | Edje_Part_Description_Mesh_Node *ed; | ||
9211 | |||
9212 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9213 | |||
9214 | ed->mesh_node.properties.ambient.r = parse_float_range(0, 0.0, 1.0); | ||
9215 | ed->mesh_node.properties.ambient.g = parse_float_range(1, 0.0, 1.0); | ||
9216 | ed->mesh_node.properties.ambient.b = parse_float_range(2, 0.0, 1.0); | ||
9217 | ed->mesh_node.properties.ambient.a = parse_float_range(3, 0.0, 1.0); | ||
9218 | break; | ||
9219 | } | ||
9220 | default: | ||
9221 | { | ||
9222 | ERR("parse error %s:%i. light and mesh_node attributes in non-LIGHT and non-MESH_NODE part.", | ||
9223 | file_in, line - 1); | ||
9224 | exit(-1); | ||
9225 | } | ||
9226 | } | ||
9227 | } | ||
9228 | |||
9229 | /** | ||
9230 | @page edcref | ||
9231 | @property | ||
9232 | diffuse | ||
9233 | @parameters | ||
9234 | [red] [green] [blue] [alpha] | ||
9235 | @effect | ||
9236 | Sets the components of the ambient color. | ||
9237 | @endproperty | ||
9238 | */ | ||
9239 | static void | ||
9240 | st_collections_group_parts_part_description_properties_diffuse(void) | ||
9241 | { | ||
9242 | check_arg_count(4); | ||
9243 | |||
9244 | switch (current_part->type) | ||
9245 | { | ||
9246 | case EDJE_PART_TYPE_LIGHT: | ||
9247 | { | ||
9248 | Edje_Part_Description_Light *ed; | ||
9249 | |||
9250 | ed = (Edje_Part_Description_Light*) current_desc; | ||
9251 | |||
9252 | ed->light.properties.diffuse.r = parse_float_range(0, 0.0, 1.0); | ||
9253 | ed->light.properties.diffuse.g = parse_float_range(1, 0.0, 1.0); | ||
9254 | ed->light.properties.diffuse.b = parse_float_range(2, 0.0, 1.0); | ||
9255 | ed->light.properties.diffuse.a = parse_float_range(3, 0.0, 1.0); | ||
9256 | break; | ||
9257 | } | ||
9258 | case EDJE_PART_TYPE_MESH_NODE: | ||
9259 | { | ||
9260 | Edje_Part_Description_Mesh_Node *ed; | ||
9261 | |||
9262 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9263 | |||
9264 | ed->mesh_node.properties.diffuse.r = parse_float_range(0, 0.0, 1.0); | ||
9265 | ed->mesh_node.properties.diffuse.g = parse_float_range(1, 0.0, 1.0); | ||
9266 | ed->mesh_node.properties.diffuse.b = parse_float_range(2, 0.0, 1.0); | ||
9267 | ed->mesh_node.properties.diffuse.a = parse_float_range(3, 0.0, 1.0); | ||
9268 | break; | ||
9269 | } | ||
9270 | default: | ||
9271 | { | ||
9272 | ERR("parse error %s:%i. light and mesh_node attributes in non-LIGHT and non-MESH_NODE part.", | ||
9273 | file_in, line - 1); | ||
9274 | exit(-1); | ||
9275 | } | ||
9276 | } | ||
9277 | } | ||
9278 | |||
9279 | /** | ||
9280 | @page edcref | ||
9281 | @property | ||
9282 | specular | ||
9283 | @parameters | ||
9284 | [red] [green] [blue] [alpha] | ||
9285 | @effect | ||
9286 | Sets the components of the ambient color. | ||
9287 | @endproperty | ||
9288 | */ | ||
9289 | static void | ||
9290 | st_collections_group_parts_part_description_properties_specular(void) | ||
9291 | { | ||
9292 | check_arg_count(4); | ||
9293 | |||
9294 | switch (current_part->type) | ||
9295 | { | ||
9296 | case EDJE_PART_TYPE_LIGHT: | ||
9297 | { | ||
9298 | Edje_Part_Description_Light *ed; | ||
9299 | |||
9300 | ed = (Edje_Part_Description_Light*) current_desc; | ||
9301 | |||
9302 | ed->light.properties.specular.r = parse_float_range(0, 0.0, 1.0); | ||
9303 | ed->light.properties.specular.g = parse_float_range(1, 0.0, 1.0); | ||
9304 | ed->light.properties.specular.b = parse_float_range(2, 0.0, 1.0); | ||
9305 | ed->light.properties.specular.a = parse_float_range(3, 0.0, 1.0); | ||
9306 | } | ||
9307 | case EDJE_PART_TYPE_MESH_NODE: | ||
9308 | { | ||
9309 | Edje_Part_Description_Mesh_Node *ed; | ||
9310 | |||
9311 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9312 | |||
9313 | ed->mesh_node.properties.specular.r = parse_float_range(0, 0.0, 1.0); | ||
9314 | ed->mesh_node.properties.specular.g = parse_float_range(1, 0.0, 1.0); | ||
9315 | ed->mesh_node.properties.specular.b = parse_float_range(2, 0.0, 1.0); | ||
9316 | ed->mesh_node.properties.specular.a = parse_float_range(3, 0.0, 1.0); | ||
9317 | break; | ||
9318 | } | ||
9319 | default: | ||
9320 | { | ||
9321 | ERR("parse error %s:%i. light and mesh_node attributes in non-LIGHT and non-MESH_NODE part.", | ||
9322 | file_in, line - 1); | ||
9323 | exit(-1); | ||
9324 | } | ||
9325 | } | ||
9326 | } | ||
9327 | |||
9328 | /** | ||
9329 | @page edcref | ||
9330 | @property | ||
9331 | material | ||
9332 | @parameters | ||
9333 | [MATERIAL] | ||
9334 | @effect | ||
9335 | Sets the color mode for the lighting. Valid color modes: | ||
9336 | @li AMBIENT | ||
9337 | @li DIFFUSE | ||
9338 | @li SPECULAR | ||
9339 | @li EMISSION | ||
9340 | @li NORMAL | ||
9341 | @endproperty | ||
9342 | */ | ||
9343 | static void | ||
9344 | st_collections_group_parts_part_description_properties_material(void) | ||
9345 | { | ||
9346 | unsigned int material_attrib; | ||
9347 | |||
9348 | check_arg_count(1); | ||
9349 | |||
9350 | material_attrib = parse_enum(0, | ||
9351 | "AMBIENT", EVAS_3D_MATERIAL_AMBIENT, | ||
9352 | "DIFFUSE", EVAS_3D_MATERIAL_DIFFUSE, | ||
9353 | "SPECULAR", EVAS_3D_MATERIAL_SPECULAR, | ||
9354 | "EMISSION", EVAS_3D_MATERIAL_EMISSION, | ||
9355 | "NORMAL", EVAS_3D_MATERIAL_NORMAL, | ||
9356 | NULL); | ||
9357 | |||
9358 | if (current_part->type == EDJE_PART_TYPE_MESH_NODE) | ||
9359 | { | ||
9360 | Edje_Part_Description_Mesh_Node *ed; | ||
9361 | |||
9362 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9363 | |||
9364 | ed->mesh_node.properties.material_attrib = material_attrib; | ||
9365 | } | ||
9366 | else | ||
9367 | { | ||
9368 | ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", | ||
9369 | file_in, line - 1); | ||
9370 | exit(-1); | ||
9371 | } | ||
9372 | } | ||
9373 | |||
9374 | /** | ||
9375 | @page edcref | ||
9376 | @property | ||
9377 | normal | ||
9378 | @parameters | ||
9379 | [0 or 1] | ||
9380 | @effect | ||
9381 | Sets the material attribute enable flag of the given material. | ||
9382 | @endproperty | ||
9383 | */ | ||
9384 | static void | ||
9385 | st_collections_group_parts_part_description_properties_normal(void) | ||
9386 | { | ||
9387 | check_arg_count(1); | ||
9388 | |||
9389 | if (current_part->type == EDJE_PART_TYPE_MESH_NODE) | ||
9390 | { | ||
9391 | Edje_Part_Description_Mesh_Node *ed; | ||
9392 | |||
9393 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9394 | |||
9395 | ed->mesh_node.properties.normal = parse_bool(0); | ||
9396 | } | ||
9397 | else | ||
9398 | { | ||
9399 | ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", | ||
9400 | file_in, line - 1); | ||
9401 | exit(-1); | ||
9402 | } | ||
9403 | } | ||
9404 | |||
9405 | /** | ||
9406 | @page edcref | ||
9407 | @property | ||
9408 | shininess | ||
9409 | @parameters | ||
9410 | [shininess] | ||
9411 | @effect | ||
9412 | Sets the shininess of the given material. | ||
9413 | @endproperty | ||
9414 | */ | ||
9415 | static void | ||
9416 | st_collections_group_parts_part_description_properties_shininess(void) | ||
9417 | { | ||
9418 | check_arg_count(1); | ||
9419 | |||
9420 | if (current_part->type == EDJE_PART_TYPE_MESH_NODE) | ||
9421 | { | ||
9422 | Edje_Part_Description_Mesh_Node *ed; | ||
9423 | |||
9424 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9425 | |||
9426 | ed->mesh_node.properties.shininess = FROM_DOUBLE(parse_float(0)); | ||
9427 | } | ||
9428 | else | ||
9429 | { | ||
9430 | ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", | ||
9431 | file_in, line - 1); | ||
9432 | exit(-1); | ||
9433 | } | ||
9434 | } | ||
9435 | |||
9436 | /** | ||
9437 | @page edcref | ||
9438 | @property | ||
9439 | shade | ||
9440 | @parameters | ||
9441 | [SHADE] | ||
9442 | @effect | ||
9443 | Sets the shade mode for MESH_NODE. Valid shade modes: | ||
9444 | @li COLOR | ||
9445 | @li DIFFUSE | ||
9446 | @li FLAT | ||
9447 | @li PHONG | ||
9448 | @li MAP | ||
9449 | @li RENDER | ||
9450 | @endproperty | ||
9451 | */ | ||
9452 | |||
9453 | static void | ||
9454 | st_collections_group_parts_part_description_properties_shade(void) | ||
9455 | { | ||
9456 | unsigned int shade; | ||
9457 | |||
9458 | check_arg_count(1); | ||
9459 | |||
9460 | shade = parse_enum(0, | ||
9461 | "VERTEX_COLOR", EVAS_3D_SHADE_MODE_VERTEX_COLOR, | ||
9462 | "PARENT", EVAS_3D_SHADE_MODE_DIFFUSE, | ||
9463 | "WORLD", EVAS_3D_SHADE_MODE_FLAT, | ||
9464 | "PHONG", EVAS_3D_SHADE_MODE_PHONG, | ||
9465 | "NORMAL_MAP", EVAS_3D_SHADE_MODE_NORMAL_MAP, | ||
9466 | "RENDER", EVAS_3D_SHADE_MODE_SHADOW_MAP_RENDER, | ||
9467 | NULL); | ||
9468 | |||
9469 | if (current_part->type == EDJE_PART_TYPE_MESH_NODE) | ||
9470 | { | ||
9471 | Edje_Part_Description_Mesh_Node *ed; | ||
9472 | |||
9473 | ed = (Edje_Part_Description_Mesh_Node*) current_desc; | ||
9474 | |||
9475 | ed->mesh_node.properties.shade = shade; | ||
9476 | } | ||
9477 | else | ||
9478 | { | ||
9479 | ERR("parse error %s:%i. mesh_node attributes in non-MESH_NODE part.", | ||
9480 | file_in, line - 1); | ||
9481 | exit(-1); | ||
9482 | } | ||
9483 | } | ||
9138 | 9484 | ||
9139 | static void | 9485 | static void |
9140 | st_collections_group_parts_part_description_proxy_source_visible(void) | 9486 | st_collections_group_parts_part_description_proxy_source_visible(void) |