コード例 #1
0
void DispInfo_BuildPrimLists(
    IDispInfo *pHead,
    CDispInfo *visibleDisps[MAX_MAP_DISPINFO],
    int &nVisibleDisps )
{
    VPROF("DispInfo_BuildPrimLists");

    nVisibleDisps = 0;

    for( IDispInfo *pCur=pHead; pCur; pCur = pCur->GetNextInRenderChain() )
    {
        CDispInfo *pDisp = static_cast<CDispInfo*>( pCur );

        if( pDisp->Render( pDisp->m_pMesh ) )
        {
            // Add it to the list of visible displacements.
            if( nVisibleDisps < MAX_MAP_DISPINFO )
            {
                visibleDisps[nVisibleDisps++] = pDisp;
            }

#ifndef SWDS
            int nSurfID = pDisp->GetParent();
            OverlayMgr()->AddFragmentListToRenderList( MSurf_OverlayFragmentList( nSurfID ) );
#endif
        }

//		g_EngineStats.IncrementCountedStat( ENGINE_STATS_NUM_DISP_TRIANGLES, 1 );
    }
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Renders all displacements in sorted order
//-----------------------------------------------------------------------------
void DispInfo_RenderChain( IDispInfo *pHead, bool bOrtho )
{
#ifndef SWDS
    if( !r_DrawDisp.GetInt() || !pHead )
        return;

    // Cache this off only once per frame
    CDispInfo::g_flDispRadius = r_DispRadius.GetFloat();

    g_bDispOrthoRender = bOrtho;

    // The list of dispinfos that need to be retesselated.
    CDispInfo *retesselate[MAX_RETESSELATE];
    int nRetesselate = 0;

    if( !r_DispLockLOD.GetInt() )
    {
        DispInfo_UpdateDisplacements( pHead, retesselate, nRetesselate );
    }

    {
        // Kept outside to keep it from becoming insane.
        VPROF("DispInfo_RenderChain.TesselateDisplacement()");
        // Retesselate dispinfos that need to be.
        for( int iRetesselate=0; iRetesselate < nRetesselate; iRetesselate++ )
        {
            retesselate[iRetesselate]->TesselateDisplacement();
        }
    }

    // Build up the CPrimLists for all the displacements.
    CDispInfo *visibleDisps[MAX_MAP_DISPINFO];
    int nVisibleDisps;

    DispInfo_BuildPrimLists( pHead, visibleDisps, nVisibleDisps );

    // Draw..
    DispInfo_DrawPrimLists();

    // Debugging rendering..
    DispInfo_DrawDebugInformation(pHead);

    // FIXME: Move these two calls into a separate function
    // so that all overlays can be rendered, followed by all decals.

    // Overlays
    OverlayMgr()->RenderOverlays( );

    // Decals
    DispInfo_DrawDecals( visibleDisps, nVisibleDisps );
#endif
}
コード例 #3
0
ファイル: TiRoot.cpp プロジェクト: cty41/Titan
//-------------------------------------------------------------------------------//
Root::Root(const String& configName, const String& logName)
    :mWindow(0), mLogMgr(0), mActiveRenderer(0),
     mConfigFileName(configName), mSceneMgrSelector(0), mFileSystemMgr(0),
     mResourceGroupMgr(0), mFontMgr(0)
{
    mTimer = TITAN_NEW Timer();

    mLogMgr = TITAN_NEW LogMgr(logName, false);

    mSceneMgrSelector = TITAN_NEW SceneMgrSelector();
    mSceneMgrSelector->addFactory(TITAN_NEW QuadtreeSceneMgrFactory());

    addSceneObjectFactory(TITAN_NEW ManualObjectFactory());


#if TITAN_USE_NEW_D11_RENDERER

#ifdef _DEBUG
    loadPlugin("Plugin_D3D11Renderer_d.dll");
#else
    loadPlugin("Plugin_D3D11Renderer.dll");
#endif
#else
#ifdef _DEBUG
    loadPlugin("Plugin_D3D9Renderer_d.dll");
#else
    loadPlugin("Plugin_D3D9Renderer.dll");
#endif

#endif
    mActiveRenderer = mRendererVector[0];

    mFileSystemMgr = TITAN_NEW FileSystemManager();
    mFileSystemMgr->addFileSystemFactory(TITAN_NEW CommonFileSystemFactory());

    mResourceGroupMgr = TITAN_NEW ResourceGroupMgr();

    mScriptCompilerMgr = TITAN_NEW ScriptCompilerMgr();

    mMaterialMgr = TITAN_NEW MaterialMgr();

    mOverlayMgr = TITAN_NEW OverlayMgr();

    mFontMgr = TITAN_NEW FontMgr();

}