Looking for a replacement for COM (Serialization stuff)..
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Looking for a replacement for COM (Serialization stuff)..

  1. #1
    Join Date
    Dec 2010
    Posts
    638

    Looking for a replacement for COM (Serialization stuff)..

    I need to implement my own save functionality, as COM is proprietary, we don't have
    a chance to have a taste of what the COM functions look,
    I am considering to use XML instead of COM serialization, wonder how to
    replace things like D3DXFileCreate(&file); , CreateSaveObject and AddDataObject all those
    stuff. Any suggestions...


    Code:
    void IGameExporter::WriteXFile(IGameScene * ig, MCHAR const * name)
    {
    	
      animated_.clear();
      
      CComPtr<ID3DXFile> file;
      D3DXFileCreate(&file);
      static char const * xExtensions = XEXTENSIONS_TEMPLATES;
      static char const * xSkinExp = XSKINEXP_TEMPLATES;
      file->RegisterTemplates((void*)D3DRM_XTEMPLATES, D3DRM_XTEMPLATE_BYTES);
      file->RegisterTemplates((void*)xExtensions, strlen(xExtensions));
      file->RegisterTemplates((void*)xSkinExp, strlen(xSkinExp));
      file->RegisterTemplates((void*)kwTemplates, strlen(kwTemplates));
      CComPtr<ID3DXFileSaveObject> save;
      D3DXF_FILEFORMAT fileFormat = exportBinary_ ? D3DXF_FILEFORMAT_BINARY : D3DXF_FILEFORMAT_TEXT;
      if (exportCompressed_) {
        fileFormat |= D3DXF_FILEFORMAT_COMPRESSED;
      }
      //CHECK( file->CreateSaveObject(name, D3DXF_FILESAVE_TOFILE, fileFormat, &save) );
      file->CreateSaveObject(name, D3DXF_FILESAVE_TOWFILE, fileFormat, &save); //need to use D3DXF_FILESAVE_TOWFILE for Unicode! markblosser
      CComPtr<ID3DXFileSaveData> root;
      MCHAR const * slash = wcsrchr(name, '\\');
      if (!slash) slash = wcsrchr(name, '/');
      if (slash) ++slash; else slash = name;
      std::wstring n = convert_wname(slash);
    
     ExportFileData(save.p);
      //::OutputDebugString("kW X-port extracted scene data\n");
    
    //  Sometimes you may wish to keep a single frame at the top. However, 
    //  to preserve compatibility with previous exporters, put each top-level 
    //  frame at the top of the file.
    //  CHECK( save->AddDataObject(TID_D3DRMFrame, n.c_str(), 0, 0, 0, &root) );
      
      int nObjects = ig->GetTopLevelNodeCount();
      std::vector<IGameNode *> animated;
      for (int i = 0; i < nObjects; ++i) {
        IGameNode * n = ig->GetTopLevelNode(i);
        ExportNode(ig, n, save.p, gSelectedNodes.Count() == 0);
      }
    
      //  todo: write animations, if selected
      if (exportAnimation_) {
        ExportAnimations(save.p);
      }
      
    
      //::OutputDebugString("kW X-port saving X file\n");
      //save->Save();
      
      
    }
    Last edited by lucky6969b; December 23rd, 2013 at 12:55 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center