simplify, don't store extra state
This commit is contained in:
@@ -33,9 +33,6 @@ ActorScroller::ActorScroller()
|
|||||||
m_fPauseCountdownSeconds = 0;
|
m_fPauseCountdownSeconds = 0;
|
||||||
m_fQuantizePixels = 0;
|
m_fQuantizePixels = 0;
|
||||||
|
|
||||||
m_bUseMask = false;
|
|
||||||
m_fMaskWidth = 1;
|
|
||||||
m_fMaskHeight = 1;
|
|
||||||
m_quadMask.SetBlendMode( BLEND_NO_EFFECT ); // don't change color values
|
m_quadMask.SetBlendMode( BLEND_NO_EFFECT ); // don't change color values
|
||||||
m_quadMask.SetUseZBuffer( true ); // we want to write to the Zbuffer
|
m_quadMask.SetUseZBuffer( true ); // we want to write to the Zbuffer
|
||||||
m_quadMask.SetHidden( true );
|
m_quadMask.SetHidden( true );
|
||||||
@@ -56,8 +53,6 @@ void ActorScroller::Load2(
|
|||||||
CLAMP( fSecondsPauseBetweenItems, 0, 10000 );
|
CLAMP( fSecondsPauseBetweenItems, 0, 10000 );
|
||||||
|
|
||||||
m_fNumItemsToDraw = fNumItemsToDraw;
|
m_fNumItemsToDraw = fNumItemsToDraw;
|
||||||
m_fMaskWidth = fItemWidth;
|
|
||||||
m_fMaskHeight = fItemHeight;
|
|
||||||
|
|
||||||
m_exprTransformFunction.SetFromExpression(
|
m_exprTransformFunction.SetFromExpression(
|
||||||
ssprintf("function(self,offset,itemIndex,numItems) return self:y(%f*offset) end",fItemHeight),
|
ssprintf("function(self,offset,itemIndex,numItems) return self:y(%f*offset) end",fItemHeight),
|
||||||
@@ -72,12 +67,11 @@ void ActorScroller::Load2(
|
|||||||
|
|
||||||
ScrollThroughAllItems();
|
ScrollThroughAllItems();
|
||||||
|
|
||||||
m_bUseMask = true;
|
|
||||||
RectF rectBarSize(
|
RectF rectBarSize(
|
||||||
-m_fMaskWidth/2,
|
-fItemWidth/2,
|
||||||
-m_fMaskHeight/2,
|
-fItemHeight/2,
|
||||||
m_fMaskWidth/2,
|
fItemWidth/2,
|
||||||
m_fMaskHeight/2 );
|
fItemHeight/2 );
|
||||||
m_quadMask.StretchTo( rectBarSize );
|
m_quadMask.StretchTo( rectBarSize );
|
||||||
m_quadMask.SetZ( 1 );
|
m_quadMask.SetZ( 1 );
|
||||||
|
|
||||||
@@ -101,7 +95,7 @@ void ActorScroller::Load3(
|
|||||||
m_bFastCatchup = bFastCatchup;
|
m_bFastCatchup = bFastCatchup;
|
||||||
m_exprTransformFunction.SetFromExpression( sTransformFunction, iSubdivisions );
|
m_exprTransformFunction.SetFromExpression( sTransformFunction, iSubdivisions );
|
||||||
m_fQuantizePixels = 0;
|
m_fQuantizePixels = 0;
|
||||||
m_bUseMask = bUseMask;
|
m_quadMask.SetHidden( !bUseMask );
|
||||||
m_bLoop = bLoop;
|
m_bLoop = bLoop;
|
||||||
m_bLoaded = true;
|
m_bLoaded = true;
|
||||||
}
|
}
|
||||||
@@ -149,18 +143,20 @@ void ActorScroller::LoadFromNode( const CString &sDir, const XNode *pNode )
|
|||||||
pNode->GetAttrValue( "Subdivisions", iSubdivisions );
|
pNode->GetAttrValue( "Subdivisions", iSubdivisions );
|
||||||
#undef GET_VALUE
|
#undef GET_VALUE
|
||||||
|
|
||||||
|
bool bUseMask = false;
|
||||||
|
pNode->GetAttrValue( "UseMask", bUseMask );
|
||||||
|
|
||||||
Load3(
|
Load3(
|
||||||
fSecondsPerItem,
|
fSecondsPerItem,
|
||||||
fNumItemsToDraw,
|
fNumItemsToDraw,
|
||||||
false,
|
false,
|
||||||
sTransformFunction,
|
sTransformFunction,
|
||||||
iSubdivisions,
|
iSubdivisions,
|
||||||
false,
|
bUseMask,
|
||||||
false );
|
false );
|
||||||
SetCurrentAndDestinationItem( -fItemPaddingStart );
|
SetCurrentAndDestinationItem( -fItemPaddingStart );
|
||||||
SetDestinationItem( m_SubActors.size()-1+fItemPaddingEnd );
|
SetDestinationItem( m_SubActors.size()-1+fItemPaddingEnd );
|
||||||
|
|
||||||
pNode->GetAttrValue( "UseMask", m_bUseMask );
|
|
||||||
pNode->GetAttrValue( "QuantizePixels", m_fQuantizePixels );
|
pNode->GetAttrValue( "QuantizePixels", m_fQuantizePixels );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +233,7 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bPosition, bool bDrawPr
|
|||||||
float fFirstItemToDraw = 0;
|
float fFirstItemToDraw = 0;
|
||||||
float fLastItemToDraw = 0;
|
float fLastItemToDraw = 0;
|
||||||
|
|
||||||
if( m_bUseMask )
|
if( !m_quadMask.GetHidden() )
|
||||||
{
|
{
|
||||||
// write to z buffer so that top and bottom are clipped
|
// write to z buffer so that top and bottom are clipped
|
||||||
float fPositionFullyOnScreenTop = -(m_fNumItemsToDraw-1)/2.f;
|
float fPositionFullyOnScreenTop = -(m_fNumItemsToDraw-1)/2.f;
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ private:
|
|||||||
float m_fPauseCountdownSeconds;
|
float m_fPauseCountdownSeconds;
|
||||||
float m_fQuantizePixels;
|
float m_fQuantizePixels;
|
||||||
|
|
||||||
bool m_bUseMask;
|
|
||||||
float m_fMaskWidth;
|
|
||||||
float m_fMaskHeight;
|
|
||||||
Quad m_quadMask;
|
Quad m_quadMask;
|
||||||
|
|
||||||
LuaExpressionTransform m_exprTransformFunction; // params: self,offset,itemIndex,numItems
|
LuaExpressionTransform m_exprTransformFunction; // params: self,offset,itemIndex,numItems
|
||||||
|
|||||||
Reference in New Issue
Block a user