Changeset 444 for cafu/trunk

Show
Ignore:
Timestamp:
12/17/11 22:02:59 (5 months ago)
Author:
Carsten
Message:

Fixed bugs aplenty:

  • Libs: When CollisionModelStaticTs were created from degenerate mesh input as it can occur with certain forms of Bezier patches, it sometimes caused the well-formed triangles to be disregarded as well.
  • CaWE: When the command history cuts the command queue due to memory constraints, it now keeps the ID of the latest deleted command that suggested saving the map file, not the one that is shown to the user.
  • CaWE: Renamed MapBezierPatchT::CreateConvexEndcap() to MapBezierPatchT::CreateQuarterDisc() and much simplified its code.
  • CaWE: Using the Morph tool does no longer cause a crash when Undo or Redo is used.
  • Other minor tweaks.
Location:
cafu/trunk
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/CaWE/CommandHistory.cpp

    r443 r444  
    3636        public: 
    3737 
    38         RecursionCheckerT(bool& IsActive) : m_IsActive(IsActive) { wxASSERT(!m_IsActive); m_IsActive=true; } 
    39         ~RecursionCheckerT() { m_IsActive=false; } 
     38        RecursionCheckerT(bool& IsRecCall) : m_IsRecCall(IsRecCall) { wxASSERT(!m_IsRecCall); m_IsRecCall=true; } 
     39        ~RecursionCheckerT() { m_IsRecCall=false; } 
    4040 
    4141 
    4242        private: 
    4343 
    44         bool& m_IsActive; 
     44        bool& m_IsRecCall; 
    4545    }; 
    4646} 
     
    4949CommandHistoryT::CommandHistoryT() 
    5050    : m_CurrentIndex(-1), 
    51       m_Debug_IsActive(false), 
     51      m_IsRecursiveCall(false), 
    5252      m_InvalidCommandID(0) 
    5353{ 
     
    9999    if (m_CurrentIndex<0) return; 
    100100    wxASSERT(m_CurrentIndex<(int)m_Commands.Size()); 
    101     RecursionCheckerT RecCheck(m_Debug_IsActive); 
     101    RecursionCheckerT RecCheck(m_IsRecursiveCall); 
    102102 
    103103    // Undo all commands from the invisible commands list and delete them. 
     
    131131    if (m_CurrentIndex+1>=int(m_Commands.Size())) return; 
    132132    wxASSERT(m_CurrentIndex<(int)m_Commands.Size()-1); 
    133     RecursionCheckerT RecCheck(m_Debug_IsActive); 
     133    RecursionCheckerT RecCheck(m_IsRecursiveCall); 
    134134 
    135135    // Undo all commands from the invisible commands list and delete them. 
     
    161161bool CommandHistoryT::SubmitCommand(CommandT* Command) 
    162162{ 
    163     RecursionCheckerT RecCheck(m_Debug_IsActive); 
     163    RecursionCheckerT RecCheck(m_IsRecursiveCall); 
    164164 
    165165    if (!Command->IsDone() && !Command->Do()) 
     
    172172    while (int(m_Commands.Size())>Options.general.UndoLevels) 
    173173    { 
    174         if (m_Commands[0]->ShowInHistory()) m_InvalidCommandID=m_Commands[0]->GetID(); 
     174        if (m_Commands[0]->SuggestsSave()) m_InvalidCommandID=m_Commands[0]->GetID(); 
    175175 
    176176        delete m_Commands[0]; 
  • cafu/trunk/CaWE/CommandHistory.hpp

    r443 r444  
    4949    ArrayT<CommandT*> m_InvisCommands;    ///< Stores all commands not visible in the history until a visible command is added to the history (then they are moved into the normal history). 
    5050    int               m_CurrentIndex;     ///< The index of the last done command: all commands in <code>m_Commands[0 ... m_CurrentIndex]</code> are "done" (available for undo), any commands following them are "undone" (available for redo). If m_CurrentIndex is -1, there are no "done" commands at all. 
    51     bool              m_Debug_IsActive;   ///< In order to facilitate debugging, this member helps with detecting recursive calls to our functions. For example, when we call a commands CommandT::Undo() method, does it erroneously cause a recursive call back to SubmitCommand()? 
     51    bool              m_IsRecursiveCall;  ///< In order to facilitate debugging, this member helps with detecting recursive calls to our functions. For example, when we call a commands CommandT::Undo() method, does it erroneously cause a "recursive" call back to SubmitCommand()? 
    5252 
    5353    /// The command id returned when there is no current command (when the current index is -1). 
  • cafu/trunk/CaWE/MapBezierPatch.cpp

    r285 r444  
    492492 
    493493 
    494 MapBezierPatchT* MapBezierPatchT::CreateConvexEndcap(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_, int SubdivsVert_, EndCapPosE pos) 
     494MapBezierPatchT* MapBezierPatchT::CreateQuarterDisc(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_, int SubdivsVert_, EndCapPosE pos, bool Inverted) 
    495495{ 
    496496    MapBezierPatchT* BP=new MapBezierPatchT(Material_, LMM_, SubdivsHorz_, SubdivsVert_); 
     
    498498    BP->SetSize(3, 3); 
    499499 
    500     Vector3fT source;              // Source point (where most of the vertices are moved to, to build an endcap). 
    501     wxPoint   sourceVertices[6];   // Array of the control vertices that are moved to the sourcepoint. 
    502     wxPoint   outlineVertices[3];  // Array of remaining control vertices, that build up the outline of the endcap. 
    503     Vector3fT outlinePositions[3]; // Array of the positions for the outline vertices. 
    504  
    505     // Initialize source points z-coordinate since its the same for all endcaps. 
    506     source.z=max.z; 
    507  
    508     // Initialize outline points z-coordinate since its the same for all endcaps and outline points. 
    509     for (int i=0; i<3; i++) 
    510     { 
    511         outlinePositions[i].z=max.z; 
    512     } 
    513  
    514     // Choose source point and fill arrays, depending on endcap position parameter. 
    515500    switch (pos) 
    516501    { 
    517502        case TOP_RIGHT: 
    518             source.x=min.x; source.y=min.y; 
    519  
    520             sourceVertices[0]=wxPoint(0,2); 
    521             sourceVertices[1]=wxPoint(1,2); 
    522             sourceVertices[2]=wxPoint(2,2); 
    523             sourceVertices[3]=wxPoint(0,1); 
    524             sourceVertices[4]=wxPoint(1,1); 
    525             sourceVertices[5]=wxPoint(2,1); 
    526  
    527             outlineVertices[0]=wxPoint(0,0); 
    528             outlineVertices[1]=wxPoint(1,0); 
    529             outlineVertices[2]=wxPoint(2,0); 
    530  
    531             outlinePositions[0].x=min.x; outlinePositions[0].y=max.y; 
    532             outlinePositions[1].x=max.x; outlinePositions[1].y=max.y; 
    533             outlinePositions[2].x=max.x; outlinePositions[2].y=min.y; 
    534  
     503        { 
     504            const Vector3fT Center=Vector3fT(min.x, min.y, max.z); 
     505 
     506            BP->SetCvPos(2 /*0*/, 2,                     Vector3fT(min.x, max.y, max.z)); 
     507            BP->SetCvPos(1 /*1*/, 2, Inverted ? Center : Vector3fT(max.x, max.y, max.z)); 
     508            BP->SetCvPos(0 /*2*/, 2,                     Vector3fT(max.x, min.y, max.z)); 
     509 
     510            BP->SetCvPos(0, 1, Center); 
     511            BP->SetCvPos(1, 1, Center); 
     512            BP->SetCvPos(2, 1, Center); 
     513 
     514            BP->SetCvPos(0, 0, Center); 
     515            BP->SetCvPos(1, 0, Center); 
     516            BP->SetCvPos(2, 0, Center); 
    535517            break; 
     518        } 
    536519 
    537520        case TOP_LEFT: 
    538             source.x=max.x; source.y=min.y; 
    539  
    540             sourceVertices[0]=wxPoint(1,0); 
    541             sourceVertices[1]=wxPoint(1,1); 
    542             sourceVertices[2]=wxPoint(1,2); 
    543             sourceVertices[3]=wxPoint(2,0); 
    544             sourceVertices[4]=wxPoint(2,1); 
    545             sourceVertices[5]=wxPoint(2,2); 
    546  
    547             outlineVertices[0]=wxPoint(0,0); 
    548             outlineVertices[1]=wxPoint(0,1); 
    549             outlineVertices[2]=wxPoint(0,2); 
    550  
    551             outlinePositions[0].x=max.x; outlinePositions[0].y=max.y; 
    552             outlinePositions[1].x=min.x; outlinePositions[1].y=max.y; 
    553             outlinePositions[2].x=min.x; outlinePositions[2].y=min.y; 
    554  
     521        { 
     522            const Vector3fT Center=Vector3fT(max.x, min.y, max.z); 
     523 
     524            BP->SetCvPos(2 /*0*/, 2,                     Vector3fT(min.x, min.y, max.z)); 
     525            BP->SetCvPos(1 /*1*/, 2, Inverted ? Center : Vector3fT(min.x, max.y, max.z)); 
     526            BP->SetCvPos(0 /*2*/, 2,                     Vector3fT(max.x, max.y, max.z)); 
     527 
     528            BP->SetCvPos(0, 1, Center); 
     529            BP->SetCvPos(1, 1, Center); 
     530            BP->SetCvPos(2, 1, Center); 
     531 
     532            BP->SetCvPos(0, 0, Center); 
     533            BP->SetCvPos(1, 0, Center); 
     534            BP->SetCvPos(2, 0, Center); 
    555535            break; 
     536        } 
    556537 
    557538        case BOTTOM_RIGHT: 
    558             source.x=min.x; source.y=max.y; 
    559  
    560             sourceVertices[0]=wxPoint(0,0); 
    561             sourceVertices[1]=wxPoint(0,1); 
    562             sourceVertices[2]=wxPoint(0,2); 
    563             sourceVertices[3]=wxPoint(1,0); 
    564             sourceVertices[4]=wxPoint(1,1); 
    565             sourceVertices[5]=wxPoint(1,2); 
    566  
    567             outlineVertices[0]=wxPoint(2,0); 
    568             outlineVertices[1]=wxPoint(2,1); 
    569             outlineVertices[2]=wxPoint(2,2); 
    570  
    571             outlinePositions[0].x=max.x; outlinePositions[0].y=max.y; 
    572             outlinePositions[1].x=max.x; outlinePositions[1].y=min.y; 
    573             outlinePositions[2].x=min.x; outlinePositions[2].y=min.y; 
    574  
     539        { 
     540            const Vector3fT Center=Vector3fT(min.x, max.y, max.z); 
     541 
     542            BP->SetCvPos(0, 2, Center); 
     543            BP->SetCvPos(1, 2, Center); 
     544            BP->SetCvPos(2, 2, Center); 
     545 
     546            BP->SetCvPos(0, 1, Center); 
     547            BP->SetCvPos(1, 1, Center); 
     548            BP->SetCvPos(2, 1, Center); 
     549 
     550            BP->SetCvPos(2 /*0*/, 0,                     Vector3fT(min.x, min.y, max.z)); 
     551            BP->SetCvPos(1 /*1*/, 0, Inverted ? Center : Vector3fT(max.x, min.y, max.z)); 
     552            BP->SetCvPos(0 /*2*/, 0,                     Vector3fT(max.x, max.y, max.z)); 
    575553            break; 
    576  
    577         default:    // Also handles case BOTTOM_LEFT. 
    578             source.x=max.x; source.y=max.y; 
    579  
    580             sourceVertices[0]=wxPoint(0,0); 
    581             sourceVertices[1]=wxPoint(1,0); 
    582             sourceVertices[2]=wxPoint(2,0); 
    583             sourceVertices[3]=wxPoint(0,1); 
    584             sourceVertices[4]=wxPoint(1,1); 
    585             sourceVertices[5]=wxPoint(2,1); 
    586  
    587             outlineVertices[0]=wxPoint(0,2); 
    588             outlineVertices[1]=wxPoint(1,2); 
    589             outlineVertices[2]=wxPoint(2,2); 
    590  
    591             outlinePositions[0].x=min.x; outlinePositions[0].y=max.y; 
    592             outlinePositions[1].x=min.x; outlinePositions[1].y=min.y; 
    593             outlinePositions[2].x=max.x; outlinePositions[2].y=min.y; 
    594  
     554        } 
     555 
     556        case BOTTOM_LEFT: 
     557        { 
     558            const Vector3fT Center=Vector3fT(max.x, max.y, max.z); 
     559 
     560            BP->SetCvPos(0, 2, Center); 
     561            BP->SetCvPos(1, 2, Center); 
     562            BP->SetCvPos(2, 2, Center); 
     563 
     564            BP->SetCvPos(0, 1, Center); 
     565            BP->SetCvPos(1, 1, Center); 
     566            BP->SetCvPos(2, 1, Center); 
     567 
     568            BP->SetCvPos(2 /*0*/, 0,                     Vector3fT(min.x, max.y, max.z)); 
     569            BP->SetCvPos(1 /*1*/, 0, Inverted ? Center : Vector3fT(min.x, min.y, max.z)); 
     570            BP->SetCvPos(0 /*2*/, 0,                     Vector3fT(max.x, min.y, max.z)); 
    595571            break; 
    596     } 
    597  
    598  
    599     // Set source control vertices to source position. 
    600     for (int i=0; i<6; i++) 
    601     { 
    602         BP->SetCvPos(sourceVertices[i].x, sourceVertices[i].y, source); 
    603     } 
    604  
    605     // Set outline control vertices to their positions. 
    606     for (int i=0; i<3; i++) 
    607     { 
    608         BP->SetCvPos(outlineVertices[i].x, outlineVertices[i].y, outlinePositions[i]); 
     572        } 
    609573    } 
    610574 
     
    618582MapBezierPatchT* MapBezierPatchT::CreateConcaveEndcap(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_, int SubdivsVert_, EndCapPosE pos) 
    619583{ 
    620     MapBezierPatchT* BP=new MapBezierPatchT(Material_, LMM_, SubdivsHorz_, SubdivsVert_); 
    621  
    622     BP->SetSize(3, 3); 
    623  
    624     Vector3fT source;              // Source point (where most of the vertices are moved to, to build an endcap). 
    625     wxPoint   sourceVertices[7];   // Array of the control vertices that are moved to the sourcepoint. 
    626     wxPoint   outlineVertices[2];  // Array of remaining control vertices, that build up the outline of the endcap. 
    627     Vector3fT outlinePositions[2]; // Array of the positions for the outline vertices. 
    628  
    629     // Initialize source points z-coordinate since its the same for all endcaps. 
    630     source.z=max.z; 
    631  
    632     // Initialize outline points z-coordinate since its the same for all endcaps and outline points. 
    633     for (int i=0; i<2; i++) 
    634     { 
    635         outlinePositions[i].z=max.z; 
    636     } 
    637  
    638     // Choose source point and fill arrays, depending on endcap position parameter. 
     584    // TODO: This method should be removed entirely. 
     585    // Instead, the user code should call CreateQuarterDisc() with Inverted=true. 
    639586    switch (pos) 
    640587    { 
    641         case TOP_RIGHT: 
    642             source.x=max.x; source.y=max.y; 
    643  
    644             sourceVertices[0]=wxPoint(0,0); 
    645             sourceVertices[1]=wxPoint(1,0); 
    646             sourceVertices[2]=wxPoint(2,0); 
    647             sourceVertices[3]=wxPoint(0,1); 
    648             sourceVertices[4]=wxPoint(1,1); 
    649             sourceVertices[5]=wxPoint(2,1); 
    650             sourceVertices[6]=wxPoint(1,2); 
    651  
    652             outlineVertices[0]=wxPoint(0,2); 
    653             outlineVertices[1]=wxPoint(2,2); 
    654  
    655             outlinePositions[0].x=min.x; outlinePositions[0].y=max.y; 
    656             outlinePositions[1].x=max.x; outlinePositions[1].y=min.y; 
    657  
    658             break; 
    659  
    660         case TOP_LEFT: 
    661             source.x=min.x; source.y=max.y; 
    662  
    663             sourceVertices[0]=wxPoint(0,0); 
    664             sourceVertices[1]=wxPoint(1,0); 
    665             sourceVertices[2]=wxPoint(2,0); 
    666             sourceVertices[3]=wxPoint(0,1); 
    667             sourceVertices[4]=wxPoint(1,1); 
    668             sourceVertices[5]=wxPoint(2,1); 
    669             sourceVertices[6]=wxPoint(1,2); 
    670  
    671             outlineVertices[0]=wxPoint(0,2); 
    672             outlineVertices[1]=wxPoint(2,2); 
    673  
    674             outlinePositions[0].x=min.x; outlinePositions[0].y=min.y; 
    675             outlinePositions[1].x=max.x; outlinePositions[1].y=max.y; 
    676  
    677             break; 
    678  
    679         case BOTTOM_RIGHT: 
    680             source.x=max.x; source.y=min.y; 
    681  
    682             sourceVertices[0]=wxPoint(1,0); 
    683             sourceVertices[1]=wxPoint(0,1); 
    684             sourceVertices[2]=wxPoint(1,1); 
    685             sourceVertices[3]=wxPoint(2,1); 
    686             sourceVertices[4]=wxPoint(0,2); 
    687             sourceVertices[5]=wxPoint(1,2); 
    688             sourceVertices[6]=wxPoint(2,2); 
    689  
    690             outlineVertices[0]=wxPoint(0,0); 
    691             outlineVertices[1]=wxPoint(2,0); 
    692  
    693             outlinePositions[0].x=min.x; outlinePositions[0].y=min.y; 
    694             outlinePositions[1].x=max.x; outlinePositions[1].y=max.y; 
    695  
    696             break; 
    697  
    698         default:    // Also handles case BOTTOM_LEFT. 
    699             source.x=min.x; source.y=min.y; 
    700  
    701             sourceVertices[0]=wxPoint(1,0); 
    702             sourceVertices[1]=wxPoint(0,1); 
    703             sourceVertices[2]=wxPoint(1,1); 
    704             sourceVertices[3]=wxPoint(2,1); 
    705             sourceVertices[4]=wxPoint(0,2); 
    706             sourceVertices[5]=wxPoint(1,2); 
    707             sourceVertices[6]=wxPoint(2,2); 
    708  
    709             outlineVertices[0]=wxPoint(0,0); 
    710             outlineVertices[1]=wxPoint(2,0); 
    711  
    712             outlinePositions[0].x=min.x; outlinePositions[0].y=max.y; 
    713             outlinePositions[1].x=max.x; outlinePositions[1].y=min.y; 
    714  
    715             break; 
    716     } 
    717  
    718  
    719     // Set source control vertices to source point. 
    720     for (int i=0; i<7; i++) 
    721     { 
    722         BP->SetCvPos(sourceVertices[i].x, sourceVertices[i].y, source); 
    723     } 
    724  
    725     // Set outline control vertices to their positions. 
    726     for (int i=0; i<2; i++) 
    727     { 
    728         BP->SetCvPos(outlineVertices[i].x, outlineVertices[i].y, outlinePositions[i]); 
    729     } 
    730  
    731     BP->SurfaceInfo.TexCoordGenMode=MatFit; 
    732     BP->UpdateTextureSpace(); 
    733  
    734     return BP; 
     588        case TOP_RIGHT:    pos=BOTTOM_LEFT;  break; 
     589        case TOP_LEFT:     pos=BOTTOM_RIGHT; break; 
     590        case BOTTOM_RIGHT: pos=TOP_LEFT;     break; 
     591        case BOTTOM_LEFT:  pos=TOP_RIGHT;    break; 
     592    } 
     593 
     594    return CreateQuarterDisc(Material_, LMM_, min, max, SubdivsHorz_, SubdivsVert_, pos, true); 
    735595} 
    736596 
     
    11411001        ArrayT<Vector3dT> CoordsOnly; 
    11421002 
     1003        // wxLogDebug("%s: Vertices of CollisionBP, width %lu, height %lu:", __FUNCTION__, CollisionBP.Width, CollisionBP.Height); 
    11431004        for (unsigned long VertexNr=0; VertexNr<CollisionBP.Mesh.Size(); VertexNr++) 
     1005        { 
    11441006            CoordsOnly.PushBack(CollisionBP.Mesh[VertexNr].Coord.AsVectorOfDouble()); 
     1007            // wxLogDebug("    %2lu: %s", VertexNr, convertToString(CoordsOnly[VertexNr])); 
     1008        } 
    11451009 
    11461010        // We cannot use our own Material->GetMaterial() here, because it might clip nothing (ClipFlags==0) 
  • cafu/trunk/CaWE/MapBezierPatch.hpp

    r285 r444  
    9292 
    9393    // Endcaps for bezier patches. 
    94     static MapBezierPatchT* CreateConvexEndcap(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_=-1, int SubdivsVert_=-1, EndCapPosE pos=TOP_RIGHT); 
     94    static MapBezierPatchT* CreateQuarterDisc(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_=-1, int SubdivsVert_=-1, EndCapPosE pos=TOP_RIGHT, bool Inverted=false); 
    9595    static MapBezierPatchT* CreateConcaveEndcap(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_=-1, int SubdivsVert_=-1, EndCapPosE pos=TOP_RIGHT); 
    9696 
  • cafu/trunk/CaWE/ToolMorph.cpp

    r285 r444  
    4040 
    4141 
    42 #if defined(_WIN32) && defined(_MSC_VER) 
    43     #if (_MSC_VER<1300) 
    44         #define for if (false) ; else for 
    45     #endif 
    46 #endif 
    47  
    48  
    4942/*** Begin of TypeSys related definitions for this class. ***/ 
    5043 
     
    467460    { 
    468461        wxMessageBox("The morph tool can add new vertices only to brushes (not to Bezier patches).\n" 
    469                      "(The resolution of Bezier patches can be changed with the Bezier patches tool.)", "Object being morphed is not a brush."); 
     462                     "(The number of subdivisions of Bezier patches can be changed in the Properties dialog.)", "Item being morphed is not a brush."); 
    470463        return; 
    471464    } 
     
    10111004    if (!IsActiveTool() || m_IsRecursiveSelfNotify) return; 
    10121005 
    1013     // Adapt the "selection" of this tool to the selection of the document. 
    1014     MorphPrims_CommitAndClear(); 
    1015  
    1016     // For each brush or bezier patch in the documents selection, create a related instance here. 
    1017     for (unsigned long SelNr=0; SelNr<NewSelection.Size(); SelNr++) 
    1018         MorphPrims_ToggleElem(NewSelection[SelNr]); 
     1006    // An external event caused a selection change, such as the user clicking "Undo". 
     1007    // 
     1008    //   - What we can *not* do is calling MorphPrims_CommitAndClear(), because that 
     1009    //     would attempt to submit another command to the command history while the 
     1010    //     command history is attempting to run the "Undo". 
     1011    // 
     1012    //   - Technically, it would be possible to do nothing: A change in selection 
     1013    //     does not require any alterations of our tool state, the user can continue 
     1014    //     to morph the objects that he previously begun to morph. 
     1015    // 
     1016    //   - Although the user might lose some morph work, probably the least confusion 
     1017    //     action is to just discard and clear the tool state. 
     1018    // 
     1019    for (unsigned long MPNr=0; MPNr<m_MorphPrims.Size(); MPNr++) 
     1020        delete m_MorphPrims[MPNr]; 
     1021    m_MorphPrims.Overwrite(); 
     1022 
     1023    m_ToolMan.UpdateAllObservers(this, UPDATE_SOON); 
     1024    m_DragState=DragNothing; 
    10191025} 
    10201026 
  • cafu/trunk/CaWE/ToolNewBezierPatch.cpp

    r285 r444  
    341341                    if (Convex) 
    342342                    { 
    343                         MapBezierPatchT* EndCap=MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
     343                        MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
    344344                        if (j==1) EndCap->InvertPatch(); // Invert bottom endcaps, so their faces are visible to the outside. 
    345345                        m_NewBPs.PushBack(EndCap); 
     
    396396                    if (Convex) 
    397397                    { 
    398                         MapBezierPatchT* EndCap=MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
     398                        MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
    399399                        if (j==1) EndCap->InvertPatch(); // Invert bottom endcaps, so their faces are visible to the outside. 
    400400                        m_NewBPs.PushBack(EndCap); 
     
    419419                Vector3fT  tmp_max=PatchBB.Max; 
    420420 
    421                 m_NewBPs.PushBack(MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, MapBezierPatchT::BOTTOM_RIGHT)); 
     421                m_NewBPs.PushBack(MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, MapBezierPatchT::BOTTOM_RIGHT)); 
    422422 
    423423                // Endcaps are always created at max.z, so max.z has to be min.z to create bottom endcap. 
    424424                tmp_max.z=PatchBB.Min.z; 
    425425 
    426                 MapBezierPatchT* EndCap=MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, MapBezierPatchT::BOTTOM_RIGHT); 
     426                MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, MapBezierPatchT::BOTTOM_RIGHT); 
    427427                EndCap->InvertPatch(); // Invert bottom endcap, so its face is visible to the outside. 
    428428                m_NewBPs.PushBack(EndCap); 
     
    468468                if (Convex) 
    469469                { 
    470                     MapBezierPatchT* EndCap=MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
     470                    MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
    471471                    EndCap->InvertPatch(); // Invert convex endcaps, so their faces are visible to the outside. 
    472472                    m_NewBPs.PushBack(EndCap); 
     
    494494                if (Convex) 
    495495                { 
    496                     MapBezierPatchT* EndCap=MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
     496                    MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
    497497                    EndCap->InvertPatch(); // Invert convex endcaps, so their faces are visible to the outside. 
    498498 
     
    569569                if (Convex) 
    570570                { 
    571                     MapBezierPatchT* EndCap=MapBezierPatchT::CreateConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
     571                    MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 
    572572                    EndCap->InvertPatch(); // Invert bottom endcaps, so their faces are visible to the outside. 
    573573                    m_NewBPs.PushBack(EndCap); 
     
    587587 
    588588        case 8: 
    589             m_NewBPs.PushBack(MapBezierPatchT::CreateConvexEndcap(Material, LMM, PatchBB.Min, PatchBB.Max, SubdivsHorz, SubdivsVert)); 
     589            m_NewBPs.PushBack(MapBezierPatchT::CreateQuarterDisc(Material, LMM, PatchBB.Min, PatchBB.Max, SubdivsHorz, SubdivsVert)); 
    590590            break; 
    591591 
  • cafu/trunk/Libs/ClipSys/CollisionModel_static.cpp

    r285 r444  
    17821782                    Plane3dT Plane(v1, v2, v3, 0.1); 
    17831783 
    1784                     if (fabs(Plane.GetDistance(v4))<MapT::RoundEpsilon) 
     1784                    // If v1 to v4 form a rectangle, create a single quad instead of two triangles. 
     1785                    // Note that this test is somewhat limited, but it covers the most important cases and is a lot 
     1786                    // less expensive than generally checking if v1 to v4 form a planar, convex, non-degenerate polygon... 
     1787                    if ((v1+v3-v2).IsEqual(v4, 0.01)) 
    17851788                    { 
    1786                         // Great, v1 to v4 are all in a common plane, so we can create a quad instead of two triangles! 
    17871789                        m_Polygons.PushBack(PolygonT(this, Patch.Material, A, B, C, D)); 
    17881790                        continue; 
     
    18561858                    Plane3dT Plane(v1, v2, v3, 0.1); 
    18571859 
    1858                     if (fabs(Plane.GetDistance(v4))<MapT::RoundEpsilon) 
     1860                    // If v1 to v4 form a rectangle, create a single quad instead of two triangles. 
     1861                    // Note that this test is somewhat limited, but it covers the most important cases and is a lot 
     1862                    // less expensive than generally checking if v1 to v4 form a planar, convex, non-degenerate polygon... 
     1863                    if ((v1+v3-v2).IsEqual(v4, 0.01)) 
    18591864                    { 
    1860                         // Great, v1 to v4 are all in a common plane, so we can create a quad instead of two triangles! 
    18611865                        m_Polygons.PushBack(PolygonT(this, Terrain.Material, A, B, C, D)); 
    18621866                        continue; 
     
    19631967                Plane3dT Plane(v1, v2, v3, 0.1); 
    19641968 
    1965                 if (fabs(Plane.GetDistance(v4))<MapT::RoundEpsilon) 
     1969                // If v1 to v4 form a rectangle, create a single quad instead of two triangles. 
     1970                // Note that this test is somewhat limited, but it covers the most important cases and is a lot 
     1971                // less expensive than generally checking if v1 to v4 form a planar, convex, non-degenerate polygon... 
     1972                if ((v1+v3-v2).IsEqual(v4, 0.01)) 
    19661973                { 
    1967                     // Great, v1 to v4 are all in a common plane, so we can create a quad instead of two triangles! 
    19681974                    m_Polygons.PushBack(PolygonT(this, Material, A, B, C, D)); 
    19691975                    continue; 
  • cafu/trunk/Libs/Math3D/BezierPatch.hpp

    r285 r444  
    150150            bool        ComputeTangentSpaceInSubPatch(unsigned long sp_i, unsigned long sp_j, const T s, const T t, Vector3T<T> Axes[3]) const; 
    151151        }; 
    152  
    153  
    154         /// The collision mesh of a bezier patch. 
    155         template<class T> 
    156         class CollisionMeshT 
    157         { 
    158             public: 
    159  
    160             /// Constructor. 
    161             CollisionMeshT(unsigned long Width, unsigned long Height, const ArrayT< Vector3T<T> >& Coords); 
    162         }; 
    163152    } 
    164153}