summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/lib/EPhysics.h
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-10 20:32:08 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-10 20:32:08 +0000
commitc9700902546d31e9a7e6d98d416c922b6f61b27d (patch)
tree2f1c03a0b7eb1726aa1f64ab5cc29ee43f94fc69 /legacy/ephysics/src/lib/EPhysics.h
parent3acb5dde8b745950a055446486a5cbac02b792ec (diff)
ephysics: lights, camera, action!
Add light support. It uses evas_map_util_3d_lighting() internally and is only applied over selected bodies. SVN revision: 77803
Diffstat (limited to '')
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h158
1 files changed, 157 insertions, 1 deletions
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index 1603fd5fdf..dc10eb38af 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -1227,6 +1227,118 @@ EAPI void ephysics_world_simulation_set(EPhysics_World *world, double fixed_time
1227EAPI void ephysics_world_simulation_get(const EPhysics_World *world, double *fixed_time_step, int *max_sub_steps); 1227EAPI void ephysics_world_simulation_get(const EPhysics_World *world, double *fixed_time_step, int *max_sub_steps);
1228 1228
1229/** 1229/**
1230 * @brief
1231 * Set light properties to be applied on the scene.
1232 *
1233 * It will perform lighting calculations on the evas map applied on evas
1234 * objects associated with all the bodies to have light applied over.
1235 *
1236 * This is used to apply lighting calculations (from a single light source)
1237 * to a given object. The R, G and B values of each vertex will be modified to
1238 * reflect the lighting based on the lixth point coordinates, the light color
1239 * and the ambient color, and at what angle the map is facing the light source.
1240 * A surface should have its points be declared in a clockwise fashion if the
1241 * face is "facing" towards you (as opposed to away from you) as faces have a
1242 * "logical" side for lighting.
1243 *
1244 * More details can be found on evas_map_util_3d_lighting() documentation,
1245 * since this function is used internally by EPhysics.
1246 *
1247 * There are two ways of setting a body to receive lighting. One is to simple
1248 * set all the bodies to be affected, with
1249 * @ref ephysics_world_light_all_bodies_set(). The other, is to set each body
1250 * individually, with @ref ephysics_body_light_set().
1251 *
1252 * By default, no light is set. And after a light is set, by default,
1253 * no body will be affected. No change will be visible until
1254 * some bodies are set to be enlightened.
1255 *
1256 * @param world The physics world.
1257 * @param lx X coordinate in space of light point
1258 * @param ly Y coordinate in space of light point
1259 * @param lz Z coordinate in space of light point
1260 * @param lr light red value (0 - 255)
1261 * @param lg light green value (0 - 255)
1262 * @param lb light blue value (0 - 255)
1263 * @param ar ambient color red value (0 - 255)
1264 * @param ag ambient color green value (0 - 255)
1265 * @param ab ambient color blue value (0 - 255)
1266 *
1267 * @see ephysics_world_light_get().
1268 *
1269 * @ingroup EPhysics_World
1270 */
1271EAPI void ephysics_world_light_set(EPhysics_World *world, Evas_Coord lx, Evas_Coord ly, Evas_Coord lz, int lr, int lg, int lb, int ar, int ag, int ab);
1272
1273/**
1274 * @brief
1275 * Get light properties.
1276 *
1277 * @param world The physics world.
1278 * @param lx X coordinate in space of light point
1279 * @param ly Y coordinate in space of light point
1280 * @param lz Z coordinate in space of light point
1281 * @param lr light red value (0 - 255)
1282 * @param lg light green value (0 - 255)
1283 * @param lb light blue value (0 - 255)
1284 * @param ar ambient color red value (0 - 255)
1285 * @param ag ambient color green value (0 - 255)
1286 * @param ab ambient color blue value (0 - 255)
1287 * @return @c EINA_TRUE if light is set, or @c EINA_FALSE if it isn't set,
1288 * or on error. On this case the other parameters won't be set.
1289 *
1290 * @see ephysics_world_light_set() for more details.
1291 *
1292 * @ingroup EPhysics_World
1293 */
1294EAPI Eina_Bool ephysics_world_light_get(const EPhysics_World *world, Evas_Coord *lx, Evas_Coord *ly, Evas_Coord *lz, int *lr, int *lg, int *lb, int *ar, int *ag, int *ab);
1295
1296/**
1297 * @brief
1298 * Unset light on the scene.
1299 *
1300 * It will unset light, so no body will be enlightened anymore.
1301 *
1302 * @param world The physics world.
1303 *
1304 * @see ephysics_world_light_set() for more details.
1305 *
1306 * @ingroup EPhysics_World
1307 */
1308EAPI void ephysics_world_light_unset(EPhysics_World *world);
1309
1310/**
1311 * @brief
1312 * Set if light should be applied over all the bodies.
1313 *
1314 * @param world The physics world.
1315 * @param enable @c EINA_TRUE if light should be obligatory applied over
1316 * all the bodies, or @c EINA_FALSE if it only should be applied on bodies with
1317 * light property set.
1318 *
1319 * @see ephysics_world_light_set() for more details.
1320 * @see ephysics_world_light_all_bodies_get().
1321 *
1322 * @ingroup EPhysics_World
1323 */
1324EAPI void ephysics_world_light_all_bodies_set(EPhysics_World *world, Eina_Bool enable);
1325
1326/**
1327 * @brief
1328 * Get light setting regarding being applied over all the bodies.
1329 *
1330 * @param world The physics world.
1331 * @return @c EINA_TRUE if light will be obligatory applied over all the bodies,
1332 * or @c EINA_FALSE if it only will be applied on bodies with light property
1333 * set, or on error.
1334 *
1335 * @see ephysics_world_light_all_bodies_set() for details.
1336 *
1337 * @ingroup EPhysics_World
1338 */
1339EAPI Eina_Bool ephysics_world_light_all_bodies_get(const EPhysics_World *world);
1340
1341/**
1230 * @} 1342 * @}
1231 */ 1343 */
1232 1344
@@ -3159,13 +3271,57 @@ EAPI void ephysics_body_material_set(EPhysics_Body *body, EPhysics_Body_Material
3159 * @param body The physics body. 3271 * @param body The physics body.
3160 * @return the @p material used by the body. 3272 * @return the @p material used by the body.
3161 * 3273 *
3162 * @see ephysics_body_body_set() for more details. 3274 * @see ephysics_body_material_set() for more details.
3163 * 3275 *
3164 * @ingroup EPhysics_Body 3276 * @ingroup EPhysics_Body
3165 */ 3277 */
3166EAPI EPhysics_Body_Material ephysics_body_material_get(const EPhysics_Body *body); 3278EAPI EPhysics_Body_Material ephysics_body_material_get(const EPhysics_Body *body);
3167 3279
3168/** 3280/**
3281 * @brief
3282 * Set light effect over body.
3283 *
3284 * @param body The physics body.
3285 * @param enable If @c EINA_TRUE, light will be applied over this @p body,
3286 * otherwise it won't.
3287 *
3288 * It's possible to set the light to apply over all the bodies with
3289 * @ref ephysics_world_light_all_bodies_set(). This will have priority
3290 * over body's individual light settings.
3291 *
3292 * So, if @p body is set to doesn't be affect by the light, but light
3293 * is set to be applied over all the bodies, @p body will be displayed
3294 * with light over it.
3295 *
3296 * Also, if no light is set on the world with @ref ephysics_world_light_set(),
3297 * nothing will happens.
3298 *
3299 * @see ephysics_body_light_get().
3300 * @see ephysics_world_light_set() for more details regarding lighting.
3301 *
3302 * @ingroup EPhysics_Body
3303 */
3304EAPI void ephysics_body_light_set(EPhysics_Body *body, Eina_Bool enable);
3305
3306/**
3307 * @brief
3308 * Get light effect over body.
3309 *
3310 * @param body The physics body.
3311 * @return @c EINA_TRUE if light is applied over this @p body or @c EINA_FALSE
3312 * in the other case, or on error.
3313 *
3314 * @note If light is applied over all the bodies it may return @c EINA_FALSE
3315 * even if it's being affect by lights. This need to be checked with
3316 * @ref ephysics_world_light_all_bodies_get().
3317 *
3318 * @see ephysics_body_light_set() for more details.
3319 *
3320 * @ingroup EPhysics_Body
3321 */
3322EAPI Eina_Bool ephysics_body_light_get(const EPhysics_Body *body);
3323
3324/**
3169 * @} 3325 * @}
3170 */ 3326 */
3171 3327