GLbitfield FrameBufferStateCache::GetClearMask( GLbitfield mask, bool forceClear, bool scissorTestEnabled )
{
  if( scissorTestEnabled )
  {
    // don't do anything if scissor test is enabled, in the future we could
    // potentially keep track of frame buffer size vs scissor test size to see if the entire
    // buffer is cleared or not.
    return mask;
  }
  FrameBufferState* state = GetFrameBufferState( mCurrentFrameBufferId );
  if( !state )
  {
    DALI_LOG_ERROR("FrameBuffer not found %d \n", mCurrentFrameBufferId);
    return mask;
  }

  // if we are forcing the clear operation, then just update the internal cached values
  if( forceClear )
  {
    SetClearState( state, mask );
    return mask;
  }

  // use the cached values
  if( mask & GL_COLOR_BUFFER_BIT)
  {
    // check if color buffer is currently clean
    if( state->mState & COLOR_BUFFER_CLEAN )
    {
      // remove clear color buffer flag from bitmask, no need to clear twice
      mask&= ~GL_COLOR_BUFFER_BIT;
    }
  }
  if( mask & GL_DEPTH_BUFFER_BIT)
  {
    // check if depth buffer is currently clean
    if( state->mState & DEPTH_BUFFER_CLEAN )
    {
      // remove clear depth buffer flag from bitmask, no need to clear twice
      mask&= ~GL_DEPTH_BUFFER_BIT;
    }
  }
  if( mask & GL_STENCIL_BUFFER_BIT)
  {
    // check if stencil buffer is currently clean
    if( state->mState & STENCIL_BUFFER_CLEAN )
    {
      // remove clear stencil buffer flag from bitmask, no need to clear twice

      mask&= ~GL_STENCIL_BUFFER_BIT;
    }
  }

  // set the clear state based, what's about to be cleared
  SetClearState( state, mask );

  return mask;
}
示例#2
0
文件: Arm.cpp 项目: patrickhno/bandit
Arm::Arm(Rect &rect) : View(rect) {

    anim = new Bitmap32(String("normalopt/armanim/banditt"),Bitmap32::cARGB);
    SetClearState(false);
    Apply(anim);

    brainstate = BS_FREE;
}
示例#3
0
MovieScroller::MovieScroller(View *_parent) : View(Rect(0,0,1,1)){

	SetClip(false);

	parent = _parent;
//parent->SetClip(false);
	SetClearState(false);
	SetColor(ARGB(255.0f/255.0f,212.0f/255.0f,95.0f/255.0f));
	parent->Apply(this);
	offset = 0;
}
示例#4
0
ScrollText::ScrollText(View *parent) : View(Rect(0,0,1,1)){//, Message(){
	SetClearState(false);
	SetColor(ARGB(255.0f/255.0f,212.0f/255.0f,95.0f/255.0f));
	parent->Apply(this);
	offset = 0;
//	SetName("ScrollText");
	#ifdef OPENGL
	#else
	Print("Error!");
	#endif

	urgent = new DynamicArray();
	state = SCROLL_TICK;

	uview = new View(Rect(.4f,0,1,1));
	uview->SetColor(ARGB(255.0f/255.0f,212.0f/255.0f,95.0f/255.0f));
	uview->SetClearState(false);
	parent->Apply(uview);

	Font *font = new Font("Fonts/swed");//Humnst777_BT_40");
	font->SetSize(.5f);
	uview->Apply(font);
}
示例#5
0
PlayField::PlayField(Hiscore *h, View *parent, ScrollText *st) : View(Rect(0,0,1,1)), Message(){ //-.25f,-.25f,1.25f,1.25f)){

//	Listen("/Devices/Input/Dialogic");
	SetClearState(false);

	#ifdef NEWSCALE

	parent->Apply(this);
	players  = new DynamicArray();
	channels = new DynamicArray();
	int dir = 0;
	int x = 1;
	int y = 1;
	int xr = 2;
	int yb = 2;
	int xl = 0;
	int yt = 0;
	int n = 1;
	for(int _x=0; _x<4; _x++){
		for(int _y=0; _y<4; _y++){
			Player *pl = new Player(h,Rect((float(x)/4.0f),(float(y)/4.0f),(float(x+1)/4.0f),(float(y+1)/4.0f)),st,n++);
			Apply(pl);
			players->Add(pl);
			channels->Add(0);
			switch(dir){
			case 0: if(++x==xr){ dir++; xr++; } break;
			case 1: if(++y==yb){ dir++; yb++; } break;
			case 2: if(--x==xl){ dir++; xl--; } break;
			case 3: if(--y==yt){ dir=0; yt--; } break;
			}
		}
	}

	#else

	parent->Apply(this);
	players  = new DynamicArray();
	channels = new DynamicArray();
	int dir = 0;
	int x = 1;
	int y = 1;
	int xr = 2;
	int yb = 2;
	int xl = 1;
	int yt = 1;
	int n = 1;
	for(int _x=0; _x<4; _x++){
		for(int _y=0; _y<4; _y++){
			Player *pl = new Player(h,Rect((float(x)/4.0f),(float(y)/4.0f),(float(x+1)/4.0f),(float(y+1)/4.0f)),st,n++);
			Apply(pl);
			players->Add(pl);
			channels->Add(0);
			switch(dir){
			case 0: if(++x==xr){ dir++; xr++; } break;
			case 1: if(++y==yb){ dir++; yb++; } break;
			case 2: if(--x==xl){ dir++; xl--; } break;
			case 3: if(--y==yt){ dir=0; yt--; x--; y--; } break;
			}
		}
	}
	#endif
	foo = 0;
	player_count=0;

	zoom = .5f;
	xz = yz = 0;

	Listen("/Devices/Input/Dialogic");
}
示例#6
0
PhoneNumber::PhoneNumber(class Rect &rect) : View(rect){
	SetClearState(false);
/*

	Font *font = new Font("Fonts/swed");//Humnst777_BT_40");
	font->SetSize(.7f);
Apply(font);
	Bitmap *mask = font->GetString("Call 801802803");
//	mask->Scale(Rect(mask->GetWidth()*.4f,mask->GetHeight()*.85f));
	delete font;
	anim = new Bitmap32("texteffect/textfx",Bitmap32::cRGB);

	int cnt = anim->GetFrameCount();
	for(int n=0; n<cnt; n++){
		anim->SetFrame(n);
		*anim *= *mask;
	}
anim->Invalidate();
	Apply(mask);//anim);
//	delete mask;

*/
	view = new View(Rect(.1f,.15f,1,1));
	Apply(view);
//	Font *font = new Font("Fonts/swed");//Humnst777_BT_40");
//	font->SetSize(.7f);
	view->SetClearState(false);
//	view->Apply(font);
//	#ifdef OPENGL
//	#else
//	view->Print("Error!");
//	#endif
	pnview1 = new View(Rect(.04f,.03f,1-.03f,1-.15f));
	pnview1->SetClearState(false);
	pnview2 = new View(Rect(.04f,.03f,1-.03f,1-.15f));
	pnview2->SetClearState(false);
	pnview3 = new View(Rect(.04f,.03f,1-.03f,1-.15f));
	pnview3->SetClearState(false);
//	Apply(pnview);
	pnbm1 = new Bitmap32("call/0714/0714",Bitmap32::cARGB);
	pnbm2 = new Bitmap32("call/mobil/mobil",Bitmap32::cARGB);
	pnbm3 = new Bitmap32("call/0724/0724",Bitmap32::cARGB);
	Apply(pnview1);
	Apply(pnview2);
	Apply(pnview3);
	pnview1->Apply(pnbm1);
	pnview2->Apply(pnbm2);
	pnview3->Apply(pnbm3);

	jview = new View(Rect(.04f,-.2f,1-.03f,1-.25f));
	jview->SetClearState(false);
	Apply(jview);
	jbm = new Bitmap32("jacklogo/jack/jack",Bitmap32::cARGB);
	Apply(jview);
	jview->Apply(jbm);

	tbview = new View(Rect(.04f,-.2f,1-.03f,1-.25f));
	tbview->SetClearState(false);
	Apply(tbview);
	tbbm = new Bitmap32("jacklogo/the bandit/thebandit",Bitmap32::cARGB);
	Apply(tbview);
	tbview->Apply(tbbm);

	Font *small = new Font("Fonts/swed");//Humnst777_BT_40");
	small->SetSize(.5f);
	cview = new View(Rect(0,.6f,1,1));
	cview->SetClearState(false);
	#ifdef OPENGL
	#else
	cview->Print("Error!");
	#endif
	cview->Apply(small);
	cview->SetColor(ARGB(.5f,1,.3f));
//	Apply(cview);

	think = 0;
}