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>
This commit is contained in:
perepelits.m 2015-03-25 19:31:25 +01:00 committed by Cedric BAIL
parent 6b88246808
commit 62b5ca7060
2 changed files with 108 additions and 0 deletions

View File

@ -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)
{

View File

@ -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;