Exemplo n.º 1
0
void IGLUShaderVariable::operator= ( int2 val )
{
	// Check for a valid shader index
	if ( m_varIdx < 0 ) return;

	// Check for type mismatches
	if ( m_isAttribute )
	{
		AssignmentToAttribute( "ivec2" );
		return;
	}
	if ( m_varType != GL_INT_VEC2 && m_varType != GL_UNSIGNED_INT_VEC2 )
		TypeMismatch( "ivec2" );

	// Ensure this program is currently bound, or setting shader values fails!
	m_parent->PushProgram();

	// For types of variable that can be assigned from our input value, assign them here
	if ( m_varType == GL_INT_VEC2 )
		glUniform2iv( m_varIdx, 1, val.GetConstDataPtr() ); 
	if ( m_varType == GL_UNSIGNED_INT_VEC2 )
		glUniform2ui( m_varIdx, val.X(), val.Y() );

	// We have a short "program stack" so make sure to pop off.
	m_parent->PopProgram();
}	
Exemplo n.º 2
0
bool ListBox::OnMouseButtonRelease( const int2& screenPos, uint32_t button )
{
	bool eventConsumed = false;

	if (button == MS_LeftButton)
	{
		if (mPressed)
		{
			if (mSelectionRegion.Contains((float)screenPos.X(), (float)screenPos.Y()))
			{
				int32_t selIndex = mVertScrollBar->GetScrollValue() + (int32_t)floorf((screenPos.Y() - mSelectionRegion.Top()) / mTextRowHeight);
				SetSelectedIndex(selIndex, true);			
			}	

			mPressed = false;
			eventConsumed = true;
		}
	}

	return eventConsumed;
}
Exemplo n.º 3
0
//---------------------------------------------------------------------------------------------------------
BlockGenerator::BlockGenerator( const int2& size, int blockSize ) : mSize(size), mBockSize(blockSize)
{
	mNumBlocks = int2(
		(int)std::ceil(size.X() / (float) blockSize),
		(int)std::ceil(size.Y() / (float) blockSize));

	mBlocksLeft = mNumBlocks.X() * mNumBlocks.Y();

	mDirection = Right;

	mBlock = mNumBlocks / 2;

	mStepsLeft = 1;
	mNumSteps = 1;

	mStartTime = clock();
}