Ejemplo n.º 1
0
//
// R_InitColormaps
//
// killough 3/20/98: rewritten to allow dynamic colormaps
// and to remove unnecessary 256-byte alignment
//
// killough 4/4/98: Add support for C_START/C_END markers
//
void R_InitColormaps()
{
   const WadDirectory::namespace_t &ns =
      wGlobalDir.getNamespace(lumpinfo_t::ns_colormaps);

   r_numglobalmaps = 1; // always at least 1, for COLORMAP

   // check for global FOGMAP, for Hexen's benefit
   int fogmap;
   if((fogmap = W_CheckNumForName("FOGMAP")) >= 0)
      ++r_numglobalmaps;

   numcolormaps = ns.numLumps + r_numglobalmaps;

   // colormaps[0] is always the global COLORMAP lump
   size_t numbytes = sizeof(*colormaps) * numcolormaps;
   int    cmlump   = W_GetNumForName("COLORMAP");

   colormaps    = emalloctag(lighttable_t **, numbytes, PU_RENDERER, 0);
   colormaps[0] = (lighttable_t *)(wGlobalDir.cacheLumpNum(cmlump, PU_RENDERER));

   // colormaps[1] is FOGMAP, if it exists
   if(fogmap >= 0)
      colormaps[1] = (lighttable_t *)(wGlobalDir.cacheLumpNum(fogmap, PU_RENDERER));

   // load other colormaps from the colormaps namespace
   int i = r_numglobalmaps;
   WadNamespaceIterator nsi(wGlobalDir, lumpinfo_t::ns_colormaps);
  
   for(nsi.begin(); nsi.current(); nsi.next(), i++)
      colormaps[i] = (lighttable_t *)(wGlobalDir.cacheLumpNum((*nsi)->selfindex, PU_RENDERER));

   firstcolormaplump = ns.firstLump;
}
Ejemplo n.º 2
0
void StateManager::ManageState(const Ogre::String& id, State* state){
	state_info nsi(id, state);
	nsi._state->Init(m_render_window, m_message_system);
	m_states.push_back(nsi);
}
    void MMAPV1DatabaseCatalogEntry::_lazyInit( OperationContext* txn ) {
        // this is sort of insane
        // it's because the whole structure is highly recursive

        _namespaceIndex.init( txn );

        NamespaceString nsi( name(), "system.indexes" );
        NamespaceString nsn( name(), "system.namespaces" );

        boost::mutex::scoped_lock lk( _collectionsLock );

        bool isSystemIndexesGoingToBeNew = _namespaceIndex.details( nsi.toString() ) == NULL;

        _ensureSystemCollection_inlock( txn, nsn.toString() );
        _ensureSystemCollection_inlock( txn, nsi.toString() );

        Entry*& indexEntry = _collections[nsi.toString()];
        Entry*& nsEntry = _collections[nsn.toString()];

        NamespaceDetails* indexDetails = _namespaceIndex.details( nsi.toString() );
        NamespaceDetails* nsDetails = _namespaceIndex.details( nsn.toString() );

        // order has to be:
        // 1) ns rs
        // 2) i rs
        // 3) catalog entries

        if ( !nsEntry ) {
            nsEntry = new Entry();

            NamespaceDetailsRSV1MetaData* md = new NamespaceDetailsRSV1MetaData( nsn.toString(),
                                                                                 nsDetails,
                                                                                 NULL );
            nsEntry->recordStore.reset( new SimpleRecordStoreV1( txn,
                                                                 nsn.toString(),
                                                                 md,
                                                                 &_extentManager,
                                                                 false ) );

            if ( nsEntry->recordStore->storageSize( txn ) == 0 )
                nsEntry->recordStore->increaseStorageSize( txn, _extentManager.initialSize( 128 ), false );
        }

        if ( !indexEntry ) {
            indexEntry = new Entry();

            NamespaceDetailsRSV1MetaData* md = new NamespaceDetailsRSV1MetaData( nsi.toString(),
                                                                                 indexDetails,
                                                                                 nsEntry->recordStore.get() );
            indexEntry->recordStore.reset( new SimpleRecordStoreV1( txn,
                                                                    nsi.toString(),
                                                                    md,
                                                                    &_extentManager,
                                                                    true ) );

            if ( indexEntry->recordStore->storageSize( txn ) == 0 )
                indexEntry->recordStore->increaseStorageSize( txn, _extentManager.initialSize( 128 ), false );
        }

        if ( isSystemIndexesGoingToBeNew ) {
            _addNamespaceToNamespaceCollection_inlock( txn, nsi.toString(), NULL );
        }

        if ( !nsEntry->catalogEntry )
            nsEntry->catalogEntry.reset( new NamespaceDetailsCollectionCatalogEntry( nsn.toString(),
                                                                                     nsDetails,
                                                                                     indexEntry->recordStore.get(),
                                                                                     this ) );

        if ( !indexEntry->catalogEntry )
            indexEntry->catalogEntry.reset( new NamespaceDetailsCollectionCatalogEntry( nsi.toString(),
                                                                                        indexDetails,
                                                                                        indexEntry->recordStore.get(),
                                                                                        this ) );
    }