BRDFLafortuneFitting.Program.SaveAllSlices C# (CSharp) Method

SaveAllSlices() protected static method

protected static SaveAllSlices ( ) : void
return void
        protected static void SaveAllSlices()
        {
            FileInfo[]		SourceBRDFFileNames = new DirectoryInfo( @"D:\Docs\Computer Graphics\Rendering, Radiosity, Photon Maps\BRDFs & Reflection Models\MERL\MERL Database of BRDF\people.csail.mit.edu\wojciech\BRDFDatabase\brdfs" ).GetFiles( "*.binary" );
            DirectoryInfo	TargetDir = new DirectoryInfo( @"D:\Docs\Computer Graphics\Rendering, Radiosity, Photon Maps\BRDFs & Reflection Models\MERL\MERL Database of BRDF\people.csail.mit.edu\wojciech\BRDFDatabase\brdfs\slices" );
            foreach ( FileInfo SourceBRDFFileName in SourceBRDFFileNames )
            {
                double[][]	BRDF = LoadBRDF( SourceBRDFFileName );

                string		BRDFFileWithoutExtension = Path.GetFileNameWithoutExtension( SourceBRDFFileName.FullName );
                FileInfo	TargetFile = new FileInfo( Path.Combine( TargetDir.FullName, BRDFFileWithoutExtension+".slice" ) );

                using ( FileStream S = TargetFile.Create() )
                    using ( BinaryWriter W = new BinaryWriter( S ) )
                    {
                        int	StrideThetaD = BRDF_SAMPLING_RES_PHI_D / 2;
                        int	StrideThetaH = BRDF_SAMPLING_RES_THETA_D*BRDF_SAMPLING_RES_PHI_D / 2;
                        int	PhiDiffIndex = 90;
                        for ( int Y=0; Y < 90; Y++ )
                        {
                            int	ThetaDIndex = Y;
                            for ( int X=0; X < 90; X++ )
                            {
                                int	ThetaHIndex = X;

                                int TableIndex = PhiDiffIndex;
                                    TableIndex += StrideThetaD * ThetaDIndex;
                                    TableIndex += StrideThetaH * ThetaHIndex;

                                W.Write( (float) BRDF[0][TableIndex] );
                                W.Write( (float) BRDF[1][TableIndex] );
                                W.Write( (float) BRDF[2][TableIndex] );
                            }
                        }
                    }
            }
        }