ReadToEOL() public method

public ReadToEOL ( ) : string
return string
Ejemplo n.º 1
0
        private void Parse( string _block )
        {
            m_states.m_unknownStates.Clear();
            m_parms.m_unknownParms.Clear();
            m_options.m_unknownOptions.Clear();
            m_unknownVariables.Clear();
            m_forbiddenParms.Clear();

            m_isUsingVegetationParms = false;
            m_isUsingCloudParms = false;
            m_isUsingWaterParms = false;

            Parser	P = new Parser( _block );
            while ( P.OK ) {
                string	token = P.ReadString();
                if ( token == null )
                    break;	// Done!
                if ( token.StartsWith( "//" ) ) {
                    RecordSingleLineCommentVariable( token, P );
                    continue;
                }
                if ( token.StartsWith( "/*" ) ) {
                    RecordCommentVariable( token, P );
                    continue;
                }

                if ( token.EndsWith( "{" ) ) {
                    // Handle problematic parms without space before their values
                    token = token.Substring( 0, token.Length-1 );
                    P.m_Index--;
                }

                P.SkipSpaces();

                switch ( token.ToLower() ) {
                    case "version":
                        P.SkipSpaces();
                        m_version = P.ReadInteger();
                        break;

                    case "state":
                        m_states.Parse( P.ReadBlock() );
                        break;

                    case "parms":
                        m_parms.Parse( P.ReadBlock() );
                        break;

                    case "options":
                        ParseOptions( P.ReadBlock() );
                        break;

                    // Programs
                    case "mainprogram":			m_programs.SetMainProgram( P.ReadString() ); break;
                    case "zprepassprogram":		m_programs.m_ZPrepass = P.ReadString(); break;
                    case "shadowprogram":		m_programs.m_shadow = P.ReadString(); break;

                    // Textures
                        // Layer 0
                    case "diffusemap":			Layer0.m_diffuse = new Layer.Texture( P.ReadToEOL() ); break;
                    case "bumpmap":				Layer0.m_normal = new Layer.Texture( P.ReadToEOL() ); break;
                    case "glossmap":			Layer0.m_gloss = new Layer.Texture( P.ReadToEOL() ); break;
                    case "metallicmap":			Layer0.m_metal = new Layer.Texture( P.ReadToEOL() ); break;
                    case "specularmap":			Layer0.m_specular = new Layer.Texture( P.ReadToEOL() ); break;
                    case "heightmap":			m_height = new Layer.Texture( P.ReadToEOL() ); break;
                    case "lightmap":			m_lightMap = new Layer.Texture( P.ReadToEOL() ); break;
                    case "occlusionmap":		Layer0.m_AO = new Layer.Texture( P.ReadToEOL() ); break;
                    case "translucencymap":		Layer0.m_translucency = new Layer.Texture( P.ReadToEOL() ); break;
                    case "emissivemap":			Layer0.m_emissive = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer0_maskmap":		Layer0.m_mask = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer0_scalebias":	Layer0.ParseScaleBias( P ); break;
                    case "layer0_maskscalebias":Layer0.ParseMaskScaleBias( P ); break;
                    case "layer0_colorconstant":Layer0.m_colorConstant = P.ReadFloat4(); break;

                        // Layer 1
                    case "layer1_diffusemap":	Layer1.m_diffuse = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_bumpmap":		Layer1.m_normal = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_glossmap":		Layer1.m_gloss = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_specularmap":	Layer1.m_specular = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_metallicmap":	Layer1.m_metal = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_maskmap":		Layer1.m_mask = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_emissivemap":	throw new Exception( "Shouldn't be allowed!" );//P.SkipSpaces(); Layer1.m_emissive = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer1_scalebias":	Layer1.ParseScaleBias( P ); break;
                    case "layer1_maskscalebias":Layer1.ParseMaskScaleBias( P ); break;
                    case "layer1_colorconstant":Layer1.m_colorConstant = P.ReadFloat4(); break;

                        // Layer 2
                    case "layer2_diffusemap":	Layer2.m_diffuse = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_bumpmap":		Layer2.m_normal = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_glossmap":		Layer2.m_gloss = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_specularmap":	Layer2.m_specular = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_metallicmap":	Layer2.m_metal = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_emissivemap":	throw new Exception( "Shouldn't be allowed!" );//P.SkipSpaces(); Layer2.m_emissive = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_maskmap":		Layer2.m_mask = new Layer.Texture( P.ReadToEOL() ); break;
                    case "layer2_scalebias":	Layer2.ParseScaleBias( P ); break;
                    case "layer2_maskscalebias":Layer2.ParseMaskScaleBias( P ); break;
                    case "layer2_colorconstant":Layer2.m_colorConstant = P.ReadFloat4(); break;

                    // Main variables
                    case "m_physicsmaterial":
                        m_physicsMaterial = P.ReadToEOL();
                        break;

                    case "wardroughness":
                        float4	roughness = P.ReadFloat4();
                        m_glossMinMax.x = roughness.x;
                        m_glossMinMax.y = roughness.y;
                        break;
                    case "metallicminmax":
                        float4	metal = P.ReadFloat4();
                        m_metallicMinMax.x = metal.x;
                        m_metallicMinMax.y = metal.y;
                        break;

                    default:
                        if ( CheckSafeTokens( token ) )
                            RecordUnknownVariable( token, P );
                        else
                            RecordForbiddenVariable( token, P );
                        break;
                }
            }
        }
Ejemplo n.º 2
0
            public void Parse( string _parms )
            {
                m_rawBlendState = null;
                m_blendState = BLEND_STATE.OPAQUE;

                Parser	P = new Parser( _parms );
                while ( P.OK ) {
                    string	token = P.ReadString();
                    if ( token == null )
                        break;	// Done!
                    if ( token.StartsWith( "//" ) ) {
                        RecordSingleLineCommentVariable( m_unknownStates, token, P );
                        continue;
                    }
                    if ( token.StartsWith( "/*" ) ) {
                        RecordCommentVariable( m_unknownStates, token, P );
                        continue;
                    }

                    if ( token.EndsWith( "{" ) ) {
                        // Handle problematic parms without space before their values
                        token = token.Substring( 0, token.Length-1 );
                        P.m_Index--;
                    }

                    P.SkipSpaces();

                    switch ( token.ToLower() ) {
                        case "blend": {
                            P.SkipSpaces();
                            m_rawBlendState = P.ReadToEOL();
                            ParseBlendState( m_rawBlendState );
                            break;
                        }
                        default:
                            m_unknownStates.Add( token + "	" + P.ReadToEOL() );
                            break;
                    }
                }
            }
Ejemplo n.º 3
0
 static void RecordSingleLineCommentVariable( List< string > _variables, string _token, Parser P )
 {
     string	record = _token + P.ReadToEOL();
     _variables.Add( record );
 }
Ejemplo n.º 4
0
            public void Parse( string _parms )
            {
                m_sortStage = SORT_STAGE.UNKNOWN;

                Parser	P = new Parser( _parms );
                while ( P.OK ) {
                    string	token = P.ReadString();
                    if ( token == null )
                        break;	// Done!
                    if ( token.StartsWith( "//" ) ) {
                        RecordSingleLineCommentVariable( m_unknownParms, token, P );
                        continue;
                    }
                    if ( token.StartsWith( "/*" ) ) {
                        RecordCommentVariable( m_unknownParms, token, P );
                        continue;
                    }

                    if ( token.EndsWith( "{" ) ) {
                        // Handle problematic parms without space before their values
                        token = token.Substring( 0, token.Length-1 );
                        P.m_Index--;
                    }

                    P.SkipSpaces();

                    switch ( token.ToLower() ) {
                        case "stagesort": {
                            string	sortStageName = P.ReadString();
                            switch ( sortStageName.ToLower() ) {
                                case "sortcoverage":	m_sortStage = SORT_STAGE.sortCoverage; break;
                                case "sortboatvolume":	m_sortStage = SORT_STAGE.sortBoatVolume; break;
                                case "sortemit":		m_sortStage = SORT_STAGE.sortEmit; break;
                                case "sortemitonly":	m_sortStage = SORT_STAGE.sortEmitOnly; break;
                                case "sortshadowwalk":	m_sortStage = SORT_STAGE.sortShadowWalk; break;
                                case "sortwater":		m_sortStage = SORT_STAGE.sortWater; break;
                                case "sortdecal":		m_sortStage = SORT_STAGE.sortDecal; break;
                                case "sorttranssort":	m_sortStage = SORT_STAGE.sortTransSort; break;
                                case "sorttrans":		m_sortStage = SORT_STAGE.sortTrans; break;
                                case "sortdarkvision":	m_sortStage = SORT_STAGE.sortDarkVision; break;
                                case "sorthud":			m_sortStage = SORT_STAGE.sortHud; break;
                                case "sortperturber":	m_sortStage = SORT_STAGE.sortPerturber; break;
                                case "sortautomap":		m_sortStage = SORT_STAGE.sortAutomap; break;
                                case "sortposttonemap":	m_sortStage = SORT_STAGE.sortPostTonemap; break;
                                default: throw new Exception( "Unhandled sort stage!" );
                            }
                            break;
                        }
                        default:
                            m_unknownParms.Add( token + "	" + P.ReadToEOL() );
                            break;
                    }
                }
            }
Ejemplo n.º 5
0
 void RecordUnknownVariable( string _token, Parser P )
 {
     string	record = _token + "\t" + P.ReadToEOL();
     m_unknownVariables.Add( record );
 }
Ejemplo n.º 6
0
 void RecordUnknownOption( string _token, int value, Parser P )
 {
     string	record = _token + "\t" + value + P.ReadToEOL();
     m_options.m_unknownOptions.Add( record );
 }
Ejemplo n.º 7
0
 void RecordSingleLineCommentOption( string _token, Parser P )
 {
     string	record = _token + P.ReadToEOL();
     m_options.m_unknownOptions.Add( record );
 }
Ejemplo n.º 8
0
 void RecordForbiddenVariable( string _token, Parser P )
 {
     string	record = _token + "\t" + P.ReadToEOL();
     m_forbiddenParms.Add( record );
 }