/[Sims3RigEditor]/trunk/gr2lib_cpp/gr2lib_rigeditor_frm.h
ViewVC logotype

Diff of /trunk/gr2lib_cpp/gr2lib_rigeditor_frm.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by william, Sun Aug 1 06:33:06 2010 UTC revision 23 by william, Mon Aug 2 02:24:50 2010 UTC
# Line 1  Line 1 
1  #define SHOW_DEBUG_MENU // if defined, will show the debug menu -> else it will not be shown  #define SHOW_DEBUG_MENU // if defined, will show the debug menu -> else it will not be shown
2    
3    #define granny_pixel_layout_bitshift_size 4
4    
5  #pragma once  #pragma once
6  //#include "gr2lib_core.h"  //#include "gr2lib_core.h"
7  //#include "gr2lib_core_imports.h"  //#include "gr2lib_core_imports.h"
# Line 276  private: Line 279  private:
279    
280          }          }
281  #pragma endregion  #pragma endregion
282    
283  #pragma region MarshalToMananaged  #pragma region MarshalToMananaged
284          //ArtToolInfo^ _ArtToolInfo;          //ArtToolInfo^ _ArtToolInfo;
285          //ExporterInfo^ _ExporterInfo;          //ExporterInfo^ _ExporterInfo;
# Line 297  private: Line 301  private:
301                  ArtToolInfo_ToNative();                  ArtToolInfo_ToNative();
302                  // Exporter Info                  // Exporter Info
303                  ExporterInfo_ToNative();                  ExporterInfo_ToNative();
304                    // Texture List
305                    Textures_ToNative();
306          }          }
307  #pragma endregion  #pragma endregion
308    
# Line 382  private: Line 388  private:
388                                          (gr2lib::core::typedefs::granny_pixel_layout)toolinfo[i]->SubFormat);                                          (gr2lib::core::typedefs::granny_pixel_layout)toolinfo[i]->SubFormat);
389                                  t->Layout = gcnew gr2lib::core::coretypes::implementation::Layout();                                  t->Layout = gcnew gr2lib::core::coretypes::implementation::Layout();
390                                          t->Layout->BytesPerPixel = toolinfo[i]->Layout.BytesPerPixel;                                          t->Layout->BytesPerPixel = toolinfo[i]->Layout.BytesPerPixel;
391                                          for(int j=0;j<4;j++)                                          for(int j=0;j<granny_pixel_layout_bitshift_size;j++)
392                                          {                                          {
393                                                  t->Layout->ShiftForComponent[j] =  toolinfo[i]->Layout.ShiftForComponent[j];                                                  t->Layout->ShiftForComponent[j] =  toolinfo[i]->Layout.ShiftForComponent[j];
394                                                  t->Layout->BitsForComponent[j] =  toolinfo[i]->Layout.BitsForComponent[j];                                                  t->Layout->BitsForComponent[j] =  toolinfo[i]->Layout.BitsForComponent[j];
# Line 479  private: Line 485  private:
485  #pragma region Textures_ToNative  #pragma region Textures_ToNative
486          void Textures_ToNative()          void Textures_ToNative()
487          {          {
488                  if (_grn_file->GrannyFileInfo->Textures == NULL)                  _grn_file->GrannyFileInfo->Textures = (granny_texture**)malloc(GR2LibPropertyWrapper->Textures->Count);
489                    for(int i=0;i<GR2LibPropertyWrapper->Textures->Count;i++) { _grn_file->GrannyFileInfo->Textures[i] = new granny_texture(); }
490    
491                    _grn_file->GrannyFileInfo->TextureCount = GR2LibPropertyWrapper->Textures->Count;
492                    for(int i=0;i<_grn_file->GrannyFileInfo->TextureCount;i++)
493                  {                  {
494                          _grn_file->GrannyFileInfo->Textures = new granny_texture*();                          _grn_file->GrannyFileInfo->Textures[i]->FromFileName = (char*)Marshal::StringToHGlobalAnsi(GR2LibPropertyWrapper->Textures[i]->FromFileName->FullPath).ToPointer();
495                            _grn_file->GrannyFileInfo->Textures[i]->TextureType = (granny_int32)GR2LibPropertyWrapper->Textures[i]->TextureType->Value;
496                            _grn_file->GrannyFileInfo->Textures[i]->Width = GR2LibPropertyWrapper->Textures[i]->Width;
497                            _grn_file->GrannyFileInfo->Textures[i]->Height = GR2LibPropertyWrapper->Textures[i]->Height;
498                            _grn_file->GrannyFileInfo->Textures[i]->Encoding = (granny_int32)GR2LibPropertyWrapper->Textures[i]->Encoding->Value;
499                            _grn_file->GrannyFileInfo->Textures[i]->SubFormat = (granny_int32)GR2LibPropertyWrapper->Textures[i]->SubFormat->Value;
500                            _grn_file->GrannyFileInfo->Textures[i]->Layout.BytesPerPixel =  (granny_int32)GR2LibPropertyWrapper->Textures[i]->Layout->BytesPerPixel;
501                            for(int j=0;j<granny_pixel_layout_bitshift_size;j++)
502                            {
503                                    _grn_file->GrannyFileInfo->Textures[i]->Layout.ShiftForComponent[j] = GR2LibPropertyWrapper->Textures[i]->Layout->ShiftForComponent[j];
504                                    _grn_file->GrannyFileInfo->Textures[i]->Layout.BitsForComponent[j] = GR2LibPropertyWrapper->Textures[i]->Layout->BitsForComponent[j];
505                            }
506    
507                            _grn_file->GrannyFileInfo->Textures[i]->ImageCount = GR2LibPropertyWrapper->Textures[i]->Images->Count;
508                            _grn_file->GrannyFileInfo->Textures[i]->Images = (granny_texture_image*)malloc(_grn_file->GrannyFileInfo->Textures[i]->ImageCount);
509                            for(int k=0;k<_grn_file->GrannyFileInfo->Textures[i]->ImageCount;k++) { _grn_file->GrannyFileInfo->Textures[i]->Images[k] = *(new granny_texture_image()); }
510    
511                            for(int j=0;j<_grn_file->GrannyFileInfo->Textures[i]->ImageCount;j++)
512                            {
513                                    _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevelCount = GR2LibPropertyWrapper->Textures[i]->Images[j]->MIPLevels->Count;
514                                    _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels = (granny_texture_mip_level*)malloc(_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevelCount);
515                                    for(int k=0;k<_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevelCount;k++) { _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k] = *(new granny_texture_mip_level()); }
516                                    for(int k=0;k<_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevelCount;k++)
517                                    {
518                                            _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].Stride =  GR2LibPropertyWrapper->Textures[i]->Images[j]->MIPLevels[k]->Stride;
519                                            _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount = GR2LibPropertyWrapper->Textures[i]->Images[j]->MIPLevels[k]->Pixels->Count;
520                                            _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelBytes = (unsigned char*)malloc(_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount);
521                                            /*for (int l=0;l<_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount;l++)
522                                            {
523                                                    _grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelBytes[l] = 0;
524                                            }*/
525                                            array<unsigned char>^ pix_bytes = gcnew array<unsigned char>(_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount);
526                                            for (int l=0;l<_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount;l++)
527                                            {
528                                                    pix_bytes[l] = GR2LibPropertyWrapper->Textures[i]->Images[j]->MIPLevels[k]->Pixels[l]->UInt8;
529                                            }
530    
531                                            IntPtr PixelBytesPTR = *(new IntPtr(_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelBytes));
532                                            Marshal::Copy(pix_bytes,0,PixelBytesPTR,_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount);
533                                    }
534                            }
535                            _grn_file->GrannyFileInfo->Textures[i]->ExtendedData = *(new granny_variant());
536                  }                  }
537                  //_grn_file->GrannyFileInfo->ExporterInfo->ExporterName = (char*)Marshal::StringToHGlobalAnsi(GR2LibPropertyWrapper->ExporterInfo->ExporterName).ToPointer();  
                 //_grn_file->GrannyFileInfo->ExporterInfo->ExporterMajorRevision = GR2LibPropertyWrapper->ExporterInfo->Version->major;  
                 //_grn_file->GrannyFileInfo->ExporterInfo->ExporterMinorRevision = GR2LibPropertyWrapper->ExporterInfo->Version->minor;  
                 //_grn_file->GrannyFileInfo->ExporterInfo->ExporterCustomization = GR2LibPropertyWrapper->ExporterInfo->Version->customization;  
                 //_grn_file->GrannyFileInfo->ExporterInfo->ExporterBuildNumber = GR2LibPropertyWrapper->ExporterInfo->Version->build;  
                 ////_grn_file->GrannyFileInfo->ExporterInfo->ExtendedData  
538          }          }
539  #pragma endregion  #pragma endregion
540  #pragma endregion  #pragma endregion

Legend:
Removed from v.22  
changed lines
  Added in v.23

  ViewVC Help
Powered by ViewVC 1.1.22