SVN revision: 46342
This commit is contained in:
Carsten Haitzler 2010-02-21 09:39:58 +00:00
parent e89c590b0d
commit ea37c003f3
2 changed files with 241 additions and 3 deletions

View File

@ -5664,6 +5664,30 @@ static void st_collections_group_parts_part_description_table_padding(void)
ed->table.padding.y = parse_int_range(1, 0, 0x7fffffff);
}
/**
@page edcref
@property
perspective
@context
description {
..
map {
perspective: "name";
}
..
}
@parameters
[another part's name]
@effect
This sets the part that is used as the "perspective point" for giving
a part a "3d look". The perspective point should have a perspective
section that provides zplane and focal properties. The center of this
part will be used as the focal point, so size, color and visibility
etc. are not relevant just center point, zplane and focal are used.
This also implicitly enables perspective transforms (see the on
parameter for the map section).
@endproperty
*/
static void
st_collections_group_parts_part_description_map_perspective(void)
{
@ -5688,6 +5712,32 @@ st_collections_group_parts_part_description_map_perspective(void)
ed->map.persp_on = 1;
}
/**
@page edcref
@property
light
@context
description {
..
map {
light: "name";
}
..
}
@parameters
[another part's name]
@effect
This sets the part that is used as the "light" for calculating the
brightness (based on how directly the part's surface is facing the
lightsource point). Like the perspective point part, the center point
is used and zplane is used for the z position (0 being th zero-plane
where all 2d objects normally live) and positive values being further
away into the distance. The light part color is used as the light
color (alpha not used for light color). The color2 color is used for
the ambient lighting when calculating brightness (alpha also not
used).
@endproperty
*/
static void
st_collections_group_parts_part_description_map_light(void)
{
@ -5711,6 +5761,30 @@ st_collections_group_parts_part_description_map_light(void)
}
}
/**
@page edcref
@property
center
@context
description {
..
map {
rotation {
center: "name";
}
}
..
}
@parameters
[another part's name]
@effect
This sets the part that is used as the center of rotation when
rotating the part with this description. The part's center point
is used as the rotation center when applying rotation around the
x, y and z axes. If no center is given, the parts original center
itself is used for the rotation center.
@endproperty
*/
static void
st_collections_group_parts_part_description_map_rotation_center(void)
{
@ -5734,6 +5808,26 @@ st_collections_group_parts_part_description_map_rotation_center(void)
}
}
/**
@page edcref
@property
x
@context
description {
..
map {
rotation {
x: 45.0;
}
}
..
}
@parameters
rotation in degrees around the x axis
@effect
This sets the rotation of the part around the center set in degrees
@endproperty
*/
static void
st_collections_group_parts_part_description_map_rotation_x(void)
{
@ -5751,6 +5845,26 @@ st_collections_group_parts_part_description_map_rotation_x(void)
ed->map.rot.x = FROM_DOUBLE(parse_float(0));
}
/**
@page edcref
@property
y
@context
description {
..
map {
rotation {
y: 45.0;
}
}
..
}
@parameters
rotation in degrees around the y axis
@effect
This sets the rotation of the part around the center set in degrees
@endproperty
*/
static void
st_collections_group_parts_part_description_map_rotation_y(void)
{
@ -5768,6 +5882,26 @@ st_collections_group_parts_part_description_map_rotation_y(void)
ed->map.rot.y = FROM_DOUBLE(parse_float(0));
}
/**
@page edcref
@property
z
@context
description {
..
map {
rotation {
z: 45.0;
}
}
..
}
@parameters
rotation in degrees around the z axis
@effect
This sets the rotation of the part around the center set in degrees
@endproperty
*/
static void
st_collections_group_parts_part_description_map_rotation_z(void)
{
@ -5785,6 +5919,24 @@ st_collections_group_parts_part_description_map_rotation_z(void)
ed->map.rot.z = FROM_DOUBLE(parse_float(0));
}
/**
@page edcref
@property
on
@context
description {
..
map {
on: 1;
}
..
}
@parameters
enable map at all (1/0)
@effect
This enables mapping for the part.
@endproperty
*/
static void
st_collections_group_parts_part_description_map_on(void)
{
@ -5802,6 +5954,26 @@ st_collections_group_parts_part_description_map_on(void)
ed->map.on = parse_bool(0);
}
/**
@page edcref
@property
backface_cull
@context
description {
..
map {
backface_cull: 1;
}
..
}
@parameters
enable backface culling (1/0)
@effect
This enables backface culling (when the rotated part that normally
faces the camera is facing away after being rotated etc.). This means
that the object will be hidden when "backface culled".
@endproperty
*/
static void
st_collections_group_parts_part_description_map_backface_cull(void)
{
@ -5819,6 +5991,27 @@ st_collections_group_parts_part_description_map_backface_cull(void)
ed->map.backcull = parse_bool(0);
}
/**
@page edcref
@property
perspective_on
@context
description {
..
map {
perspective_on: 1;
}
..
}
@parameters
enable perspective when rotating
@effect
This enables perspective even without a perspective point object.
This would use perspective set for the object itself or for the
canvas as a whole as the global perspective with
edje_perspective_set() and edje_perspective_global_set().
@endproperty
*/
static void
st_collections_group_parts_part_description_map_perspective_on(void)
{
@ -5836,6 +6029,26 @@ st_collections_group_parts_part_description_map_perspective_on(void)
ed->map.persp_on = parse_bool(0);
}
/**
@page edcref
@property
z
@context
description {
..
perspective {
zplane: 0;
}
..
}
@parameters
the z value that will be "unscaled".
@effect
This sets the z value that wil not be scaled. Normally this is 0 as
that is the z distance that all objects are at normally.
@endproperty
*/
static void
st_collections_group_parts_part_description_perspective_zplane(void)
{
@ -5853,6 +6066,26 @@ st_collections_group_parts_part_description_perspective_zplane(void)
ed->persp.zplane = parse_int(0);
}
/**
@page edcref
@property
focal
@context
description {
..
perspective {
focal: 1000;
}
..
}
@parameters
focal distance from camera to focal plane
@effect
This sets the distance from the focal z plane (zplane) and the
camera - i.e. very much equating to focal length of the camera
@endproperty
*/
static void
st_collections_group_parts_part_description_perspective_focal(void)
{

View File

@ -2023,7 +2023,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
if (chosen_desc->map.on)
{
Evas_Map *map;
Evas_Coord cx, cy;
Evas_Coord cx, cy, cz;
double rx, ry, rz;
Edje_Part_Description *desc1, *desc2;
@ -2040,13 +2040,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
// default center - center of part
cx = ed->x + pf->x + (pf->w / 2);
cy = ed->y + pf->y + (pf->h / 2);
cz = 0;
// if another center is specified - find it and caculate it
if ((desc1) &&
(desc1->map.rot.id_center >= 0) &&
(desc1->map.rot.id_center != ep->part->id))
{
Evas_Coord cx1, cy1, cx2, cy2;
Evas_Coord cx1, cy1, cz1, cx2, cy2, cz2;
Edje_Real_Part *ep2 =
ed->table_parts[desc1->map.rot.id_center %
ed->table_parts_size];
@ -2056,6 +2057,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
if (!ep2->calculated) _edje_part_recalc(ed, ep2, flags);
cx1 = ed->x + ep2->x + (ep2->w / 2);
cy1 = ed->y + ep2->y + (ep2->h / 2);
cz1 = 0;
}
// if we have a desc2 and are on a partiual position to it
if ((pos != ZERO) && (desc2) &&
@ -2070,12 +2072,15 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
if (!ep2->calculated) _edje_part_recalc(ed, ep2, flags);
cx2 = ed->x + ep2->x + (ep2->w / 2);
cy2 = ed->y + ep2->y + (ep2->h / 2);
cz2 = 0;
cx1 += SCALE(pos, cx2 - cx1);
cy1 += SCALE(pos, cy2 - cy1);
cz1 += SCALE(pos, cz2 - cz1);
}
}
cx = cx1;
cy = cy1;
cz = cz1;
}
// rotation - interpolate wit pos, if appropriate
@ -2098,7 +2103,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
ry = TO_DOUBLE(desc1->map.rot.y);
rz = TO_DOUBLE(desc1->map.rot.z);
}
evas_map_util_3d_rotate(map, rx, ry, rz, cx, cy, 0);
evas_map_util_3d_rotate(map, rx, ry, rz, cx, cy, cz);
// calculate light color & position etc. if there is one
if (((desc1) &&