add Skew for faux italic fonts

This commit is contained in:
Chris Danford
2005-05-02 21:43:27 +00:00
parent 4169ecfa61
commit 0ac5e2b008
6 changed files with 34 additions and 0 deletions
+8
View File
@@ -371,6 +371,12 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
DISPLAY->MultMatrix(mat); DISPLAY->MultMatrix(mat);
} }
if( m_pTempState->fSkewX != 0 )
{
DISPLAY->SkewX( m_pTempState->fSkewX );
}
} }
void Actor::SetGlobalRenderStates() void Actor::SetGlobalRenderStates()
@@ -925,6 +931,7 @@ void Actor::TweenState::Init()
rotation = RageVector3( 0, 0, 0 ); rotation = RageVector3( 0, 0, 0 );
quat = RageVector4( 0, 0, 0, 1 ); quat = RageVector4( 0, 0, 0, 1 );
scale = RageVector3( 1, 1, 1 ); scale = RageVector3( 1, 1, 1 );
fSkewX = 0;
crop = RectF( 0,0,0,0 ); crop = RectF( 0,0,0,0 );
fade = RectF( 0,0,0,0 ); fade = RectF( 0,0,0,0 );
for(int i=0; i<4; i++) 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.scale = ts1.scale + (ts2.scale - ts1.scale )*fPercentBetween;
average_out.rotation = ts1.rotation + (ts2.rotation - ts1.rotation)*fPercentBetween; average_out.rotation = ts1.rotation + (ts2.rotation - ts1.rotation)*fPercentBetween;
RageQuatSlerp(&average_out.quat, ts1.quat, ts2.quat, 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.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; average_out.crop.top = ts1.crop.top + (ts2.crop.top - ts1.crop.top )*fPercentBetween;
+6
View File
@@ -57,6 +57,7 @@ public:
RageVector3 rotation; RageVector3 rotation;
RageVector4 quat; RageVector4 quat;
RageVector3 scale; RageVector3 scale;
float fSkewX;
RectF crop; // 0 = no cropping, 1 = fully cropped RectF crop; // 0 = no cropping, 1 = fully cropped
RectF fade; // 0 = no fade RectF fade; // 0 = no fade
RageColor diffuse[4]; RageColor diffuse[4];
@@ -171,6 +172,9 @@ public:
void AddRotationP( float rot ); void AddRotationP( float rot );
void AddRotationR( 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 GetCropLeft() { return DestTweenState().crop.left; }
float GetCropTop() { return DestTweenState().crop.top; } float GetCropTop() { return DestTweenState().crop.top; }
float GetCropRight() { return DestTweenState().crop.right;} 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 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 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 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 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 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; } static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; }
@@ -631,6 +636,7 @@ public:
ADD_METHOD( rotationx ) ADD_METHOD( rotationx )
ADD_METHOD( rotationy ) ADD_METHOD( rotationy )
ADD_METHOD( rotationz ) ADD_METHOD( rotationz )
ADD_METHOD( skewx )
ADD_METHOD( heading ) ADD_METHOD( heading )
ADD_METHOD( pitch ) ADD_METHOD( pitch )
ADD_METHOD( roll ) ADD_METHOD( roll )
+12
View File
@@ -326,6 +326,13 @@ public:
MultMatrixLocal( m ); MultMatrixLocal( m );
} }
void SkewX( float fAmount )
{
RageMatrix m;
RageMatrixSkewX( &m, fAmount );
MultMatrixLocal( m );
}
// Obtain the current matrix at the top of the stack // Obtain the current matrix at the top of the stack
const RageMatrix* GetTop() { return &stack.back(); } const RageMatrix* GetTop() { return &stack.back(); }
}; };
@@ -396,6 +403,11 @@ void RageDisplay::RotateZ( float deg )
g_WorldStack.RotateZLocal( deg ); g_WorldStack.RotateZLocal( deg );
} }
void RageDisplay::SkewX( float fAmount )
{
g_WorldStack.SkewX( fAmount );
}
void RageDisplay::PostMultMatrix( const RageMatrix &m ) void RageDisplay::PostMultMatrix( const RageMatrix &m )
{ {
g_WorldStack.MultMatrix( m ); g_WorldStack.MultMatrix( m );
+1
View File
@@ -268,6 +268,7 @@ public:
void RotateX( float deg ); void RotateX( float deg );
void RotateY( float deg ); void RotateY( float deg );
void RotateZ( float deg ); void RotateZ( float deg );
void SkewX( float fAmount );
void MultMatrix( const RageMatrix &f ) { this->PostMultMatrix(f); } /* alias */ void MultMatrix( const RageMatrix &f ) { this->PostMultMatrix(f); } /* alias */
void PostMultMatrix( const RageMatrix &f ); void PostMultMatrix( const RageMatrix &f );
void PreMultMatrix( const RageMatrix &f ); void PreMultMatrix( const RageMatrix &f );
+6
View File
@@ -158,6 +158,12 @@ void RageMatrixScaling( RageMatrix* pOut, float x, float y, float z )
pOut->m[2][2] = z; pOut->m[2][2] = z;
} }
void RageMatrixSkewX( RageMatrix* pOut, float fAmount )
{
RageMatrixIdentity(pOut);
pOut->m[1][0] = fAmount;
}
/* /*
* Return: * Return:
* *
+1
View File
@@ -25,6 +25,7 @@ void RageMatrixIdentity( RageMatrix* pOut );
void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB ); void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB );
void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z ); void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z );
void RageMatrixScaling( 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 RageMatrixTranslateAndScale( RageMatrix* pOut, float fTransX, float fTransY, float fTransZ, float fScaleX, float fScaleY, float fScaleZ );
void RageMatrixRotationX( RageMatrix* pOut, float fTheta ); void RageMatrixRotationX( RageMatrix* pOut, float fTheta );
void RageMatrixRotationY( RageMatrix* pOut, float fTheta ); void RageMatrixRotationY( RageMatrix* pOut, float fTheta );