예제 #1
0
        private void ReadLeaves(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.leaves.Length; i++)
            {
                this.leaves[i]         = new InternalBspLeaf();
                this.leaves[i].cluster = reader.ReadInt32();
                this.leaves[i].area    = reader.ReadInt32();

                this.leaves[i].bbox = new int[6];

                for (int j = 0; j < this.leaves[i].bbox.Length; j++)
                {
                    this.leaves[i].bbox[j] = reader.ReadInt32();
                }

                this.leaves[i].faceStart  = reader.ReadInt32();
                this.leaves[i].faceCount  = reader.ReadInt32();
                this.leaves[i].brushStart = reader.ReadInt32();
                this.leaves[i].brushCount = reader.ReadInt32();

                TransformBoundingBox(this.leaves[i].bbox);
            }
        }
예제 #2
0
        private void ReadShaders(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            this.shaders = new InternalBspShader[lump.size / typeof(InternalBspShader).Size()];

            for (int i = 0; i < this.shaders.Length; i++)
            {
                char[] name = Encoding.UTF8.GetChars(reader.ReadBytes(64));

                this.shaders[i] = new InternalBspShader();
                this.shaders[i].surfaceFlags =
                    (SurfaceFlags)Enum.Parse(typeof(SurfaceFlags), reader.ReadInt32().ToString(), false);
                this.shaders[i].contentFlags =
                    (ContentFlags)Enum.Parse(typeof(ContentFlags), reader.ReadInt32().ToString(), false);

                foreach (char c in name)
                {
                    if (c == '\0')
                    {
                        break;
                    }

                    this.shaders[i].name += c;
                }
            }
        }
예제 #3
0
        private void ReadLeaves(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            leaves = new InternalBspLeaf[lump.size / Marshal.SizeOf(typeof(InternalBspLeaf))];

            for (int i = 0; i < leaves.Length; i++)
            {
                leaves[i]         = new InternalBspLeaf();
                leaves[i].cluster = reader.ReadInt32();
                leaves[i].area    = reader.ReadInt32();

                leaves[i].bbox = new int[6];

                for (int j = 0; j < leaves[i].bbox.Length; j++)
                {
                    leaves[i].bbox[j] = reader.ReadInt32();
                }

                leaves[i].faceStart  = reader.ReadInt32();
                leaves[i].faceCount  = reader.ReadInt32();
                leaves[i].brushStart = reader.ReadInt32();
                leaves[i].brushCount = reader.ReadInt32();

                TransformBoundingBox(leaves[i].bbox);
            }
        }
예제 #4
0
        private void ReadVertices(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.vertices.Length; i++)
            {
                this.vertices[i]       = new InternalBspVertex();
                this.vertices[i].point = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
                };
                this.vertices[i].texture = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle()
                };
                this.vertices[i].lightMap = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle()
                };
                this.vertices[i].normal = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
                };
                this.vertices[i].color = reader.ReadInt32();

                TransformVector(this.vertices[i].point);
                TransformVector(this.vertices[i].normal, true);
            }
        }
예제 #5
0
        private void ReadVisData(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            this.visData = new InternalBspVis();
            this.visData.clusterCount = reader.ReadInt32();
            this.visData.rowSize      = reader.ReadInt32();
            this.visData.data         = reader.ReadBytes(lump.offset - (typeof(int).Size() * 2));
        }
예제 #6
0
        private void ReadLeafBrushes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.leafBrushes.Length; i++)
            {
                this.leafBrushes[i] = reader.ReadInt32();
            }
        }
예제 #7
0
        private void ReadLeafBrushes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            leafBrushes = new int[lump.size / Marshal.SizeOf(typeof(int))];

            for (int i = 0; i < leafBrushes.Length; i++)
            {
                leafBrushes[i] = reader.ReadInt32();
            }
        }
예제 #8
0
        private void ReadBrushes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.brushes.Length; i++)
            {
                this.brushes[i]             = new InternalBspBrush();
                this.brushes[i].firstSide   = reader.ReadInt32();
                this.brushes[i].numSides    = reader.ReadInt32();
                this.brushes[i].shaderIndex = reader.ReadInt32();
            }
        }
예제 #9
0
        private void ReadBrushSides(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            this.brushSides = new InternalBspBrushSide[lump.size / typeof(InternalBspBrushSide).Size()];

            for (int i = 0; i < this.brushSides.Length; i++)
            {
                this.brushSides[i]          = new InternalBspBrushSide();
                this.brushSides[i].planeNum = reader.ReadInt32();
                this.brushSides[i].content  = reader.ReadInt32();
            }
        }
예제 #10
0
        private void ReadBrushes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            brushes = new InternalBspBrush[lump.size / Marshal.SizeOf(typeof(InternalBspBrush))];

            for (int i = 0; i < brushes.Length; i++)
            {
                brushes[i]             = new InternalBspBrush();
                brushes[i].firstSide   = reader.ReadInt32();
                brushes[i].numSides    = reader.ReadInt32();
                brushes[i].shaderIndex = reader.ReadInt32();
            }
        }
예제 #11
0
        private void ReadPlanes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            planes = new InternalBspPlane[lump.size / Marshal.SizeOf(typeof(InternalBspPlane))];

            for (int i = 0; i < planes.Length; i++)
            {
                planes[i]          = new InternalBspPlane();
                planes[i].normal   = new float[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
                planes[i].distance = reader.ReadSingle();

                TransformPlane(planes[i].normal, ref planes[i].distance);
            }
        }
예제 #12
0
        private void ReadFaces(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.faces.Length; i++)
            {
                this.faces[i]           = new InternalBspFace();
                this.faces[i].shader    = reader.ReadInt32();
                this.faces[i].unknown   = reader.ReadInt32();
                this.faces[i].type      = (BspFaceType)Enum.Parse(typeof(BspFaceType), reader.ReadInt32().ToString(), false);
                this.faces[i].vertStart = reader.ReadInt32();
                this.faces[i].vertCount = reader.ReadInt32();
                this.faces[i].elemStart = reader.ReadInt32();
                this.faces[i].elemCount = reader.ReadInt32();
                this.faces[i].lmTexture = reader.ReadInt32();

                this.faces[i].lmOffset = new int[]
                {
                    reader.ReadInt32(), reader.ReadInt32()
                };
                this.faces[i].lmSize = new int[]
                {
                    reader.ReadInt32(), reader.ReadInt32()
                };
                this.faces[i].org = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
                };

                this.faces[i].bbox = new float[6];

                for (int j = 0; j < this.faces[i].bbox.Length; j++)
                {
                    this.faces[i].bbox[j] = reader.ReadSingle();
                }

                this.faces[i].normal = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
                };
                this.faces[i].meshCtrl = new int[]
                {
                    reader.ReadInt32(), reader.ReadInt32()
                };

                TransformBoundingBox(this.faces[i].bbox);
                TransformVector(this.faces[i].org);
                TransformVector(this.faces[i].normal, true);
            }
        }
예제 #13
0
        private void ReadPlanes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.planes.Length; i++)
            {
                this.planes[i]        = new InternalBspPlane();
                this.planes[i].normal = new float[]
                {
                    reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
                };
                this.planes[i].distance = reader.ReadSingle();

                TransformPlane(this.planes[i].normal, ref this.planes[i].distance);
            }
        }
예제 #14
0
        private void ReadVertices(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            vertices = new InternalBspVertex[lump.size / Marshal.SizeOf(typeof(InternalBspVertex))];

            for (int i = 0; i < vertices.Length; i++)
            {
                vertices[i]          = new InternalBspVertex();
                vertices[i].point    = new float[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].texture  = new float[] { reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].lightMap = new float[] { reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].normal   = new float[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].color    = reader.ReadInt32();

                TransformVector(vertices[i].point);
                TransformVector(vertices[i].normal, true);
            }
        }
예제 #15
0
        private void ReadNodes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.nodes.Length; i++)
            {
                this.nodes[i]       = new InternalBspNode();
                this.nodes[i].plane = reader.ReadInt32();
                this.nodes[i].front = reader.ReadInt32();
                this.nodes[i].back  = reader.ReadInt32();
                this.nodes[i].bbox  = new int[6];

                for (int j = 0; j < this.nodes[i].bbox.Length; j++)
                {
                    this.nodes[i].bbox[j] = reader.ReadInt32();
                }

                TransformBoundingBox(this.nodes[i].bbox);
            }
        }
예제 #16
0
        private void ReadNodes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            nodes = new InternalBspNode[lump.size / Marshal.SizeOf(typeof(InternalBspNode))];

            for (int i = 0; i < nodes.Length; i++)
            {
                nodes[i]       = new InternalBspNode();
                nodes[i].plane = reader.ReadInt32();
                nodes[i].front = reader.ReadInt32();
                nodes[i].back  = reader.ReadInt32();
                nodes[i].bbox  = new int[6];

                for (int j = 0; j < nodes[i].bbox.Length; j++)
                {
                    nodes[i].bbox[j] = reader.ReadInt32();
                }

                TransformBoundingBox(nodes[i].bbox);
            }
        }
예제 #17
0
        private void ReadModels(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);

            for (int i = 0; i < this.models.Length; i++)
            {
                this.models[i]      = new InternalBspModel();
                this.models[i].bbox = new float[6];

                for (int j = 0; j < this.models[i].bbox.Length; j++)
                {
                    this.models[i].bbox[j] = reader.ReadSingle();
                }

                this.models[i].faceStart  = reader.ReadInt32();
                this.models[i].faceCount  = reader.ReadInt32();
                this.models[i].brushStart = reader.ReadInt32();
                this.models[i].brushCount = reader.ReadInt32();

                TransformBoundingBox(this.models[i].bbox);
            }
        }
예제 #18
0
        private void ReadModels(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            models = new InternalBspModel[lump.size / Marshal.SizeOf(typeof(InternalBspModel))];

            for (int i = 0; i < models.Length; i++)
            {
                models[i]      = new InternalBspModel();
                models[i].bbox = new float[6];

                for (int j = 0; j < models[i].bbox.Length; j++)
                {
                    models[i].bbox[j] = reader.ReadSingle();
                }

                models[i].faceStart  = reader.ReadInt32();
                models[i].faceCount  = reader.ReadInt32();
                models[i].brushStart = reader.ReadInt32();
                models[i].brushCount = reader.ReadInt32();

                TransformBoundingBox(models[i].bbox);
            }
        }
예제 #19
0
		private void ReadPlanes( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.planes.Length; i++ )
			{
				this.planes[ i ] = new InternalBspPlane();
				this.planes[ i ].normal = new float[]
				                          {
				                          	reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
				                          };
				this.planes[ i ].distance = reader.ReadSingle();

				TransformPlane( this.planes[ i ].normal, ref this.planes[ i ].distance );
			}
		}
예제 #20
0
		private void ReadNodes( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.nodes.Length; i++ )
			{
				this.nodes[ i ] = new InternalBspNode();
				this.nodes[ i ].plane = reader.ReadInt32();
				this.nodes[ i ].front = reader.ReadInt32();
				this.nodes[ i ].back = reader.ReadInt32();
				this.nodes[ i ].bbox = new int[6];

				for ( int j = 0; j < this.nodes[ i ].bbox.Length; j++ )
				{
					this.nodes[ i ].bbox[ j ] = reader.ReadInt32();
				}

				TransformBoundingBox( this.nodes[ i ].bbox );
			}
		}
예제 #21
0
		private void ReadModels( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.models.Length; i++ )
			{
				this.models[ i ] = new InternalBspModel();
				this.models[ i ].bbox = new float[6];

				for ( int j = 0; j < this.models[ i ].bbox.Length; j++ )
				{
					this.models[ i ].bbox[ j ] = reader.ReadSingle();
				}

				this.models[ i ].faceStart = reader.ReadInt32();
				this.models[ i ].faceCount = reader.ReadInt32();
				this.models[ i ].brushStart = reader.ReadInt32();
				this.models[ i ].brushCount = reader.ReadInt32();

				TransformBoundingBox( this.models[ i ].bbox );
			}
		}
예제 #22
0
		private void ReadLeaves( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.leaves.Length; i++ )
			{
				this.leaves[ i ] = new InternalBspLeaf();
				this.leaves[ i ].cluster = reader.ReadInt32();
				this.leaves[ i ].area = reader.ReadInt32();

				this.leaves[ i ].bbox = new int[6];

				for ( int j = 0; j < this.leaves[ i ].bbox.Length; j++ )
				{
					this.leaves[ i ].bbox[ j ] = reader.ReadInt32();
				}

				this.leaves[ i ].faceStart = reader.ReadInt32();
				this.leaves[ i ].faceCount = reader.ReadInt32();
				this.leaves[ i ].brushStart = reader.ReadInt32();
				this.leaves[ i ].brushCount = reader.ReadInt32();

				TransformBoundingBox( this.leaves[ i ].bbox );
			}
		}
예제 #23
0
		private void ReadFaces( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.faces.Length; i++ )
			{
				this.faces[ i ] = new InternalBspFace();
				this.faces[ i ].shader = reader.ReadInt32();
				this.faces[ i ].unknown = reader.ReadInt32();
				this.faces[ i ].type = (BspFaceType)Enum.Parse( typeof ( BspFaceType ), reader.ReadInt32().ToString(), false );
				this.faces[ i ].vertStart = reader.ReadInt32();
				this.faces[ i ].vertCount = reader.ReadInt32();
				this.faces[ i ].elemStart = reader.ReadInt32();
				this.faces[ i ].elemCount = reader.ReadInt32();
				this.faces[ i ].lmTexture = reader.ReadInt32();

				this.faces[ i ].lmOffset = new int[]
				                           {
				                           	reader.ReadInt32(), reader.ReadInt32()
				                           };
				this.faces[ i ].lmSize = new int[]
				                         {
				                         	reader.ReadInt32(), reader.ReadInt32()
				                         };
				this.faces[ i ].org = new float[]
				                      {
				                      	reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
				                      };

				this.faces[ i ].bbox = new float[6];

				for ( int j = 0; j < this.faces[ i ].bbox.Length; j++ )
				{
					this.faces[ i ].bbox[ j ] = reader.ReadSingle();
				}

				this.faces[ i ].normal = new float[]
				                         {
				                         	reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
				                         };
				this.faces[ i ].meshCtrl = new int[]
				                           {
				                           	reader.ReadInt32(), reader.ReadInt32()
				                           };

				TransformBoundingBox( this.faces[ i ].bbox );
				TransformVector( this.faces[ i ].org );
				TransformVector( this.faces[ i ].normal, true );
			}
		}
예제 #24
0
		private void ReadBrushes( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.brushes.Length; i++ )
			{
				this.brushes[ i ] = new InternalBspBrush();
				this.brushes[ i ].firstSide = reader.ReadInt32();
				this.brushes[ i ].numSides = reader.ReadInt32();
				this.brushes[ i ].shaderIndex = reader.ReadInt32();
			}
		}
예제 #25
0
		private void ReadVertices( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.vertices.Length; i++ )
			{
				this.vertices[ i ] = new InternalBspVertex();
				this.vertices[ i ].point = new float[]
				                           {
				                           	reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
				                           };
				this.vertices[ i ].texture = new float[]
				                             {
				                             	reader.ReadSingle(), reader.ReadSingle()
				                             };
				this.vertices[ i ].lightMap = new float[]
				                              {
				                              	reader.ReadSingle(), reader.ReadSingle()
				                              };
				this.vertices[ i ].normal = new float[]
				                            {
				                            	reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()
				                            };
				this.vertices[ i ].color = reader.ReadInt32();

				TransformVector( this.vertices[ i ].point );
				TransformVector( this.vertices[ i ].normal, true );
			}
		}
        private void ReadModels(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            models = new InternalBspModel[lump.size / Marshal.SizeOf(typeof(InternalBspModel))];

            for(int i = 0; i < models.Length; i++)
            {
                models[i] = new InternalBspModel();
                models[i].bbox = new float[6];

                for(int j = 0; j < models[i].bbox.Length; j++)
                    models[i].bbox[j] = reader.ReadSingle();

                models[i].faceStart = reader.ReadInt32();
                models[i].faceCount = reader.ReadInt32();
                models[i].brushStart = reader.ReadInt32();
                models[i].brushCount = reader.ReadInt32();

                TransformBoundingBox(models[i].bbox);
            }
        }
        private void ReadNodes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            nodes = new InternalBspNode[lump.size / Marshal.SizeOf(typeof(InternalBspNode))];

            for(int i = 0; i < nodes.Length; i++)
            {
                nodes[i] = new InternalBspNode();
                nodes[i].plane = reader.ReadInt32();
                nodes[i].front = reader.ReadInt32();
                nodes[i].back = reader.ReadInt32();
                nodes[i].bbox = new int[6];

                for(int j = 0; j < nodes[i].bbox.Length; j++)
                    nodes[i].bbox[j] = reader.ReadInt32();

                TransformBoundingBox(nodes[i].bbox);
            }
        }
        private void ReadPlanes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            planes = new InternalBspPlane[lump.size / Marshal.SizeOf(typeof(InternalBspPlane))];

            for(int i = 0; i < planes.Length; i++)
            {
                planes[i] = new InternalBspPlane();
                planes[i].normal = new float[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
                planes[i].distance = reader.ReadSingle();

                TransformPlane(planes[i].normal, ref planes[i].distance);
            }
        }
        private void ReadVertices(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            vertices = new InternalBspVertex[lump.size / Marshal.SizeOf(typeof(InternalBspVertex))];

            for(int i = 0; i < vertices.Length; i++)
            {
                vertices[i] = new InternalBspVertex();
                vertices[i].point = new float[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].texture = new float[] { reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].lightMap = new float[] { reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].normal = new float[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
                vertices[i].color = reader.ReadInt32();

                TransformVector(vertices[i].point);
                TransformVector(vertices[i].normal, true);
            }
        }
예제 #30
0
		private void ReadElements( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < elements.Length; i++ )
				elements[ i ] = reader.ReadInt32();
		}
        private void ReadLeafFaces(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            leafFaces = new int[lump.size / Marshal.SizeOf(typeof(int))];

            for(int i = 0; i < leafFaces.Length; i++)
                leafFaces[i] = reader.ReadInt32();
        }
예제 #32
0
		private void ReadShaders( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );
			this.shaders = new InternalBspShader[lump.size/typeof ( InternalBspShader ).Size()];

			for ( int i = 0; i < this.shaders.Length; i++ )
			{
				char[] name = Encoding.UTF8.GetChars( reader.ReadBytes( 64 ) );

				this.shaders[ i ] = new InternalBspShader();
				this.shaders[ i ].surfaceFlags =
					(SurfaceFlags)Enum.Parse( typeof ( SurfaceFlags ), reader.ReadInt32().ToString(), false );
				this.shaders[ i ].contentFlags =
					(ContentFlags)Enum.Parse( typeof ( ContentFlags ), reader.ReadInt32().ToString(), false );

				foreach ( char c in name )
				{
					if ( c == '\0' )
					{
						break;
					}

					this.shaders[ i ].name += c;
				}
			}
		}
        private void ReadLeaves(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            leaves = new InternalBspLeaf[lump.size / Marshal.SizeOf(typeof(InternalBspLeaf))];

            for(int i = 0; i < leaves.Length; i++)
            {
                leaves[i] = new InternalBspLeaf();
                leaves[i].cluster = reader.ReadInt32();
                leaves[i].area = reader.ReadInt32();

                leaves[i].bbox = new int[6];

                for(int j = 0; j < leaves[i].bbox.Length; j++)
                    leaves[i].bbox[j] = reader.ReadInt32();

                leaves[i].faceStart = reader.ReadInt32();
                leaves[i].faceCount = reader.ReadInt32();
                leaves[i].brushStart = reader.ReadInt32();
                leaves[i].brushCount = reader.ReadInt32();

                TransformBoundingBox(leaves[i].bbox);
            }
        }
예제 #34
0
		private void ReadVisData( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			this.visData = new InternalBspVis();
			this.visData.clusterCount = reader.ReadInt32();
			this.visData.rowSize = reader.ReadInt32();
			this.visData.data = reader.ReadBytes( lump.offset - ( typeof ( int ).Size()*2 ) );
		}
예제 #35
0
		private void ReadEntities( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );
			this.entities = Encoding.UTF8.GetString( reader.ReadBytes( lump.size ), 0, lump.size );
		}
예제 #36
0
		private void ReadLeafBrushes( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );

			for ( int i = 0; i < this.leafBrushes.Length; i++ )
			{
				this.leafBrushes[ i ] = reader.ReadInt32();
			}
		}
예제 #37
0
 private void ReadEntities(InternalBspLump lump, BinaryReader reader)
 {
     reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
     this.entities = Encoding.UTF8.GetString(reader.ReadBytes(lump.size), 0, lump.size);
 }
예제 #38
0
		private void ReadBrushSides( InternalBspLump lump, BinaryReader reader )
		{
			reader.BaseStream.Seek( lump.offset, SeekOrigin.Begin );
			this.brushSides = new InternalBspBrushSide[lump.size/typeof ( InternalBspBrushSide ).Size()];

			for ( int i = 0; i < this.brushSides.Length; i++ )
			{
				this.brushSides[ i ] = new InternalBspBrushSide();
				this.brushSides[ i ].planeNum = reader.ReadInt32();
				this.brushSides[ i ].content = reader.ReadInt32();
			}
		}
        private void ReadBrushes(InternalBspLump lump, BinaryReader reader)
        {
            reader.BaseStream.Seek(lump.offset, SeekOrigin.Begin);
            brushes = new InternalBspBrush[lump.size / Marshal.SizeOf(typeof(InternalBspBrush))];

            for(int i = 0; i < brushes.Length; i++)
            {
                brushes[i] = new InternalBspBrush();
                brushes[i].firstSide = reader.ReadInt32();
                brushes[i].numSides = reader.ReadInt32();
                brushes[i].shaderIndex = reader.ReadInt32();
            }
        }