Beispiel #1
0
void Material::RotateTextureMatrixZ(float angle, int idx)
{
	//mUseTextureMatrix = true;
	IvMatrix44 m;
	m.RotationZ(angle);
	mTextureMatrices[idx] *= m;
}
Beispiel #2
0
//-------------------------------------------------------------------------------
// @ Player::Update()
//-------------------------------------------------------------------------------
// Main update loop
//-------------------------------------------------------------------------------
void
Player::Update( float dt )
{
    float r = 0.0f;
    static bool lightDirChanged = true;

    // set up rotate
    if (IvGame::mGame->mEventHandler->IsKeyDown('o'))
    {
        r -= kPI*0.25f*dt;
        lightDirChanged = true;
    }
    if (IvGame::mGame->mEventHandler->IsKeyDown('u'))
    {
        r += kPI*0.25f*dt;
        lightDirChanged = true;
    }

    if (lightDirChanged)
    {
        IvMatrix44 rotate;
        rotate.RotationZ(r);
       
        mLightDir = rotate.Transform(mLightDir);
        mLightDir.Normalize();

        lightDirChanged = false;
    }

    // clear transform
    if (IvGame::mGame->mEventHandler->IsKeyDown(' '))
    {
        mRotate.Identity();
    }
}   // End of Player::Update()