示例#1
0
            public void Read( BinaryReader R )
            {
                m_rawBlendState = R.ReadString();
                m_rawBlendState = m_rawBlendState != string.Empty ? m_rawBlendState : null;
                m_blendState = (BLEND_STATE) R.ReadInt32();

                ReadListOfStrings( R, m_unknownStates );
            }
示例#2
0
            void ParseBlendState( string _rawBlendState )
            {
                m_blendState = BLEND_STATE.OPAQUE;

                Parser		P = new Parser( _rawBlendState );
                string		sourceOp = P.ReadString();
                string		destOp = P.OK ? P.ReadString() : null;
                string[]	ops = new string[] { sourceOp, destOp };
                foreach ( string op in ops ) {
                    if ( op != null )
                        switch ( op.ToUpper() ) {
                            case "SRC_ALPHA":
                            case "ONE_MINUS_SRC_ALPHA":
                            case "DST_ALPHA":
                            case "ONE_MINUS_DST_ALPHA":
                                m_blendState = BLEND_STATE.ALPHA;
                                break;
                        }
                }
            }
示例#3
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;
                    }
                }
            }