Frustum used for spotlights. It is not supposed to be part of the scene, and will not be rendered. The ViewMatrix and ProjectionMatrix properties, used for projecting texturing, are updated only when a spotlight is assigned at the Light property.
상속: Axiom.Core.Frustum
예제 #1
0
		public void LoadWorldGeometry()
		{
			this.bspGeometry = new BspGeometry();

			if ( !optionList.ContainsKey( "Map" ) )
			{
				throw new AxiomException( "Unable to load world geometry. \"Map\" filename option is not set." );
			}

			if ( Path.GetExtension( ( (string)optionList[ "Map" ] ).ToLower() ) != ".bsp" )
			{
				throw new AxiomException( "Unable to load world geometry. Invalid extension of map filename option (must be .bsp)." );
			}

			if ( !optionList.ContainsKey( "SetYAxisUp" ) )
			{
				optionList[ "SetYAxisUp" ] = false;
			}

			if ( !optionList.ContainsKey( "Scale" ) )
			{
				optionList[ "Scale" ] = 1f;
			}

			if ( !optionList.ContainsKey( "Move" ) )
			{
				optionList[ "Move" ] = Vector3.Zero;
				optionList[ "MoveX" ] = 0;
				optionList[ "MoveY" ] = 0;
				optionList[ "MoveZ" ] = 0;
			}

			if ( !optionList.ContainsKey( "UseLightmaps" ) )
			{
				optionList[ "UseLightmaps" ] = true;
			}

			if ( !optionList.ContainsKey( "AmbientEnabled" ) )
			{
				optionList[ "AmbientEnabled" ] = false;
			}

			if ( !optionList.ContainsKey( "AmbientRatio" ) )
			{
				optionList[ "AmbientRatio" ] = 1f;
			}

			InitTextureLighting();

			if ( this.spotlightFrustum == null )
			{
				this.spotlightFrustum = new SpotlightFrustum();
			}

			var paramList = new NameValuePairList();

			foreach ( DictionaryEntry option in optionList )
			{
				paramList.Add( option.Key.ToString(), option.Value.ToString() );
			}

			// Load using resource manager
			this.level =
				(BspLevel)
				BspResourceManager.Instance.Load( (string)optionList[ "Map" ], ResourceGroupManager.Instance.WorldResourceGroupName,
				                                  false, null, paramList );

			// Init static render operation
			this.renderOp.vertexData = this.level.VertexData;

			// index data is per-frame
			this.renderOp.indexData = new IndexData();
			this.renderOp.indexData.indexStart = 0;
			this.renderOp.indexData.indexCount = 0;

			// Create enough index space to render whole level
			this.renderOp.indexData.indexBuffer = HardwareBufferManager.Instance.CreateIndexBuffer( IndexType.Size32,
			                                                                                        this.level.NumIndexes,
			                                                                                        BufferUsage.Dynamic, false );
			this.renderOp.operationType = OperationType.TriangleList;
			this.renderOp.useIndices = true;
		}
        public void LoadWorldGeometry()
        {
            if (!optionList.ContainsKey("Map"))
                throw new AxiomException("Unable to load world geometry. \"Map\" filename option is not set.");

            if(Path.GetExtension(((string)optionList["Map"]).ToLower()) != ".bsp")
                throw new AxiomException("Unable to load world geometry. Invalid extension of map filename option (must be .bsp).");

            if (!optionList.ContainsKey("SetYAxisUp"))
                optionList["SetYAxisUp"] = false;

            if (!optionList.ContainsKey("Scale"))
                optionList["Scale"] = 1f;

            if (!optionList.ContainsKey("Move"))
                optionList["Move"] = Vector3.Zero;

            if (!optionList.ContainsKey("UseLightmaps"))
                optionList["UseLightmaps"] = true;

            if (!optionList.ContainsKey("AmbientEnabled"))
                optionList["AmbientEnabled"] = false;

            if (!optionList.ContainsKey("AmbientRatio"))
                optionList["AmbientRatio"] = 1f;

            InitTextureLighting();

            if (spotlightFrustum == null)
                spotlightFrustum = new SpotlightFrustum();

            // Load using resource manager
            level = BspResourceManager.Instance.Load((string)optionList["Map"]);

            // Init static render operation
            renderOp.vertexData = level.VertexData;

            // index data is per-frame
            renderOp.indexData = new IndexData();
            renderOp.indexData.indexStart = 0;
            renderOp.indexData.indexCount = 0;

            // Create enough index space to render whole level
            renderOp.indexData.indexBuffer = HardwareBufferManager.Instance.CreateIndexBuffer(
                IndexType.Size32,
                level.NumIndexes,
                BufferUsage.Dynamic, false
                );
            renderOp.operationType = OperationType.TriangleList;
            renderOp.useIndices = true;
        }