Beispiel #1
0
        private void BuildModels(idMapFile mapFile)
        {
            idConsole.Warning("TODO: idTimer");

            /*idTimer timer;
            *  timer.Start();*/

            if (LoadCollisionModelFile(mapFile.Name, 0 /* TODO: mapFile->GetGeometryCRC()*/) == false)
            {
                idConsole.Warning("TODO: no collision model, compile");

                /*if ( !mapFile->GetNumEntities() ) {
                 *      return;
                 * }
                 *
                 * // load the .proc file bsp for data optimisation
                 * LoadProcBSP( mapFile->GetName() );
                 *
                 * // convert brushes and patches to collision data
                 * for ( i = 0; i < mapFile->GetNumEntities(); i++ ) {
                 *      mapEnt = mapFile->GetEntity(i);
                 *
                 *      if ( numModels >= MAX_SUBMODELS ) {
                 *              common->Error( "idCollisionModelManagerLocal::BuildModels: more than %d collision models", MAX_SUBMODELS );
                 *              break;
                 *      }
                 *      models[numModels] = CollisionModelForMapEntity( mapEnt );
                 *      if ( models[ numModels] ) {
                 *              numModels++;
                 *      }
                 * }
                 *
                 * // free the proc bsp which is only used for data optimization
                 * Mem_Free( procNodes );
                 * procNodes = NULL;
                 *
                 * // write the collision models to a file
                 * WriteCollisionModelsToFile( mapFile->GetName(), 0, numModels, mapFile->GetGeometryCRC() );*/
            }

            idConsole.Warning("TODO: timer.Stop();");

            // print statistics on collision data

            /*cm_model_t model;
             * AccumulateModelInfo( &model );
             * common->Printf( "collision data:\n" );
             * common->Printf( "%6i models\n", numModels );
             * PrintModelInfo( &model );
             * common->Printf( "%.0f msec to load collision data.\n", timer.Milliseconds() );*/
        }
Beispiel #2
0
        public void LoadMap(idMapFile mapFile)
        {
            if (mapFile == null)
            {
                idConsole.Error("idCollisionModelManager::LoadMap: NULL mapFile");
            }

            // check whether we can keep the current collision map based on the mapName and mapFileTime
            if (_isLoaded == true)
            {
                if (_mapName.Equals(mapFile.Name, StringComparison.OrdinalIgnoreCase) == true)
                {
                    idConsole.Warning("TODO: loadmap load check");

                    /*if ( mapFile->GetFileTime() == mapFileTime ) {
                     *      common->DPrintf( "Using loaded version\n" );
                     *      return;
                     * }*/

                    idConsole.DeveloperWriteLine("Reloading modified map");
                }

                idConsole.Warning("TODO: FreeMap();");
            }

            // clear the collision map
            Clear();

            // models
            _models     = new CollisionModel[idE.MaxSubModels + 1];
            _modelCount = 0;

            // setup hash to speed up finding shared vertices and edges
            idConsole.Warning("TODO: SetupHash();");

            // setup trace model structure
            SetupTraceModelStructure();

            // build collision models
            BuildModels(mapFile);

            // save name and time stamp
            _mapName = mapFile.Name;
            idConsole.Warning("TODO: mapFileTime = mapFile->GetFileTime();");

            _isLoaded = true;

            // shutdown the hash
            idConsole.Warning("TODO: ShutdownHash();");
        }