Light Object

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Functions
Light Object
Evas » Evas 3D Extensions

A light object represents a set of properties of a light source. More...

## Functions
EOAPI void | evas_canvas3d_light_directional_set (Eina_Bool directional)
| Set the directional flag of the given light. More...
EOAPI Eina_Bool | evas_canvas3d_light_directional_get (void)
| Get the directional flag of the given light. More...
EOAPI void | evas_canvas3d_light_spot_exponent_set (Evas_Real exponent)
| Set the spot exponent of the given light. More...
EOAPI Evas_Real | evas_canvas3d_light_spot_exponent_get (void)
| Get the spot exponent of the given light. More...
EOAPI void | evas_canvas3d_light_spot_cutoff_set (Evas_Real cutoff)
| Set the spot cutoff angle of the given light. More...
EOAPI Evas_Real | evas_canvas3d_light_spot_cutoff_get (void)
| Get the spot cutoff angle of the given light. More...
EOAPI void | evas_canvas3d_light_attenuation_enable_set (Eina_Bool enable)
| Set the attenuation enable flag of the given light. More...
EOAPI Eina_Bool | evas_canvas3d_light_attenuation_enable_get (void)
| Get the attenuation enable flag of the given light. More...
EOAPI void | evas_canvas3d_light_ambient_set (Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a)
| Set the ambient color of the given light. More...
EOAPI void | evas_canvas3d_light_ambient_get (Evas_Real *r, Evas_Real *g, Evas_Real *b, Evas_Real *a)
| Get the ambient color of the given light. More...
EOAPI void | evas_canvas3d_light_diffuse_set (Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a)
| Set the diffuse color of the given light. More...
EOAPI void | evas_canvas3d_light_diffuse_get (Evas_Real *r, Evas_Real *g, Evas_Real *b, Evas_Real *a)
| Get the diffuse color of the given light. More...
EOAPI void | evas_canvas3d_light_specular_set (Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a)
| Set the specular color of the given light. More...
EOAPI void | evas_canvas3d_light_specular_get (Evas_Real *r, Evas_Real *g, Evas_Real *b, Evas_Real *a)
| Get the specular color of the given light. More...
EOAPI void | evas_canvas3d_light_attenuation_set (Evas_Real constant, Evas_Real linear, Evas_Real quadratic)
| Set the attenuation of the given light. More...
EOAPI void | evas_canvas3d_light_attenuation_get (Evas_Real *constant, Evas_Real *linear, Evas_Real *quadratic)
| Get the attenuation of the given light. More...
EOAPI void | evas_canvas3d_light_projection_matrix_set (const Evas_Real *matrix)
| Set the projection matrix of the given light source. More...
EOAPI void | evas_canvas3d_light_projection_matrix_get (Evas_Real *matrix)
| Get the projection matrix of the given light source. More...
EOAPI void | evas_canvas3d_light_projection_perspective_set (Evas_Real fovy, Evas_Real aspect, Evas_Real dnear, Evas_Real dfar)
| Set the projection matrix of the given light source with perspective projection. More...
EOAPI void | evas_canvas3d_light_projection_frustum_set (Evas_Real left, Evas_Real right, Evas_Real bottom, Evas_Real top, Evas_Real dnear, Evas_Real dfar)
| Set the projection matrix of the given light source with frustum projection. More...
EOAPI void | evas_canvas3d_light_projection_ortho_set (Evas_Real left, Evas_Real right, Evas_Real bottom, Evas_Real top, Evas_Real dnear, Evas_Real dfar)
| Set the projection matrix of the given light source with orthogonal projection. More...

## Detailed Description

A light object represents a set of properties of a light source.

Evas 3D provides standard reflection model that of ambient, diffuse and specular reflection model. Also, Evas 3D support 3 types of light model, directional, point and spot light. Light position and direction is determined by the node containing the light.

## Function Documentation

EOAPI void evas_canvas3d_light_directional_set | ( | Eina_Bool | directional | ) |

Set the directional flag of the given light.

Directional light is a type of light which is infinitely far away with no attenuation. The light direction is determined by the containing node's forward vector (negative Z-axis).

By default, directional is not enabled.

evas_canvas3d_node_look_at_set

Parameters

  [in] | directional | Whether the light is directional ($true), or not ($false).

EOAPI Eina_Bool evas_canvas3d_light_directional_get | ( | void |  | ) |

Get the directional flag of the given light.

See also evas_canvas3d_light_directional_set

Returns
  Whether the light is directional ($true), or not ($false).

EOAPI void evas_canvas3d_light_spot_exponent_set | ( | Evas_Real | exponent | ) |

Set the spot exponent of the given light.

Higher spot exponent means intensity at the center of the cone is relatively stronger. Zero exponent means the light intensity is evenly distibuted. The spot exponent has no effect when the light is not spot light (spot cutoff angle is less than 180 degree).

Default spot exponent is 0.

See also evas_canvas3d_light_spot_cutoff_set

Parameters

  [in] | exponent | Spot exponent value.

EOAPI Evas_Real evas_canvas3d_light_spot_exponent_get | ( | void |  | ) |

Get the spot exponent of the given light.

See also evas_canvas3d_light_spot_exponent_set

Returns
  Spot exponent value.

EOAPI void evas_canvas3d_light_spot_cutoff_set | ( | Evas_Real | cutoff | ) |

Set the spot cutoff angle of the given light.

Only angle less than 180 degree will make it spot light, so that other spot light attribute will take effect.

Default spot cutoff angle is 180.

Parameters

  [in] | cutoff | Cutoff angle in degree..

EOAPI Evas_Real evas_canvas3d_light_spot_cutoff_get | ( | void |  | ) |

Get the spot cutoff angle of the given light.

See also evas_canvas3d_light_spot_cutoff_set

Returns
  Cutoff angle in degree..

EOAPI void evas_canvas3d_light_attenuation_enable_set | ( | Eina_Bool | enable | ) |

Set the attenuation enable flag of the given light.

By default, light attenuation is not enabled.

See also evas_canvas3d_light_attenuation_set

Parameters

  [in] | enable | Whether to enable attenuation ($true), or not ($false)..

EOAPI Eina_Bool evas_canvas3d_light_attenuation_enable_get | ( | void |  | ) |

Get the attenuation enable flag of the given light.

See also evas_canvas3d_light_attenuation_enable_set

Returns
  Whether to enable attenuation ($true), or not ($false)..

EOAPI void evas_canvas3d_light_ambient_set | ( | Evas_Real | r,
|  | Evas_Real | g,
|  | Evas_Real | b,
|  | Evas_Real | a
| ) |  |

Set the ambient color of the given light.

Default ambient color is (0.0, 0.0, 0.0, 1.0).

Parameters

  [in] | g | Green component of the ambient color between [0.0, 1.0].
  [in] | b | Blue component of the ambient color between [0.0, 1.0].
  [in] | a | Alpha component of the ambient color between [0.0, 1.0].

EOAPI void evas_canvas3d_light_ambient_get | ( | Evas_Real * | r,
|  | Evas_Real * | g,
|  | Evas_Real * | b,
|  | Evas_Real * | a
| ) |  |

Get the ambient color of the given light.

See also evas_canvas3d_light_ambient_set

Parameters

  [out] | g | Green component of the ambient color between [0.0, 1.0].
  [out] | b | Blue component of the ambient color between [0.0, 1.0].
  [out] | a | Alpha component of the ambient color between [0.0, 1.0].

EOAPI void evas_canvas3d_light_diffuse_set | ( | Evas_Real | r,
|  | Evas_Real | g,
|  | Evas_Real | b,
|  | Evas_Real | a
| ) |  |

Set the diffuse color of the given light.

Default diffuse color is (1.0, 1.0, 1.0, 1.0).

Parameters

  [in] | g | Green component of the diffuse color between [0.0, 1.0].
  [in] | b | Blue component of the diffuse color between [0.0, 1.0].
  [in] | a | Alpha component of the diffuse color between [0.0, 1.0].

EOAPI void evas_canvas3d_light_diffuse_get | ( | Evas_Real * | r,
|  | Evas_Real * | g,
|  | Evas_Real * | b,
|  | Evas_Real * | a
| ) |  |

Get the diffuse color of the given light.

See also evas_canvas3d_light_diffuse_set

Parameters

  [out] | g | Green component of the diffuse color between [0.0, 1.0].
  [out] | b | Blue component of the diffuse color between [0.0, 1.0].
  [out] | a | Alpha component of the diffuse color between [0.0, 1.0].

EOAPI void evas_canvas3d_light_specular_set | ( | Evas_Real | r,
|  | Evas_Real | g,
|  | Evas_Real | b,
|  | Evas_Real | a
| ) |  |

Set the specular color of the given light.

Default specular color is (1.0, 1.0, 1.0, 1.0).

Parameters

  [in] | g | Green component of the specular color between [0.0, 1.0].
  [in] | b | Blue component of the specular color between [0.0, 1.0].
  [in] | a | Alpha component of the specular color between [0.0, 1.0].

EOAPI void evas_canvas3d_light_specular_get | ( | Evas_Real * | r,
|  | Evas_Real * | g,
|  | Evas_Real * | b,
|  | Evas_Real * | a
| ) |  |

Get the specular color of the given light.

See also evas_canvas3d_light_specular_set

Parameters

  [out] | g | Green component of the specular color between [0.0, 1.0].
  [out] | b | Blue component of the specular color between [0.0, 1.0].
  [out] | a | Alpha component of the specular color between [0.0, 1.0].

EOAPI void evas_canvas3d_light_attenuation_set | ( | Evas_Real | constant,
|  | Evas_Real | linear,
|  | Evas_Real | quadratic
| ) |  |

Set the attenuation of the given light.

Light attenuation has no effect with directional light. And the attenuation should be enabled first to take effect. The attenuation factor is calculated as follows.

atten = 1.0 / constant + linear * distance + quadratic * distance * distance

Default attenuation is constant = 1.0, linear = 0.0, quadratic = 0.0.

See also evas_canvas3d_light_attenuation_enable_set

Parameters

  [in] | linear | Linear attenuation term..
  [in] | quadratic | Quadratic attenuation term..

EOAPI void evas_canvas3d_light_attenuation_get | ( | Evas_Real * | constant,
|  | Evas_Real * | linear,
|  | Evas_Real * | quadratic
| ) |  |

Get the attenuation of the given light.

See also evas_canvas3d_light_attenuation_set

Parameters

  [out] | linear | Linear attenuation term..
  [out] | quadratic | Quadratic attenuation term..

EOAPI void evas_canvas3d_light_projection_matrix_set | ( | const Evas_Real * | matrix | ) |

Set the projection matrix of the given light source.

Default projection matrix is identity matrix.

See also evas_canvas3d_light_projection_perspective_set, evas_canvas3d_light_projection_ortho_set and evas_canvas3d_light_projection_frustum_set

Parameters

  [in] | matrix | Projection Matrix. Pointer to the array of 16 Evas.Real values in column major order.

EOAPI void evas_canvas3d_light_projection_matrix_get | ( | Evas_Real * | matrix | ) |

Get the projection matrix of the given light source.

See also evas_canvas3d_light_projection_matrix_set

Parameters

  [out] | matrix | Projection Matrix

EOAPI void evas_canvas3d_light_projection_perspective_set | ( | Evas_Real | fovy,
|  | Evas_Real | aspect,
|  | Evas_Real | dnear,
|  | Evas_Real | dfar
| ) |  |

Set the projection matrix of the given light source with perspective projection.

See also evas_canvas3d_light_projection_matrix_set

Parameters

  [in] | aspect | Aspect ratio.
  [in] | dnear | Distance to near clipping plane.
  [in] | dfar | Distance to far clipping plane.

EOAPI void evas_canvas3d_light_projection_frustum_set | ( | Evas_Real | left,
|  | Evas_Real | right,
|  | Evas_Real | bottom,
|  | Evas_Real | top,
|  | Evas_Real | dnear,
|  | Evas_Real | dfar
| ) |  |

Set the projection matrix of the given light source with frustum projection.

evas_canvas3d_light_projection_matrix_set

Parameters

  [in] | right | Right X coordinate of the near clipping plane.
  [in] | bottom | Bottom Y coordinate of the near clipping plane.
  [in] | top | Top Y coordinate of the near clipping plane
  [in] | dnear | Distance to near clipping plane.
  [in] | dfar | Distance to far clipping plane.

EOAPI void evas_canvas3d_light_projection_ortho_set | ( | Evas_Real | left,
|  | Evas_Real | right,
|  | Evas_Real | bottom,
|  | Evas_Real | top,
|  | Evas_Real | dnear,
|  | Evas_Real | dfar
| ) |  |

Set the projection matrix of the given light source with orthogonal projection.

See also evas_canvas3d_light_projection_matrix_set

Parameters

  [in] | right | Right X coordinate of the near clipping plane.
  [in] | bottom | Bottom Y coordinate of the near clipping plane.
  [in] | top | Top Y coordinate of the near clipping plane
  [in] | dnear | Distance to near clipping plane.
  [in] | dfar | Distance to far clipping plane.