Changeset 444
- Timestamp:
- 12/17/11 22:02:59 (5 months ago)
- Location:
- cafu/trunk
- Files:
-
- 9 modified
-
CaWE/CaWE.dia (modified) (previous)
-
CaWE/CommandHistory.cpp (modified) (6 diffs)
-
CaWE/CommandHistory.hpp (modified) (1 diff)
-
CaWE/MapBezierPatch.cpp (modified) (4 diffs)
-
CaWE/MapBezierPatch.hpp (modified) (1 diff)
-
CaWE/ToolMorph.cpp (modified) (3 diffs)
-
CaWE/ToolNewBezierPatch.cpp (modified) (7 diffs)
-
Libs/ClipSys/CollisionModel_static.cpp (modified) (3 diffs)
-
Libs/Math3D/BezierPatch.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/CommandHistory.cpp
r443 r444 36 36 public: 37 37 38 RecursionCheckerT(bool& Is Active) : m_IsActive(IsActive) { wxASSERT(!m_IsActive); m_IsActive=true; }39 ~RecursionCheckerT() { m_Is Active=false; }38 RecursionCheckerT(bool& IsRecCall) : m_IsRecCall(IsRecCall) { wxASSERT(!m_IsRecCall); m_IsRecCall=true; } 39 ~RecursionCheckerT() { m_IsRecCall=false; } 40 40 41 41 42 42 private: 43 43 44 bool& m_Is Active;44 bool& m_IsRecCall; 45 45 }; 46 46 } … … 49 49 CommandHistoryT::CommandHistoryT() 50 50 : m_CurrentIndex(-1), 51 m_ Debug_IsActive(false),51 m_IsRecursiveCall(false), 52 52 m_InvalidCommandID(0) 53 53 { … … 99 99 if (m_CurrentIndex<0) return; 100 100 wxASSERT(m_CurrentIndex<(int)m_Commands.Size()); 101 RecursionCheckerT RecCheck(m_ Debug_IsActive);101 RecursionCheckerT RecCheck(m_IsRecursiveCall); 102 102 103 103 // Undo all commands from the invisible commands list and delete them. … … 131 131 if (m_CurrentIndex+1>=int(m_Commands.Size())) return; 132 132 wxASSERT(m_CurrentIndex<(int)m_Commands.Size()-1); 133 RecursionCheckerT RecCheck(m_ Debug_IsActive);133 RecursionCheckerT RecCheck(m_IsRecursiveCall); 134 134 135 135 // Undo all commands from the invisible commands list and delete them. … … 161 161 bool CommandHistoryT::SubmitCommand(CommandT* Command) 162 162 { 163 RecursionCheckerT RecCheck(m_ Debug_IsActive);163 RecursionCheckerT RecCheck(m_IsRecursiveCall); 164 164 165 165 if (!Command->IsDone() && !Command->Do()) … … 172 172 while (int(m_Commands.Size())>Options.general.UndoLevels) 173 173 { 174 if (m_Commands[0]->S howInHistory()) m_InvalidCommandID=m_Commands[0]->GetID();174 if (m_Commands[0]->SuggestsSave()) m_InvalidCommandID=m_Commands[0]->GetID(); 175 175 176 176 delete m_Commands[0]; -
cafu/trunk/CaWE/CommandHistory.hpp
r443 r444 49 49 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). 50 50 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 recursivecall 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()? 52 52 53 53 /// The command id returned when there is no current command (when the current index is -1). -
cafu/trunk/CaWE/MapBezierPatch.cpp
r285 r444 492 492 493 493 494 MapBezierPatchT* MapBezierPatchT::Create ConvexEndcap(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_, int SubdivsVert_, EndCapPosE pos)494 MapBezierPatchT* MapBezierPatchT::CreateQuarterDisc(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_, int SubdivsVert_, EndCapPosE pos, bool Inverted) 495 495 { 496 496 MapBezierPatchT* BP=new MapBezierPatchT(Material_, LMM_, SubdivsHorz_, SubdivsVert_); … … 498 498 BP->SetSize(3, 3); 499 499 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.515 500 switch (pos) 516 501 { 517 502 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); 535 517 break; 518 } 536 519 537 520 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); 555 535 break; 536 } 556 537 557 538 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)); 575 553 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)); 595 571 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 } 609 573 } 610 574 … … 618 582 MapBezierPatchT* MapBezierPatchT::CreateConcaveEndcap(EditorMaterialI* Material_, cf::SceneGraph::LightMapManT& LMM_, const Vector3fT& min, const Vector3fT& max, int SubdivsHorz_, int SubdivsVert_, EndCapPosE pos) 619 583 { 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. 639 586 switch (pos) 640 587 { 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); 735 595 } 736 596 … … 1141 1001 ArrayT<Vector3dT> CoordsOnly; 1142 1002 1003 // wxLogDebug("%s: Vertices of CollisionBP, width %lu, height %lu:", __FUNCTION__, CollisionBP.Width, CollisionBP.Height); 1143 1004 for (unsigned long VertexNr=0; VertexNr<CollisionBP.Mesh.Size(); VertexNr++) 1005 { 1144 1006 CoordsOnly.PushBack(CollisionBP.Mesh[VertexNr].Coord.AsVectorOfDouble()); 1007 // wxLogDebug(" %2lu: %s", VertexNr, convertToString(CoordsOnly[VertexNr])); 1008 } 1145 1009 1146 1010 // We cannot use our own Material->GetMaterial() here, because it might clip nothing (ClipFlags==0) -
cafu/trunk/CaWE/MapBezierPatch.hpp
r285 r444 92 92 93 93 // Endcaps for bezier patches. 94 static MapBezierPatchT* Create ConvexEndcap(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); 95 95 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); 96 96 -
cafu/trunk/CaWE/ToolMorph.cpp
r285 r444 40 40 41 41 42 #if defined(_WIN32) && defined(_MSC_VER)43 #if (_MSC_VER<1300)44 #define for if (false) ; else for45 #endif46 #endif47 48 49 42 /*** Begin of TypeSys related definitions for this class. ***/ 50 43 … … 467 460 { 468 461 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.)", "Objectbeing 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."); 470 463 return; 471 464 } … … 1011 1004 if (!IsActiveTool() || m_IsRecursiveSelfNotify) return; 1012 1005 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; 1019 1025 } 1020 1026 -
cafu/trunk/CaWE/ToolNewBezierPatch.cpp
r285 r444 341 341 if (Convex) 342 342 { 343 MapBezierPatchT* EndCap=MapBezierPatchT::Create ConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos);343 MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 344 344 if (j==1) EndCap->InvertPatch(); // Invert bottom endcaps, so their faces are visible to the outside. 345 345 m_NewBPs.PushBack(EndCap); … … 396 396 if (Convex) 397 397 { 398 MapBezierPatchT* EndCap=MapBezierPatchT::Create ConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos);398 MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 399 399 if (j==1) EndCap->InvertPatch(); // Invert bottom endcaps, so their faces are visible to the outside. 400 400 m_NewBPs.PushBack(EndCap); … … 419 419 Vector3fT tmp_max=PatchBB.Max; 420 420 421 m_NewBPs.PushBack(MapBezierPatchT::Create ConvexEndcap(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)); 422 422 423 423 // Endcaps are always created at max.z, so max.z has to be min.z to create bottom endcap. 424 424 tmp_max.z=PatchBB.Min.z; 425 425 426 MapBezierPatchT* EndCap=MapBezierPatchT::Create ConvexEndcap(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); 427 427 EndCap->InvertPatch(); // Invert bottom endcap, so its face is visible to the outside. 428 428 m_NewBPs.PushBack(EndCap); … … 468 468 if (Convex) 469 469 { 470 MapBezierPatchT* EndCap=MapBezierPatchT::Create ConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos);470 MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 471 471 EndCap->InvertPatch(); // Invert convex endcaps, so their faces are visible to the outside. 472 472 m_NewBPs.PushBack(EndCap); … … 494 494 if (Convex) 495 495 { 496 MapBezierPatchT* EndCap=MapBezierPatchT::Create ConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos);496 MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 497 497 EndCap->InvertPatch(); // Invert convex endcaps, so their faces are visible to the outside. 498 498 … … 569 569 if (Convex) 570 570 { 571 MapBezierPatchT* EndCap=MapBezierPatchT::Create ConvexEndcap(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos);571 MapBezierPatchT* EndCap=MapBezierPatchT::CreateQuarterDisc(Material, LMM, tmp_min, tmp_max, SubdivsHorz, SubdivsVert, pos); 572 572 EndCap->InvertPatch(); // Invert bottom endcaps, so their faces are visible to the outside. 573 573 m_NewBPs.PushBack(EndCap); … … 587 587 588 588 case 8: 589 m_NewBPs.PushBack(MapBezierPatchT::Create ConvexEndcap(Material, LMM, PatchBB.Min, PatchBB.Max, SubdivsHorz, SubdivsVert));589 m_NewBPs.PushBack(MapBezierPatchT::CreateQuarterDisc(Material, LMM, PatchBB.Min, PatchBB.Max, SubdivsHorz, SubdivsVert)); 590 590 break; 591 591 -
cafu/trunk/Libs/ClipSys/CollisionModel_static.cpp
r285 r444 1782 1782 Plane3dT Plane(v1, v2, v3, 0.1); 1783 1783 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)) 1785 1788 { 1786 // Great, v1 to v4 are all in a common plane, so we can create a quad instead of two triangles!1787 1789 m_Polygons.PushBack(PolygonT(this, Patch.Material, A, B, C, D)); 1788 1790 continue; … … 1856 1858 Plane3dT Plane(v1, v2, v3, 0.1); 1857 1859 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)) 1859 1864 { 1860 // Great, v1 to v4 are all in a common plane, so we can create a quad instead of two triangles!1861 1865 m_Polygons.PushBack(PolygonT(this, Terrain.Material, A, B, C, D)); 1862 1866 continue; … … 1963 1967 Plane3dT Plane(v1, v2, v3, 0.1); 1964 1968 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)) 1966 1973 { 1967 // Great, v1 to v4 are all in a common plane, so we can create a quad instead of two triangles!1968 1974 m_Polygons.PushBack(PolygonT(this, Material, A, B, C, D)); 1969 1975 continue; -
cafu/trunk/Libs/Math3D/BezierPatch.hpp
r285 r444 150 150 bool ComputeTangentSpaceInSubPatch(unsigned long sp_i, unsigned long sp_j, const T s, const T t, Vector3T<T> Axes[3]) const; 151 151 }; 152 153 154 /// The collision mesh of a bezier patch.155 template<class T>156 class CollisionMeshT157 {158 public:159 160 /// Constructor.161 CollisionMeshT(unsigned long Width, unsigned long Height, const ArrayT< Vector3T<T> >& Coords);162 };163 152 } 164 153 }
