Exemplo n.º 1
0
triple_t diffuse_illumination(
   model_t  *model,        /* pointer to model structure     */
   obj_t    *hitobj)       /* object that was hit by the ray */
{
/****variables****/
   obj_t *currlight;
   list_t *lightlist;
   triple_t total_illumination;
   triple_t processed_light;
/*****************/

   //Point to list of lights in the model
   lightlist = model->lights;

   //Initialize to zero
   total_illumination = tl_scale3(&total_illumination, 0);
   processed_light = tl_scale3(&processed_light, 0);
   
   //Reset list so that position points to head
   l_reset(lightlist);

   //Walk through the lights list and process each light
   //Sum up the total illumination
   while((currlight = l_get(lightlist)) != NULL)
   {
      processed_light = process_light(model->scene, hitobj, currlight->lightData);
      total_illumination = tl_sum3(&total_illumination, &processed_light);
   }

   return total_illumination;
}
Exemplo n.º 2
0
/**
Processes all the lights in the level.
*/
void LightmapGenerator::process_lights()
{
	int lightCount = static_cast<int>(m_lights.size());
	for(int i=0; i<lightCount; ++i)
	{
		process_light(i);
	}
}
Exemplo n.º 3
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sensor_collection, ev, data)
{
  PROCESS_BEGIN();
  static struct etimer timer;

#if IOTLAB_M3
  config_light();
  config_pressure();
#endif

  config_acc();
  config_mag();
  config_gyr();

  etimer_set(&timer, CLOCK_SECOND);

  while(1) {
    PROCESS_WAIT_EVENT();
    if (ev == PROCESS_EVENT_TIMER) {
#if IOTLAB_M3
      process_light();
      process_pressure();
#endif

      etimer_restart(&timer);
    } else if (ev == sensors_event && data == &acc_sensor) {
      process_acc();
    } else if (ev == sensors_event && data == &mag_sensor) {
      process_mag();
    } else if (ev == sensors_event && data == &gyr_sensor) {
      process_gyr();
    }
  }

  PROCESS_END();
}