Example #1
0
 static Texture2D()
 {
     byte[] data = new byte[ ( 16 * 16 ) << 2 ];
     int i = 0;
     for ( int x = 0; x < 16; ++x )
     {
         for ( int y = 0; y < 16; ++y )
         {
             bool black = ( ( x / 4 ) % 2 == ( y / 4 ) % 2 );
             byte clr = (byte) ( black ? 0 : 0xff );
             data[ i++ ] = clr;
             data[ i++ ] = 0x00;
             data[ i++ ] = clr;
             data[ i++ ] = 0xff;
         }
     }
     Missing = new Texture2D( 16, 16, data );
 }
        public TextureDictionary( String name, FramedStream stream )
        {
            Name = name;

            Section sec = new Section( stream );
            TextureDictionarySectionData data = sec.Data as TextureDictionarySectionData;

            myDiffuseTextures = new Dictionary<string, Texture2D>();
            myMaskTextures = new Dictionary<string, Texture2D>();

            foreach ( TextureNativeSectionData tex in data.Textures )
            {
                Texture2D t2d = new Texture2D( tex );
                if ( tex.DiffuseName.Length > 0 && !myDiffuseTextures.ContainsKey( tex.DiffuseName ) )
                    myDiffuseTextures.Add( tex.DiffuseName, t2d );
                if ( tex.AlphaName.Length > 0 && !myMaskTextures.ContainsKey( tex.AlphaName ) )
                    myMaskTextures.Add( tex.AlphaName, t2d );
            }
        }