summaryrefslogtreecommitdiff
path: root/src/bin/edje/edje_cc_handlers.c
diff options
context:
space:
mode:
authorperepelits.m <perepelits.m@samsung.com>2015-02-23 14:36:55 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-23 15:46:41 +0100
commitc9c659f5c212b6411e68a70687094355e09e229c (patch)
treedb1ebe21391a651ad4d2eb06d6eb6d1352a52c8c /src/bin/edje/edje_cc_handlers.c
parent1b142d09d951a53e44ce2f1a98b5cc85616756f9 (diff)
edje: add orientation properties for Evas_3D node.
Summary: Adding of two modes of node orientation: by setting of the target name and by setting of the point to look on. Reviewers: Hermet, raster, cedric Subscribers: cedric, artem.popov Differential Revision: https://phab.enlightenment.org/D2014 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/bin/edje/edje_cc_handlers.c198
1 files changed, 198 insertions, 0 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 554e9fb4ed..27cfeb9568 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -373,6 +373,9 @@ static void st_collections_group_parts_part_description_properties_material(void
373static void st_collections_group_parts_part_description_properties_normal(void); 373static void st_collections_group_parts_part_description_properties_normal(void);
374static void st_collections_group_parts_part_description_properties_shininess(void); 374static void st_collections_group_parts_part_description_properties_shininess(void);
375static void st_collections_group_parts_part_description_properties_shade(void); 375static void st_collections_group_parts_part_description_properties_shade(void);
376static void st_collections_group_parts_part_description_orientation_look1(void);
377static void st_collections_group_parts_part_description_orientation_look2(void);
378static void st_collections_group_parts_part_description_orientation_look_to(void);
376 379
377#ifdef HAVE_EPHYSICS 380#ifdef HAVE_EPHYSICS
378static void st_collections_group_parts_part_description_physics_mass(void); 381static void st_collections_group_parts_part_description_physics_mass(void);
@@ -522,6 +525,43 @@ static void st_collections_group_nobroadcast(void);
522 PROGRAM_BASE(PREFIX) \ 525 PROGRAM_BASE(PREFIX) \
523 PROGRAM_BASE(PREFIX".programs") 526 PROGRAM_BASE(PREFIX".programs")
524 527
528#define SET_LOOK1(Type, type_node) \
529 Edje_Part_Description_##Type *ed; \
530 ed = (Edje_Part_Description_##Type*) current_desc; \
531 \
532 if (ed->type_node.orientation.type <= EVAS_3D_NODE_ORIENTATION_TYPE_LOOK_AT) \
533 { \
534 ed->type_node.orientation.data[0] = FROM_DOUBLE(parse_float(0)); \
535 ed->type_node.orientation.data[1] = FROM_DOUBLE(parse_float(1)); \
536 ed->type_node.orientation.data[2] = FROM_DOUBLE(parse_float(2)); \
537 ed->type_node.orientation.type = EVAS_3D_NODE_ORIENTATION_TYPE_LOOK_AT; \
538 }
539
540#define SET_LOOK2(Type, type_node) \
541 Edje_Part_Description_##Type *ed; \
542 ed = (Edje_Part_Description_##Type*) current_desc; \
543 \
544 if (ed->type_node.orientation.type <= EVAS_3D_NODE_ORIENTATION_TYPE_LOOK_AT) \
545 { \
546 ed->type_node.orientation.data[3] = FROM_DOUBLE(parse_float(0)); \
547 ed->type_node.orientation.data[4] = FROM_DOUBLE(parse_float(1)); \
548 ed->type_node.orientation.data[5] = FROM_DOUBLE(parse_float(2)); \
549 ed->type_node.orientation.type = EVAS_3D_NODE_ORIENTATION_TYPE_LOOK_AT; \
550 }
551
552#define SET_LOOK_TO(list, Type, type_node) \
553 Edje_Part_Description_##Type *ed; \
554 char *name; \
555 \
556 ed = (Edje_Part_Description_##Type*) current_desc; \
557 \
558 if (ed->type_node.orientation.type <= EVAS_3D_NODE_ORIENTATION_TYPE_LOOK_TO) \
559 { \
560 name = parse_str(0); \
561 data_queue_part_lookup(list, name, &(ed->type_node.orientation.look_to)); \
562 free(name); \
563 ed->type_node.orientation.type = EVAS_3D_NODE_ORIENTATION_TYPE_LOOK_TO; \
564 }
525 565
526New_Statement_Handler statement_handlers[] = 566New_Statement_Handler statement_handlers[] =
527{ 567{
@@ -733,6 +773,9 @@ New_Statement_Handler statement_handlers[] =
733 {"collections.group.parts.part.description.properties.normal", st_collections_group_parts_part_description_properties_normal}, 773 {"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}, 774 {"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}, 775 {"collections.group.parts.part.description.properties.shade", st_collections_group_parts_part_description_properties_shade},
776 {"collections.group.parts.part.description.orientation.look1", st_collections_group_parts_part_description_orientation_look1},
777 {"collections.group.parts.part.description.orientation.look2", st_collections_group_parts_part_description_orientation_look2},
778 {"collections.group.parts.part.description.orientation.look_to", st_collections_group_parts_part_description_orientation_look_to},
736 779
737#ifdef HAVE_EPHYSICS 780#ifdef HAVE_EPHYSICS
738 {"collections.group.parts.part.description.physics.mass", st_collections_group_parts_part_description_physics_mass}, 781 {"collections.group.parts.part.description.physics.mass", st_collections_group_parts_part_description_physics_mass},
@@ -9482,6 +9525,161 @@ st_collections_group_parts_part_description_properties_shade(void)
9482 } 9525 }
9483} 9526}
9484 9527
9528/**
9529 @edcsubsection{collections_group_parts_description_orientation,Orientation}
9530 */
9531
9532/**
9533 @page edcref
9534
9535 @block
9536 orientation
9537 @context
9538 part {
9539 description {
9540 ..
9541 orientation {
9542 look1: [x] [y] [z];
9543 look2: [x] [y] [z];
9544 look_to: [another part's name];
9545 angle_axis: [w] [x] [y] [z];
9546 quaternion: [x] [y] [z] [w];
9547 }
9548 ..
9549 }
9550 }
9551 @description
9552 The orientation block defines an orientation of CAMERA, LIGHT or MESH_NODE in the scene.
9553 @endblock
9554
9555 @property
9556 look1
9557 @parameters
9558 [x] [y] [z]
9559 @effect
9560 Indicates a target point for CAMERA and MESH_NODE or for LIGHt to see or
9561 to illuminate.
9562 @endproperty
9563*/
9564static void
9565st_collections_group_parts_part_description_orientation_look1(void)
9566{
9567 check_arg_count(3);
9568
9569 switch (current_part->type)
9570 {
9571 case EDJE_PART_TYPE_CAMERA:
9572 {
9573 SET_LOOK1(Camera, camera);
9574 break;
9575 }
9576 case EDJE_PART_TYPE_LIGHT:
9577 {
9578 SET_LOOK1(Light, light);
9579 break;
9580 }
9581 case EDJE_PART_TYPE_MESH_NODE:
9582 {
9583 SET_LOOK1(Mesh_Node, mesh_node);
9584 break;
9585 }
9586 default:
9587 {
9588 ERR("parse error %s:%i. camera, light and mesh_node attributes in non-CAMERA, non-LIGHT and non-MESH_NODE part.",
9589 file_in, line - 1);
9590 exit(-1);
9591 }
9592 }
9593}
9594
9595/**
9596 @page edcref
9597 @property
9598 look2
9599 @parameters
9600 [x] [y] [z]
9601 @effect
9602 Specifies the angle at which the target point will be caught.
9603 @endproperty
9604*/
9605static void
9606st_collections_group_parts_part_description_orientation_look2(void)
9607{
9608 check_arg_count(3);
9609
9610 switch (current_part->type)
9611 {
9612 case EDJE_PART_TYPE_CAMERA:
9613 {
9614 SET_LOOK2(Camera, camera);
9615 break;
9616 }
9617 case EDJE_PART_TYPE_LIGHT:
9618 {
9619 SET_LOOK2(Light, light);
9620 break;
9621 }
9622 case EDJE_PART_TYPE_MESH_NODE:
9623 {
9624 SET_LOOK2(Mesh_Node, mesh_node);
9625 break;
9626 }
9627 default:
9628 {
9629 ERR("parse error %s:%i. camera, light and mesh_node attributes in non-CAMERA, non-LIGHT and non-MESH_NODE part.",
9630 file_in, line - 1);
9631 exit(-1);
9632 }
9633 }
9634}
9635
9636/**
9637 @page edcref
9638 @property
9639 look_to
9640 @parameters
9641 [another part's name]
9642 @effect
9643 Indicates another part to make target of CAMERA, LIGHT or MESH_NODE
9644 or LIGHT.
9645 @endproperty
9646*/
9647static void
9648st_collections_group_parts_part_description_orientation_look_to(void)
9649{
9650 Edje_Part_Collection *pc;
9651
9652 check_arg_count(1);
9653
9654 pc = eina_list_data_get(eina_list_last(edje_collections));
9655
9656 switch (current_part->type)
9657 {
9658 case EDJE_PART_TYPE_CAMERA:
9659 {
9660 SET_LOOK_TO(pc, Camera, camera);
9661 break;
9662 }
9663 case EDJE_PART_TYPE_LIGHT:
9664 {
9665 SET_LOOK_TO(pc, Light, light);
9666 break;
9667 }
9668 case EDJE_PART_TYPE_MESH_NODE:
9669 {
9670 SET_LOOK_TO(pc, Mesh_Node, mesh_node);
9671 break;
9672 }
9673 default:
9674 {
9675 ERR("parse error %s:%i. camera, light and mesh_node attributes in non-CAMERA, non-LIGHT and non-MESH_NODE part.",
9676 file_in, line - 1);
9677 exit(-1);
9678 }
9679 }
9680}
9681
9682
9485static void 9683static void
9486st_collections_group_parts_part_description_proxy_source_visible(void) 9684st_collections_group_parts_part_description_proxy_source_visible(void)
9487{ 9685{