LoadFromStream() public method

Reads Quake3 bsp data from a chunk of memory as read from the file.
Since ResourceManagers generally locate data in a variety of places they typically manipulate them as a chunk of data, rather than a file pointer since this is unsupported through compressed archives.

Quake3 files are made up of a header (which contains version info and a table of the contents) and 17 'lumps' i.e. sections of data, the offsets to which are kept in the table of contents. The 17 types are predefined.

public LoadFromStream ( Stream inChunk ) : void
inChunk Stream
return void
Ejemplo n.º 1
0
        /// <summary>
        ///		Generic load - called by <see cref="Plugin_BSPSceneManager.BspResourceManager"/>.
        /// </summary>
        public override void Load()
        {
            Hashtable options = SceneManagerEnumerator.Instance.GetSceneManager(SceneType.Interior).Options;

            if (options.ContainsKey("SetYAxisUp"))
            {
                bspOptions.setYAxisUp = (bool)options["SetYAxisUp"];
            }

            if (options.ContainsKey("Scale"))
            {
                bspOptions.scale = (float)options["Scale"];
            }

            if (options.ContainsKey("Move"))
            {
                bspOptions.move = (Vector3)options["Move"];
            }

            if (options.ContainsKey("UseLightmaps"))
            {
                bspOptions.useLightmaps = (bool)options["UseLightmaps"];
            }

            if (options.ContainsKey("AmbientEnabled"))
            {
                bspOptions.ambientEnabled = (bool)options["AmbientEnabled"];
            }

            if (options.ContainsKey("AmbientRatio"))
            {
                bspOptions.ambientRatio = (float)options["AmbientRatio"];
            }

            Quake3Level q3 = new Quake3Level(bspOptions);

            Stream chunk = BspResourceManager.Instance.FindResourceData(name);

            q3.LoadFromStream(chunk);
            LoadQuake3Level(q3);
            chunk.Close();

            isLoaded = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///		Generic load - called by <see cref="Plugin_BSPSceneManager.BspResourceManager"/>.
        /// </summary>
        public override void Load()
        {
            Hashtable options = SceneManagerEnumerator.Instance.GetSceneManager(SceneType.Interior).Options;

            if (options.ContainsKey("SetYAxisUp"))
                bspOptions.setYAxisUp = (bool)options["SetYAxisUp"];

            if (options.ContainsKey("Scale"))
                bspOptions.scale = (float)options["Scale"];

            if (options.ContainsKey("Move"))
                bspOptions.move = (Vector3)options["Move"];

            if (options.ContainsKey("UseLightmaps"))
                bspOptions.useLightmaps = (bool)options["UseLightmaps"];

            if (options.ContainsKey("AmbientEnabled"))
                bspOptions.ambientEnabled = (bool)options["AmbientEnabled"];

            if (options.ContainsKey("AmbientRatio"))
                bspOptions.ambientRatio = (float)options["AmbientRatio"];

            Quake3Level q3 = new Quake3Level(bspOptions);

            Stream chunk = BspResourceManager.Instance.FindResourceData(name);
            q3.LoadFromStream(chunk);
            LoadQuake3Level(q3);
            chunk.Close();

            isLoaded = true;
        }
Ejemplo n.º 3
0
		public void Load( Stream stream )
		{
			if ( createParam.ContainsKey( "SetYAxisUp" ) )
				bool.TryParse( createParam[ "SetYAxisUp" ], out bspOptions.setYAxisUp );

			if ( createParam.ContainsKey( "Scale" ) )
				float.TryParse( createParam[ "Scale" ], out bspOptions.scale );

			Vector3 move = Vector3.Zero;
			if ( createParam.ContainsKey( "MoveX" ) )
				Real.TryParse( createParam[ "MoveX" ], out move.x );

			if ( createParam.ContainsKey( "MoveY" ) )
				Real.TryParse( createParam[ "MoveY" ], out move.y );

			if ( createParam.ContainsKey( "MoveZ" ) )
				Real.TryParse( createParam[ "MoveZ" ], out move.z );

			if ( createParam.ContainsKey( "UseLightmaps" ) )
				bool.TryParse( createParam[ "UseLightmaps" ], out bspOptions.useLightmaps );

			if ( createParam.ContainsKey( "AmbientEnabled" ) )
				bool.TryParse( createParam[ "AmbientEnabled" ], out bspOptions.ambientEnabled );

			if ( createParam.ContainsKey( "AmbientRatio" ) )
				float.TryParse( createParam[ "AmbientRatio" ], out bspOptions.ambientRatio );

			Quake3Level q3 = new Quake3Level( bspOptions );

			q3.LoadFromStream( stream );

			LoadQuake3Level( q3 );

		}
Ejemplo n.º 4
0
		/// <summary>
		///		Generic load - called by <see cref="Plugin_BSPSceneManager.BspResourceManager"/>.
		/// </summary>
		protected override void load()
		{
			//if ( createParam.ContainsKey( "SetYAxisUp" ) )
			//    bool.TryParse( createParam[ "SetYAxisUp" ], out bspOptions.setYAxisUp);

			//if ( createParam.ContainsKey( "Scale" ) )
			//    float.TryParse( createParam[ "Scale" ], out bspOptions.scale );

			//Vector3 move = Vector3.Zero;
			//if ( createParam.ContainsKey( "MoveX" ) )
			//     float.TryParse( createParam[ "MoveX" ], out move.x );

			//if ( createParam.ContainsKey("MoveY" ) )
			//    float.TryParse( createParam["MoveY"], out move.y );

			//if ( createParam.ContainsKey( "MoveZ" ) )
			//    float.TryParse( createParam["MoveZ"], out move.z );

			//if ( createParam.ContainsKey( "UseLightmaps" ) )
			//     bool.TryParse( createParam[ "UseLightmaps" ], out bspOptions.useLightmaps );

			//if ( createParam.ContainsKey( "AmbientEnabled" ) )
			//     bool.TryParse( createParam[ "AmbientEnabled" ], out bspOptions.ambientEnabled );

			//if ( createParam.ContainsKey( "AmbientRatio") )
			//     float.TryParse( createParam[ "AmbientRatio" ], out bspOptions.ambientRatio );

			Quake3Level q3 = new Quake3Level( bspOptions );

			Stream chunk = ResourceGroupManager.Instance.OpenResource( Name, ResourceGroupManager.Instance.WorldResourceGroupName );
			q3.LoadFromStream( chunk );
			LoadQuake3Level( q3 );
			chunk.Close();

		}