summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorperepelits.m <perepelits.m@samsung.com>2015-03-25 19:31:25 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-25 19:40:41 +0100
commit62b5ca7060ad748a5e82a4f3f7f0d644f2ef626e (patch)
tree2eddb296ff9663c102e56f8f5251ad7579f13bb1
parent6b8824680888abc16e5e300ab75e383550670262 (diff)
downloadefl-62b5ca7060ad748a5e82a4f3f7f0d644f2ef626e.tar.gz
edje: add of textures to Edje 3D node.
Summary: Adding textures to edje_cc and some topblock keywords that I have forgotten to add in previous commits. Reviewers: Hermet, raster, cedric Reviewed By: cedric Subscribers: cedric, artem.popov Differential Revision: https://phab.enlightenment.org/D2129 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/edje/edje_cc_handlers.c106
-rw-r--r--src/lib/edje/edje_private.h2
2 files changed, 108 insertions, 0 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 303bd4523f..6592d4e765 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -379,6 +379,8 @@ static void st_collections_group_parts_part_description_orientation_look2(void);
static void st_collections_group_parts_part_description_orientation_look_to(void);
static void st_collections_group_parts_part_description_orientation_angle_axis(void);
static void st_collections_group_parts_part_description_orientation_quaternion(void);
+static void ob_collections_group_parts_part_description_texture(void);
+static void st_collections_group_parts_part_description_texture_image(void);
#ifdef HAVE_EPHYSICS
static void st_collections_group_parts_part_description_physics_mass(void);
@@ -810,6 +812,7 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.description.orientation.look_to", st_collections_group_parts_part_description_orientation_look_to},
{"collections.group.parts.part.description.orientation.angle_axis", st_collections_group_parts_part_description_orientation_angle_axis},
{"collections.group.parts.part.description.orientation.quaternion", st_collections_group_parts_part_description_orientation_quaternion},
+ {"collections.group.parts.part.description.texture.image", st_collections_group_parts_part_description_texture_image},
#ifdef HAVE_EPHYSICS
{"collections.group.parts.part.description.physics.mass", st_collections_group_parts_part_description_physics_mass},
@@ -1142,6 +1145,11 @@ New_Object_Handler object_handlers[] =
{"collections.group.parts.part.description.styles.style", ob_styles_style}, /* dup */
{"collections.group.parts.part.description.box", NULL},
{"collections.group.parts.part.description.table", NULL},
+ {"collections.group.parts.part.description.position", NULL},
+ {"collections.group.parts.part.description.properties", NULL},
+ {"collections.group.parts.part.description.orientation", NULL},
+ {"collections.group.parts.part.description.texture", ob_collections_group_parts_part_description_texture},
+ {"collections.group.parts.part.description.mesh", NULL},
#ifdef HAVE_EPHYSICS
{"collections.group.parts.part.description.physics", NULL},
{"collections.group.parts.part.description.physics.movement_freedom", NULL},
@@ -9811,6 +9819,104 @@ st_collections_group_parts_part_description_orientation_quaternion(void)
}
}
+/**
+ @edcsubsection{collections_group_parts_description_texture,Texture}
+ */
+
+/**
+ @page edcref
+
+ @block
+ texture
+ @context
+ part {
+ description {
+ ..
+ texture {
+ image: "file_name";
+ wrap1: REPEAT;
+ wrap2: REPEAT;
+ filter1: NEAREST;
+ filter2: NEAREST;
+ }
+ ..
+ }
+ }
+ @description
+ A texture block is used to set texture, this texture will be imposed on
+ MESH_NODE model.
+ @endblock
+*/
+
+static void
+ob_collections_group_parts_part_description_texture(void)
+{
+ Edje_Part_Description_Mesh_Node *ed;
+
+
+ if (current_part->type == EDJE_PART_TYPE_MESH_NODE)
+ {
+ ed = (Edje_Part_Description_Mesh_Node*) current_desc;
+
+ ed->mesh_node.texture.need_texture = EINA_TRUE;
+ }
+ else
+ {
+ ERR("parse error %s:%i. "
+ "mesh_node attributes in non-MESH_NODE part.",
+ file_in, line - 1);
+ exit(-1);
+ }
+}
+
+ /**
+ @page edcref
+ @property
+ shade
+ image
+ @parameters
+ [SHADE]
+ [texture's filename]
+ @effect
+ Sets the shade mode for MESH_NODE. Valid shade modes:
+ @li COLOR
+ @li DIFFUSE
+ @li FLAT
+ @li PHONG
+ @li MAP
+ @li RENDER
+ Name of image to be used as previously declared in the image block.
+ It's required in any mesh_node part.
+ @endproperty
+ */
+static void
+st_collections_group_parts_part_description_texture_image(void)
+{
+ Edje_Part_Description_Mesh_Node *ed;
+
+ check_arg_count(1);
+
+ if (current_part->type == EDJE_PART_TYPE_MESH_NODE)
+ {
+ char *name;
+ ed = (Edje_Part_Description_Mesh_Node*) current_desc;
+
+ ed->mesh_node.texture.textured = EINA_TRUE;
+
+ name = parse_str(0);
+ data_queue_image_remove(&(ed->mesh_node.texture.id), &(ed->mesh_node.texture.set));
+ data_queue_image_lookup(name, &(ed->mesh_node.texture.id), &(ed->mesh_node.texture.set));
+ free(name);
+ }
+ else
+ {
+ ERR("parse error %s:%i. "
+ "mesh_node attributes in non-MESH_NODE part.",
+ file_in, line - 1);
+ exit(-1);
+ }
+}
+
static void
st_collections_group_parts_part_description_proxy_source_visible(void)
{
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index cfb5f5a99f..03d1709645 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1326,6 +1326,8 @@ struct _Edje_Part_Description_Spec_Mesh_Node
unsigned int tweens_count;
int id;
+ Eina_Bool need_texture;
+ Eina_Bool textured;
Eina_Bool set;
Evas_3D_Wrap_Mode wrap1;