add Skew for faux italic fonts
This commit is contained in:
@@ -371,6 +371,12 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
|
||||
|
||||
DISPLAY->MultMatrix(mat);
|
||||
}
|
||||
|
||||
if( m_pTempState->fSkewX != 0 )
|
||||
{
|
||||
DISPLAY->SkewX( m_pTempState->fSkewX );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Actor::SetGlobalRenderStates()
|
||||
@@ -925,6 +931,7 @@ void Actor::TweenState::Init()
|
||||
rotation = RageVector3( 0, 0, 0 );
|
||||
quat = RageVector4( 0, 0, 0, 1 );
|
||||
scale = RageVector3( 1, 1, 1 );
|
||||
fSkewX = 0;
|
||||
crop = RectF( 0,0,0,0 );
|
||||
fade = RectF( 0,0,0,0 );
|
||||
for(int i=0; i<4; i++)
|
||||
@@ -938,6 +945,7 @@ void Actor::TweenState::MakeWeightedAverage( TweenState& average_out, const Twee
|
||||
average_out.scale = ts1.scale + (ts2.scale - ts1.scale )*fPercentBetween;
|
||||
average_out.rotation = ts1.rotation + (ts2.rotation - ts1.rotation)*fPercentBetween;
|
||||
RageQuatSlerp(&average_out.quat, ts1.quat, ts2.quat, fPercentBetween);
|
||||
average_out.fSkewX = ts1.fSkewX + (ts2.fSkewX - ts1.fSkewX)*fPercentBetween;
|
||||
|
||||
average_out.crop.left = ts1.crop.left + (ts2.crop.left - ts1.crop.left )*fPercentBetween;
|
||||
average_out.crop.top = ts1.crop.top + (ts2.crop.top - ts1.crop.top )*fPercentBetween;
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
RageVector3 rotation;
|
||||
RageVector4 quat;
|
||||
RageVector3 scale;
|
||||
float fSkewX;
|
||||
RectF crop; // 0 = no cropping, 1 = fully cropped
|
||||
RectF fade; // 0 = no fade
|
||||
RageColor diffuse[4];
|
||||
@@ -171,6 +172,9 @@ public:
|
||||
void AddRotationP( float rot );
|
||||
void AddRotationR( float rot );
|
||||
|
||||
void SetSkewX( float fAmount ) { DestTweenState().fSkewX = fAmount; }
|
||||
float GetSkewX( float fAmount ) { return DestTweenState().fSkewX; }
|
||||
|
||||
float GetCropLeft() { return DestTweenState().crop.left; }
|
||||
float GetCropTop() { return DestTweenState().crop.top; }
|
||||
float GetCropRight() { return DestTweenState().crop.right;}
|
||||
@@ -523,6 +527,7 @@ public:
|
||||
static int rotationx( T* p, lua_State *L ) { p->SetRotationX(FArg(1)); return 0; }
|
||||
static int rotationy( T* p, lua_State *L ) { p->SetRotationY(FArg(1)); return 0; }
|
||||
static int rotationz( T* p, lua_State *L ) { p->SetRotationZ(FArg(1)); return 0; }
|
||||
static int skewx( T* p, lua_State *L ) { p->SetSkewX(FArg(1)); return 0; }
|
||||
static int heading( T* p, lua_State *L ) { p->AddRotationH(FArg(1)); return 0; }
|
||||
static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; }
|
||||
static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; }
|
||||
@@ -631,6 +636,7 @@ public:
|
||||
ADD_METHOD( rotationx )
|
||||
ADD_METHOD( rotationy )
|
||||
ADD_METHOD( rotationz )
|
||||
ADD_METHOD( skewx )
|
||||
ADD_METHOD( heading )
|
||||
ADD_METHOD( pitch )
|
||||
ADD_METHOD( roll )
|
||||
|
||||
@@ -326,6 +326,13 @@ public:
|
||||
MultMatrixLocal( m );
|
||||
}
|
||||
|
||||
void SkewX( float fAmount )
|
||||
{
|
||||
RageMatrix m;
|
||||
RageMatrixSkewX( &m, fAmount );
|
||||
MultMatrixLocal( m );
|
||||
}
|
||||
|
||||
// Obtain the current matrix at the top of the stack
|
||||
const RageMatrix* GetTop() { return &stack.back(); }
|
||||
};
|
||||
@@ -396,6 +403,11 @@ void RageDisplay::RotateZ( float deg )
|
||||
g_WorldStack.RotateZLocal( deg );
|
||||
}
|
||||
|
||||
void RageDisplay::SkewX( float fAmount )
|
||||
{
|
||||
g_WorldStack.SkewX( fAmount );
|
||||
}
|
||||
|
||||
void RageDisplay::PostMultMatrix( const RageMatrix &m )
|
||||
{
|
||||
g_WorldStack.MultMatrix( m );
|
||||
|
||||
@@ -268,6 +268,7 @@ public:
|
||||
void RotateX( float deg );
|
||||
void RotateY( float deg );
|
||||
void RotateZ( float deg );
|
||||
void SkewX( float fAmount );
|
||||
void MultMatrix( const RageMatrix &f ) { this->PostMultMatrix(f); } /* alias */
|
||||
void PostMultMatrix( const RageMatrix &f );
|
||||
void PreMultMatrix( const RageMatrix &f );
|
||||
|
||||
@@ -158,6 +158,12 @@ void RageMatrixScaling( RageMatrix* pOut, float x, float y, float z )
|
||||
pOut->m[2][2] = z;
|
||||
}
|
||||
|
||||
void RageMatrixSkewX( RageMatrix* pOut, float fAmount )
|
||||
{
|
||||
RageMatrixIdentity(pOut);
|
||||
pOut->m[1][0] = fAmount;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return:
|
||||
*
|
||||
|
||||
@@ -25,6 +25,7 @@ void RageMatrixIdentity( RageMatrix* pOut );
|
||||
void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB );
|
||||
void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z );
|
||||
void RageMatrixScaling( RageMatrix* pOut, float x, float y, float z );
|
||||
void RageMatrixSkewX( RageMatrix* pOut, float fAmount );
|
||||
void RageMatrixTranslateAndScale( RageMatrix* pOut, float fTransX, float fTransY, float fTransZ, float fScaleX, float fScaleY, float fScaleZ );
|
||||
void RageMatrixRotationX( RageMatrix* pOut, float fTheta );
|
||||
void RageMatrixRotationY( RageMatrix* pOut, float fTheta );
|
||||
|
||||
Reference in New Issue
Block a user