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)
{
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)
{
}
}
+/**
+ @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)
{
}
}
+/**
+ @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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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;
// 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];
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) &&
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
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) &&