상속: idRenderModel
예제 #1
0
        public void Init()
        {
            // TODO: cmds

            /*cmdSystem->AddCommand( "listModels", ListModels_f, CMD_FL_RENDERER, "lists all models" );
             * cmdSystem->AddCommand( "printModel", PrintModel_f, CMD_FL_RENDERER, "prints model info", idCmdSystem::ArgCompletion_ModelName );
             * cmdSystem->AddCommand( "reloadModels", ReloadModels_f, CMD_FL_RENDERER|CMD_FL_CHEAT, "reloads models" );
             * cmdSystem->AddCommand( "touchModel", TouchModel_f, CMD_FL_RENDERER, "touches a model", idCmdSystem::ArgCompletion_ModelName );*/

            _insideLevelLoad = false;

            // create a default model
            idRenderModel_Static model = new idRenderModel_Static();

            model.InitEmpty("_DEFAULT");
            model.MakeDefault();
            model.IsLevelLoadReferenced = true;

            _defaultModel = model;

            AddModel(model);

            // create the beam model
            // TODO: beam

            /*idRenderModelStatic *beam = new idRenderModelBeam;
             * beam->InitEmpty( "_BEAM" );
             * beam->SetLevelLoadReferenced( true );
             * beamModel = beam;
             * AddModel( beam );*/

            // TODO: sprite

            /*idRenderModelStatic *sprite = new idRenderModelSprite;
             * sprite->InitEmpty( "_SPRITE" );
             * sprite->SetLevelLoadReferenced( true );
             * spriteModel = sprite;
             * AddModel( sprite );*/
        }
예제 #2
0
        private idRenderModel GetModel(string name, bool createIfNotFound)
        {
            idRenderModel model;
            string        extension;

            if (_models.ContainsKey(name) == true)
            {
                model = _models[name];

                if (model.IsLoaded == false)
                {
                    // reload it if it was purged
                    model.Load();
                }
                else if ((_insideLevelLoad == true) && (model.IsLevelLoadReferenced == false))
                {
                    // we are reusing a model already in memory, but
                    // touch all the materials to make sure they stay
                    // in memory as well
                    model.TouchData();
                }

                model.IsLevelLoadReferenced = true;

                return(model);
            }

            model     = null;
            extension = Path.GetExtension(name).ToLower();

            // see if we can load it
            // determine which subclass of idRenderModel to initialize
            switch (extension)
            {
            case ".ase":
            case ".lwo":
            case ".flt":
            case ".ma":
                model = new idRenderModel_Static();
                model.InitFromFile(name);
                break;

            case ".md5mesh":
                model = new idRenderModel_MD5();
                model.InitFromFile(name);
                break;

            case ".md3":
                idConsole.Warning("TODO: md3");
                break;

            case ".prt":
                model = new idRenderModel_PRT();
                model.InitFromFile(name);
                break;

            case ".liquid":
                idConsole.Warning("TODO: liquid");
                break;
            }

            if (model == null)
            {
                if (extension != string.Empty)
                {
                    idConsole.Warning("unknown model type '{0}'", name);
                }

                if (createIfNotFound == false)
                {
                    return(null);
                }

                model = new idRenderModel_Static();
                model.InitEmpty(name);
                model.MakeDefault();
            }

            model.IsLevelLoadReferenced = true;

            if ((createIfNotFound == false) && (model.IsDefault == true))
            {
                model.Dispose();

                return(null);
            }


            AddModel(model);

            return(model);
        }
예제 #3
0
		private idRenderModel GetModel(string name, bool createIfNotFound)
		{
			idRenderModel model;
			string extension;

			if(_models.ContainsKey(name) == true)
			{
				model = _models[name];

				if(model.IsLoaded == false)
				{
					// reload it if it was purged
					model.Load();
				}
				else if((_insideLevelLoad == true) && (model.IsLevelLoadReferenced == false))
				{
					// we are reusing a model already in memory, but
					// touch all the materials to make sure they stay
					// in memory as well
					model.TouchData();
				}

				model.IsLevelLoadReferenced = true;

				return model;
			}
		
			model = null;
			extension = Path.GetExtension(name).ToLower();

			// see if we can load it	
			// determine which subclass of idRenderModel to initialize
			switch(extension)
			{
				case ".ase":
				case ".lwo":
				case ".flt":
				case ".ma":
					model = new idRenderModel_Static();
					model.InitFromFile(name);
					break;

				case ".md5mesh":
					model = new idRenderModel_MD5();
					model.InitFromFile(name);
					break;

				case ".md3":
					idConsole.Warning("TODO: md3");
					break;

				case ".prt":
					model = new idRenderModel_PRT();
					model.InitFromFile(name);
					break;

				case ".liquid":
					idConsole.Warning("TODO: liquid");
					break;
			}

			if(model == null)
			{
				if(extension != string.Empty)
				{
					idConsole.Warning("unknown model type '{0}'", name);
				}

				if(createIfNotFound == false)
				{
					return null;
				}

				model = new idRenderModel_Static();
				model.InitEmpty(name);
				model.MakeDefault();
			}

			model.IsLevelLoadReferenced = true;

			if((createIfNotFound == false) && (model.IsDefault == true))
			{
				model.Dispose();

				return null;
			}


			AddModel(model);

			return model;
		}
예제 #4
0
		public void Init()
		{
			// TODO: cmds
			/*cmdSystem->AddCommand( "listModels", ListModels_f, CMD_FL_RENDERER, "lists all models" );
			cmdSystem->AddCommand( "printModel", PrintModel_f, CMD_FL_RENDERER, "prints model info", idCmdSystem::ArgCompletion_ModelName );
			cmdSystem->AddCommand( "reloadModels", ReloadModels_f, CMD_FL_RENDERER|CMD_FL_CHEAT, "reloads models" );
			cmdSystem->AddCommand( "touchModel", TouchModel_f, CMD_FL_RENDERER, "touches a model", idCmdSystem::ArgCompletion_ModelName );*/

			_insideLevelLoad = false;
			
			// create a default model
			idRenderModel_Static model = new idRenderModel_Static();
			model.InitEmpty("_DEFAULT");
			model.MakeDefault();
			model.IsLevelLoadReferenced = true;

			_defaultModel = model;

			AddModel(model);

			// create the beam model
			// TODO: beam
			/*idRenderModelStatic *beam = new idRenderModelBeam;
			beam->InitEmpty( "_BEAM" );
			beam->SetLevelLoadReferenced( true );
			beamModel = beam;
			AddModel( beam );*/

			// TODO: sprite
			/*idRenderModelStatic *sprite = new idRenderModelSprite;
			sprite->InitEmpty( "_SPRITE" );
			sprite->SetLevelLoadReferenced( true );
			spriteModel = sprite;
			AddModel( sprite );*/
		}