Changeset 489

Show
Ignore:
Timestamp:
12/06/07 16:10:12 (1 year ago)
Author:
phill
Message:

o Fixed data offset issue.
o Fixed texture loading error.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libx42.net/VertexData.h

    r462 r489  
    137137        [::System::Runtime::InteropServices::FieldOffset( 12 )] 
    138138        float NormalFactor; 
    139         [::System::Runtime::InteropServices::FieldOffset( 24 )] 
     139        [::System::Runtime::InteropServices::FieldOffset( 16 )] 
    140140        Math::Vector3   Binormal; 
    141141 
  • trunk/x42view.net/Gui/ModelWindow.Preview.Shaded.cs

    r487 r489  
    102102                        { 
    103103                                string path = GetTextureFileName( baseTextureName ); 
    104                                 if( path == null ) 
    105                                         return; 
    106  
    107                                 try 
    108                                 { 
    109                                         ImageInformation info = new ImageInformation(); 
    110  
    111                                         diffuse = TextureLoader.FromFile( device, path, 0, 0, 0, Usage.None, 
    112                                                 Format.Unknown, Pool.Managed, Filter.Triangle, Filter.Triangle, 0, ref info ); 
    113  
    114                                         switch( info.Format ) 
     104                                if( path != null ) 
     105                                { 
     106                                        try 
    115107                                        { 
    116                                         case Format.A8R8G8B8: 
    117                                         case Format.A8B8G8R8: 
    118                                                 alphaTest = Compare.Greater; 
    119                                                 alphaRef = 127; 
    120                                                 cullMode = Cull.None; 
    121                                                 break; 
     108                                                ImageInformation info = new ImageInformation(); 
     109 
     110                                                diffuse = TextureLoader.FromFile( device, path, 0, 0, 0, Usage.None, 
     111                                                        Format.Unknown, Pool.Managed, Filter.Triangle, Filter.Triangle, 0, ref info ); 
     112 
     113                                                switch( info.Format ) 
     114                                                { 
     115                                                case Format.A8R8G8B8: 
     116                                                case Format.A8B8G8R8: 
     117                                                        alphaTest = Compare.Greater; 
     118                                                        alphaRef = 127; 
     119                                                        cullMode = Cull.None; 
     120                                                        break; 
     121                                                } 
    122122                                        } 
    123                                 } 
    124                                 catch( IOException ) 
    125                                 { 
    126                                         return; 
     123                                       catch( IOException ) 
     124                                       { 
     125                                               return; 
     126                                        } 
    127127                                } 
    128128 
    129129                                string normPath = GetTextureFileName( Path.ChangeExtension( baseTextureName, null ) + "_n.tga" ); 
    130                                 if( normPath == null ) 
    131                                        return; 
    132                                  
    133                                 try 
    134                                 { 
    135                                         normal = TextureLoader.FromFile( device, normPath, 0, 0, 0, Usage.None, 
    136                                                 Format.A8B8G8R8, Pool.Managed, Filter.Triangle, Filter.None, 0 ); 
    137  
    138                                         Helpers.GenerateNormalMapMips( normal ); 
    139                                 } 
    140                                 catch( IOException ) 
    141                                 { 
     130                                if( normPath != null ) 
     131                                { 
     132                                       try 
     133                                       { 
     134                                               normal = TextureLoader.FromFile( device, normPath, 0, 0, 0, Usage.None, 
     135                                                       Format.A8B8G8R8, Pool.Managed, Filter.Triangle, Filter.None, 0 ); 
     136 
     137                                                Helpers.GenerateNormalMapMips( normal ); 
     138                                        } 
     139                                       catch( IOException ) 
     140                                       { 
     141                                       } 
    142142                                } 
    143143                        }