Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    ngon performace

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 252 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 23/08/2007 at 13:11, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.1 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi there!

      I am creating a tree mesh here, that has to contain some five sided polygons in a generator object. I used to use the modeling library to create the polys, but found that this doesn't get me the performance needed to generate big meshes interactively.

      For that reason I turned over to using the ngonBase directly, but that doesn't make me happy right now.

      If I generate the mesh with just triangles and quads (including the five sided ones as a triangle and a quad) the generation of an example model takes me 320ms. As soon as I use the BuildNgon() function, mesh generation times jump up to 1570ms. This is my code:

        
      m_pobj->GetAndBuildNgon(); // necessary?  
      m_pngons = m_pobj->GetNgonBase();  
      if (!m_pngons) return FALSE;  
        
      for ( ... loop over polygons ... )  
      {  
      // add polygon  
      CPolygon *polys = m_pobj->GetPolygonW();  
      polys[m_polygons].a = poly[0];  
      polys[m_polygons].b = poly[1];  
      polys[m_polygons].c = poly[2];  
      polys[m_polygons++].d = poly[4];  
        
      polys[m_polygons].a = poly[4];  
      polys[m_polygons].b = poly[2];  
      polys[m_polygons].c = poly[3];  
      polys[m_polygons++].d = poly[3];  
        
      LONG *edges = (LONG* )GeAlloc(sizeof(LONG)*2);  
      edges[0] = (m_polygons - 2) * 4 + 2;  
      edges[1] = (m_polygons - 1) * 4 + 0;  
      m_pngons->BuildNgon(edges, NULL, 2, 0, m_pobj->GetPolygonR(), m_pobj->GetPointR());  
      GeFree(edges);  
      }  
        
      m_pngons->InitMap();  
      m_pngons->SetFlags(NGON_FLAG_NOVALIDATION);  
      m_pobj->Message(MSG_UPDATE);  
      

      Any ideas?
      Timm

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 31/08/2007 at 03:39, xxxxxxxx wrote:

        You have not passed the outer array so build is having to work this out itself from the passed internal edges. If you pass the outline edges this will be faster. If you want max performance you would be better with either using Create or directly modifying the edge data from GetNgons. Look in the lib_ngon.cpp for code showing how to deal with this edge data.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post