Ejemplo n.º 1
0
 void fade(unsigned char ms)
 {
unsigned  int j=0,i=0;   
for (j=0 ; j<light_var; j++ ) { LIGHT(j); delay_ms(1);}   
for (i=0; i<ms; i++) {   gettime();  if(sec_en) paste_time(0);   delay_ms(1000); while(b_menu || !B1 || !B2); } ;  
for (j=light_var; j>0; j-- ) { LIGHT(j); delay_ms(1);}  
 }
Ejemplo n.º 2
0
static void		AOUpdateCurrentState(AORenderPassClass *self)
{
  ColorBufferClass	*currentState;
  int			size;
  GBufferClass		*gBuffer;
  ColorBufferClass	*colorBuf;
  Color			*curColor;
  Color			tmp;
  float			ratio;

  size = RTEngineGetSingletonPtr()->getSceneWidth()
    * RTEngineGetSingletonPtr()->getSceneHeight();
  gBuffer = RenderingSceneGetSingletonPtr()->getGBuffer();
  currentState = RenderingSceneGetSingletonPtr()->getCurrentState();
  colorBuf = COLORBUF(gBuffer->getBuffer(gBuffer, __RTTI_COLORBUFFER));
  while (size--)
  {
    curColor = currentState->getColorPtr(currentState, size);
    ratio = PRIV(curLightBuf)->getLight(PRIV(curLightBuf), size);
    tmp = colorBuf->getColor(colorBuf, size);
    curColor->r += ratio * (tmp.r * LIGHT(PRIV(curLight))->color.r);
    curColor->g += ratio * (tmp.g * LIGHT(PRIV(curLight))->color.g);
    curColor->b += ratio * (tmp.b * LIGHT(PRIV(curLight))->color.b);
  }
}
Ejemplo n.º 3
0
void Alarm(void)
{
	   if((tempshuzhi>=70||dianya_zhi>=440||dianya_zhi<=340)&&alarm_lock==0)
	   	{   
                                           if(mybox.master==1)//主机发布通知延时信息
								  {
								       delay_time(80);
								  }
					GPIO_SetBits(GPIOA,GPIO_Pin_0);
					delay_us(100000);
                    GPIO_SetBits(GPIOA,GPIO_Pin_8);
		       set_now_mystatus(mystatus.myid,mystatus.size[0],mystatus.size[1],2,2,0,0);
		       LIGHT(mystatus.work_status[0],mystatus.work_status[1]);//过温常态
		       alarm_lock=1;

	   }
	 else if(tempshuzhi<70&&dianya_zhi<440&&dianya_zhi>340&&alarm_lock==1)
	 {
                             if(mybox.master==1)//主机
				 {    
				      delay_time(80);
				}
		    set_now_mystatus(mystatus.myid,mystatus.size[0],mystatus.size[1],0,0,0,0);
		    LIGHT(mystatus.work_status[0],mystatus.work_status[1]);//恢复常态
		    alarm_lock=0;
	 }

}
Ejemplo n.º 4
0
/* Toggle the light at the specified coordinates and update the groplist */
void invertLight(int lx,int ly) {
   light l;

   if (lx < 0 || lx >= boardwidth ||
       ly < 0 || ly >= boardheight)
     return;
   l = LIGHT(lx,ly) = !LIGHT(lx,ly);
   setLight(lx,ly,l);
}
void debugLight() {

	int curval;

	lcd_unsigned(LIGHT(LIGHTSENS));
	curval = LIGHT(LIGHTSENS);
	if (curval <= map_darkwarn) {
		debugBeep();
	}

	wait(100);
	

}
Ejemplo n.º 6
0
void BuildTerrainLightMap ()
{
	int i, j;
	fix l, l2, lMin = 0x7fffffff, lMax = 0;


if (gameData.render.terrain.pLightMap)
	D2_FREE (gameData.render.terrain.pLightMap)
else
	atexit (FreeTerrainLightMap);		//first time

gameData.render.terrain.pPoints = (vmsVector *) D2_ALLOC (GRID_SIZE * sizeof (vmsVector));
gameData.render.terrain.pLightMap = (fix *) D2_ALLOC (GRID_SIZE * sizeof (fix));
ComputeTerrainPoints ();
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
	for (j = 0; j < gameData.render.terrain.nGridH; j++) {
		l = GetAvgTerrainLight (i, j);
		if (l > lMax)
			lMax = l;
		if (l < lMin)
			lMin = l;
		if (lMin < 0)
			l = GetAvgTerrainLight (i, j);
		}
	}
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
	for (j = 0; j < gameData.render.terrain.nGridH; j++) {
		l = GetAvgTerrainLight (i, j);
		if (lMin == lMax)
			LIGHT (i, j) = l;// >> 8;
		else {
			l2 = FixDiv ((l - lMin), (lMax - lMin));
			if (l2 == f1_0)
				l2--;
			LIGHT (i, j) = l2;// >> 8;
			}
		}
	}
D2_FREE (gameData.render.terrain.pPoints);
}
Ejemplo n.º 7
0
void BuildTerrainLightmap ()
{
    int i, j;
    fix l, l2, lMin = 0x7fffffff, lMax = 0;


    if (gameData.render.terrain.lightmap.Buffer ())
        gameData.render.terrain.lightmap.Destroy ();
    else
        atexit (FreeTerrainLightmap);		//first time

    gameData.render.terrain.points.Create (GRID_SIZE);
    gameData.render.terrain.lightmap.Create (GRID_SIZE);
    ComputeTerrainPoints ();
    for (i = 0; i < gameData.render.terrain.nGridW; i++) {
        for (j = 0; j < gameData.render.terrain.nGridH; j++) {
            l = GetAvgTerrainLight (i, j);
            if (l > lMax)
                lMax = l;
            if (l < lMin)
                lMin = l;
            if (lMin < 0)
                l = GetAvgTerrainLight (i, j);
        }
    }
    for (i = 0; i < gameData.render.terrain.nGridW; i++) {
        for (j = 0; j < gameData.render.terrain.nGridH; j++) {
            l = GetAvgTerrainLight (i, j);
            if (lMin == lMax)
                LIGHT (i, j) = l;// >> 8;
            else {
                l2 = FixDiv ((l - lMin), (lMax - lMin));
                if (l2 == I2X (1))
                    l2--;
                LIGHT (i, j) = l2;// >> 8;
            }
        }
    }
    gameData.render.terrain.points.Destroy ();
}
Ejemplo n.º 8
0
void BuildTerrainLightMap ()
{
	int i, j;
	fix l, l2, lMin = 0x7fffffff, lMax = 0;


if (gameData.render.terrain.pLightMap)
	d_free (gameData.render.terrain.pLightMap)
else
	atexit (FreeTerrainLightMap);		//first time

MALLOC (gameData.render.terrain.pLightMap, fix, 
		  gameData.render.terrain.nGridW * gameData.render.terrain.nGridH);
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
	for (j = 0; j < gameData.render.terrain.nGridH; j++) {
		l = GetAvgTerrainLight (i, j);
		if (l > lMax)
			lMax = l;
		if (l < lMin)
			lMin = l;
		if (lMin < 0)
			l = GetAvgTerrainLight (i, j);
		}
	}
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
	for (j = 0; j < gameData.render.terrain.nGridH; j++) {
		l = GetAvgTerrainLight (i, j);
		if (lMin == lMax)
			LIGHT (i, j) = l;// >> 8;
		else {
			l2 = fixdiv ((l - lMin), (lMax - lMin));
			if (l2 == f1_0)
				l2--;
			LIGHT (i, j) = l2;// >> 8;
			}
		}
	}
}
Ejemplo n.º 9
0
bool CAR::LoadLight(
	const PTree & cfg,
	ContentManager & content,
	std::ostream & error_output)
{
	float radius;
	std::string radiusstr;
	MATHVECTOR<float, 3> pos(0), col(0);
	if (!cfg.get("position", pos, error_output)) return false;
	if (!cfg.get("color", col, error_output)) return false;
	if (!cfg.get("radius", radius, error_output)) return false;
	cfg.get("radius", radiusstr);

	lights.push_back(LIGHT());

	SCENENODE & bodynoderef = topnode.GetNode(bodynode);
	lights.back().node = bodynoderef.AddNode();

	SCENENODE & node = bodynoderef.GetNode(lights.back().node);
	node.GetTransform().SetTranslation(MATHVECTOR<float,3>(pos[0], pos[1], pos[2]));

	std::tr1::shared_ptr<MODEL> mesh;
	if (!content.get("", "cube"+radiusstr, mesh))
	{
		VERTEXARRAY varray;
		varray.SetToUnitCube();
		varray.Scale(radius, radius, radius);
		content.load("", "cube"+radiusstr, varray, mesh);
	}
    models.push_back(mesh);

	keyed_container <DRAWABLE> & dlist = GetDrawlist(node, OMNI);
	lights.back().draw = dlist.insert(DRAWABLE());

	DRAWABLE & draw = dlist.get(lights.back().draw);
	draw.SetColor(col[0], col[1], col[2]);
	draw.SetModel(*mesh);
	draw.SetCull(true, true);
	draw.SetDrawEnable(false);

	return true;
}
static wakeup_t bright_found(wakeup_t data) {
	return LIGHT(LIGHTSENS)>(unsigned short)data;
}
static wakeup_t dark_found(wakeup_t data) {
	return LIGHT(LIGHTSENS)<(unsigned short)data;
}
Ejemplo n.º 12
0
void		add_light(t_scene *scene, t_vector position, int radius)
{
	lstadd(&scene->lights, &LIGHT(position, radius), sizeof(t_light));
}
Ejemplo n.º 13
0
/* Toggle the light at the specified coordinates 
 * without updating the groplist. This is for setting up the board. */
void invertLightNoupdate(int lx,int ly) {
   if (lx < 0 || lx >= boardwidth ||
       ly < 0 || ly >= boardheight)
     return;
   LIGHT(lx,ly) = !LIGHT(lx,ly);
}