Пример #1
0
//-------------------------------------------------------------------------------
// @ Game::Render()
//-------------------------------------------------------------------------------
// Render stuff
//-------------------------------------------------------------------------------
void 
Game::Render()                                  
{       
    // set perspective matrix
    Perspective( IvRenderer::mRenderer->GetFOV(), 
                (float)IvRenderer::mRenderer->GetWidth()/(float)IvRenderer::mRenderer->GetHeight(), 
                IvRenderer::mRenderer->GetNearPlane(), 
                IvRenderer::mRenderer->GetFarPlane() );

    // set viewer
    IvSetDefaultViewer( -10.0f, 0.0f, 5.0f );

    // draw axes
    IvDrawAxes();

    // draw floor
    IvDrawFloor();

    // draw some objects
    IvMatrix44 worldTransform;
    worldTransform.Translation( IvVector3( 0.0f, 0.0f, 1.0f ) );
    IvSetWorldMatrix( worldTransform );
    IvDrawCube();

    worldTransform.Translation( IvVector3( 0.0f, 3.0f, 0.0f ) );
    IvSetWorldMatrix( worldTransform );
    IvDrawTeapot();

    worldTransform.Translation( IvVector3( 0.0f, -2.5f, 1.0f ) );
    IvSetWorldMatrix( worldTransform );
    IvDrawSphere( 1.0f );
}
Пример #2
0
void Material::TranslateTextureMatrix(const IvVector3& p, int idx)
{
	//mUseTextureMatrix = true;
	IvMatrix44 m;
	m.Translation(p);
	mTextureMatrices[idx] *= m;
}
Пример #3
0
//-------------------------------------------------------------------------------
// @ Game::Render()
//-------------------------------------------------------------------------------
// Render stuff
//-------------------------------------------------------------------------------
void 
Game::Render()                                  
{       
    // set perspective matrix
    float aspect = (float)IvRenderer::mRenderer->GetWidth()/(float)IvRenderer::mRenderer->GetHeight();
    if ( mUseOrthographic )
    {
        Orthographic( -aspect*3.0f+mXCenter, aspect*3.0f+mXCenter,
                   -3.0f+mYCenter, 3.0f+mYCenter,
                    IvRenderer::mRenderer->GetNearPlane(), 
                    IvRenderer::mRenderer->GetFarPlane() );
    }
    else
    {
        Frustum( -aspect*3.0f+mXCenter, aspect*3.0f+mXCenter,
                   -3.0f+mYCenter, 3.0f+mYCenter,
                    IvRenderer::mRenderer->GetNearPlane(), 
                    IvRenderer::mRenderer->GetFarPlane() );
    }

    // set viewer
    ::IvSetDefaultViewer( 6.0f, 0.0f, 5.f );

    // draw axes
    ::IvDrawAxes();

    // draw floor
    ::IvDrawFloor();

    // draw some objects
    IvMatrix44 worldTransform;
    worldTransform.Translation( IvVector3( 0.1f, 0.0f, 1.0f ) );
    ::IvSetWorldMatrix( worldTransform );
    ::IvDrawCube();

    worldTransform.Translation( IvVector3( 0.1f, 3.0f, 0.0f ) );
    ::IvSetWorldMatrix( worldTransform );
    ::IvDrawTeapot();

    worldTransform.Translation( IvVector3( 0.1f, -2.5f, 1.0f ) );
    ::IvSetWorldMatrix( worldTransform );
    ::IvDrawSphere( 1.0f );

}
Пример #4
0
//-------------------------------------------------------------------------------
// @ Player::Render()
//-------------------------------------------------------------------------------
// Render stuff
//-------------------------------------------------------------------------------
void 
Player::Render()                                    
{   
    mLinearInterp.Render();

    // build 4x4 matrix
    IvMatrix44 transform;
    transform.Translation( mTranslate );
    
    IvSetWorldMatrix( transform );
    IvDrawTeapot();
}
Пример #5
0
//-------------------------------------------------------------------------------
// @ Player::Render()
//-------------------------------------------------------------------------------
// Render stuff
//-------------------------------------------------------------------------------
void 
Player::Render()                                    
{   
    // draw curve
    mCurve.Render();

    // build 4x4 matrix
    IvMatrix44 transform;
    transform.Translation( mTranslate );
    
    IvSetWorldMatrix( transform );

    // draw the teapot
    IvDrawTeapot();

}