Changeset 474 for cafu/trunk
- Timestamp:
- 02/02/12 00:29:44 (4 months ago)
- Location:
- cafu/trunk
- Files:
-
- 13 modified
-
CaWE/ModelEditor/ElementsList.cpp (modified) (1 diff)
-
CaWE/ModelEditor/TransformDialog.cpp (modified) (1 diff)
-
Libs/Models/Classes.dia (modified) (previous)
-
Libs/Models/Loader_ase.cpp (modified) (2 diffs)
-
Libs/Models/Loader_ase.hpp (modified) (2 diffs)
-
Libs/Models/Loader_cmdl.cpp (modified) (1 diff)
-
Libs/Models/Loader_dummy.cpp (modified) (1 diff)
-
Libs/Models/Loader_fbx.cpp (modified) (2 diffs)
-
Libs/Models/Loader_lwo.cpp (modified) (1 diff)
-
Libs/Models/Loader_md5.cpp (modified) (1 diff)
-
Libs/Models/Loader_mdl.cpp (modified) (1 diff)
-
Libs/Models/Model_cmdl.cpp (modified) (2 diffs)
-
Libs/Models/Model_cmdl.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/ModelEditor/ElementsList.cpp
r473 r474 193 193 const ArrayT<unsigned int>& Sel=m_ModelDoc->GetSelection(m_TYPE); 194 194 195 // When a command is done or undone, it can indirectly call our Notify_*() methods, 196 // which in turn call InitListItems(). Our calls to Select() unfortunately cause a 197 // wxEVT_COMMAND_LIST_ITEM_SELECTED event, which in turn calls our OnSelectionChanged() 198 // handler. Thus we set m_IsRecursiveSelfNotify in order to prevent the handler 199 // from inadvertently submitting another command. 195 200 m_IsRecursiveSelfNotify=true; 196 201 Freeze(); -
cafu/trunk/CaWE/ModelEditor/TransformDialog.cpp
r455 r474 103 103 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); 104 104 105 wxStaticText *item1 = new wxStaticText(this, -1, wxT("The transformation is applied to the entire model in the selected animation sequence or bind pose:"), wxDefaultPosition, wxSize(220,48), 0 );105 wxStaticText *item1 = new wxStaticText(this, -1, wxT("The transformation is applied to the currently selected animation sequence(s):"), wxDefaultPosition, wxSize(220, 32), 0 ); 106 106 item0->Add( item1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); 107 107 -
cafu/trunk/Libs/Models/Loader_ase.cpp
r455 r474 156 156 // remeber to not ignore the "*MATERIAL_REF" keyword any longer, and fix all faces with no "*MESH_MTLID" after loading! 157 157 if (SmoothGroupString=="*MESH_MTLID") break; 158 Triangles[FaceNr].SmoothGroups.PushBack(strtoul(SmoothGroupString.c_str(), NULL, 0)); 158 159 const unsigned long SG=strtoul(SmoothGroupString.c_str(), NULL, 0); 160 161 if (SG > 31) 162 printf("Mesh is in smoothing group %lu, but should be in 0...31.\n", SG); 163 164 Triangles[FaceNr].SmoothGroups.PushBack(SG); 165 Triangles[FaceNr].SmoothGrps=uint32_t(1) << SG; 166 159 167 if (Triangles[FaceNr].SmoothGroups.Size()>32) throw TextParserT::ParseError(); // Safe-Guard... 160 168 } … … 580 588 } 581 589 590 CafuTri.SmoothGroups=AseTri.SmoothGrps; 582 591 CafuTri.gts_Normal=AseTri.Normal.AsVectorOfFloat(); 583 592 } -
cafu/trunk/Libs/Models/Loader_ase.hpp
r457 r474 57 57 /// Constructor. 58 58 TriangleT() 59 : SmoothGrps(0) 59 60 { 60 61 for (unsigned long i=0; i<3; i++) … … 69 70 unsigned long IndTexCoords[3]; ///< Indices into the TexCoords array. 70 71 ArrayT<unsigned long> SmoothGroups; ///< The SmoothGroups this triangle is in. 72 uint32_t SmoothGrps; ///< The smoothing groups that this triangle is in: If bit \c i is set, the triangle is in smoothing group \c i. 71 73 72 74 // This data is computed after loading. -
cafu/trunk/Libs/Models/Loader_cmdl.cpp
r455 r474 272 272 lua_pop(m_LuaState, 1); 273 273 } 274 275 lua_getfield(m_LuaState, -1, "sg"); 276 Triangle.SmoothGroups=uint32_t(lua_tonumber(m_LuaState, -1)); 277 lua_pop(m_LuaState, 1); 274 278 275 279 lua_getfield(m_LuaState, -1, "skipDraw"); -
cafu/trunk/Libs/Models/Loader_dummy.cpp
r455 r474 94 94 { 95 95 Mesh.Triangles.PushBack(CafuModelT::MeshT::TriangleT(0, ((i+1) % Facets)+1, i+1)); 96 Mesh.Triangles[i].SmoothGroups=0x01; 96 97 } 97 98 -
cafu/trunk/Libs/Models/Loader_fbx.cpp
r455 r474 573 573 const KFbxLayerElement::EMappingMode MappingMode=(Mesh->GetLayer(0) && Mesh->GetLayer(0)->GetUVs()) ? Mesh->GetLayer(0)->GetUVs()->GetMappingMode() : KFbxLayerElement::eNONE; 574 574 KFbxLayerElementArrayTemplate<KFbxVector2>* UVArray =NULL; 575 const KFbxLayerElementSmoothing* SmoothingLE=NULL; 575 576 std::map<uint64_t, unsigned int> UniqueVertices; // Maps tuples of (Mesh->GetPolygonVertex(), Mesh->GetTextureUVIndex()) to indices into CafuMesh.Vertices. 576 577 577 578 Mesh->GetTextureUV(&UVArray, KFbxLayerElement::eDIFFUSE_TEXTURES); 578 579 580 if (Mesh->GetLayer(0)) 581 { 582 SmoothingLE=Mesh->GetLayer(0)->GetSmoothing(); 583 584 if (SmoothingLE) 585 Log << " The mesh has a smoothing layer element with mapping mode " 586 << SmoothingLE->GetMappingMode() << " and reference mode " 587 << SmoothingLE->GetReferenceMode() << ".\n"; 588 else 589 Log << " The mesh has no smoothing layer element.\n"; 590 } 591 579 592 for (int PolyNr=0; PolyNr<Mesh->GetPolygonCount(); PolyNr++) 580 593 { 594 uint32_t SmoothingGroups=0x01; // Per default, all triangles are in a common smoothing group. 595 596 if (SmoothingLE) 597 { 598 if (SmoothingLE->GetMappingMode() == KFbxGeometryElement::eBY_POLYGON) 599 { 600 switch (SmoothingLE->GetReferenceMode()) 601 { 602 case KFbxGeometryElement::eDIRECT: 603 SmoothingGroups = SmoothingLE->GetDirectArray().GetAt(PolyNr); 604 break; 605 606 case KFbxGeometryElement::eINDEX_TO_DIRECT: 607 SmoothingGroups = SmoothingLE->GetDirectArray().GetAt(SmoothingLE->GetIndexArray().GetAt(PolyNr)); 608 break; 609 610 default: 611 // Ignore any unknown reference mode. 612 break; 613 } 614 } 615 else if (SmoothingLE->GetMappingMode() == KFbxGeometryElement::eBY_EDGE) 616 { 617 // Unfortunately, we cannot deal with Maya-style smoothing info (hard vs. soft edges). 618 } 619 } 620 581 621 for (int PolyTriNr=0; PolyTriNr < Mesh->GetPolygonSize(PolyNr)-2; PolyTriNr++) 582 622 { … … 612 652 } 613 653 654 Tri.SmoothGroups=SmoothingGroups; 614 655 CafuMesh.Triangles.PushBack(Tri); 615 656 } -
cafu/trunk/Libs/Models/Loader_lwo.cpp
r455 r474 394 394 Triangle.VertexIdx[2]=PolygonMeshVertices[VertexNr+1]; 395 395 396 if (Poly.smoothgrp<0 || Poly.smoothgrp>31) 397 Console->Warning(cf::va("Polygon %i is in smoothing group %i, but should be in 0...31.\n", PolyNr, Poly.smoothgrp)); 398 399 Triangle.SmoothGroups=uint32_t(1) << Poly.smoothgrp; 396 400 Triangle.gts_Normal=Vector3fT(Poly.norm); 397 401 -
cafu/trunk/Libs/Models/Loader_md5.cpp
r473 r474 179 179 Mesh.Triangles[TriIdx].VertexIdx[1]=TP.GetNextTokenAsInt(); 180 180 Mesh.Triangles[TriIdx].VertexIdx[2]=TP.GetNextTokenAsInt(); 181 182 // All triangles are in a common smoothing group. 183 Mesh.Triangles[TriIdx].SmoothGroups=0x01; 181 184 } 182 185 else if (Token=="vert") -
cafu/trunk/Libs/Models/Loader_mdl.cpp
r455 r474 346 346 CafuModelT::MeshT::TriangleT CafuTri; 347 347 348 // All triangles are in a common smoothing group. 349 CafuTri.SmoothGroups=0x01; 350 348 351 for (unsigned int i=0; i<3; i++) 349 352 { -
cafu/trunk/Libs/Models/Model_cmdl.cpp
r472 r474 85 85 86 86 CafuModelT::MeshT::TriangleT::TriangleT(unsigned int v0, unsigned int v1, unsigned int v2) 87 : Polarity(false), 87 : SmoothGroups(0), 88 Polarity(false), 88 89 SkipDraw(false) 89 90 { … … 719 720 OutStream << "\t\t\t" 720 721 << "{ " 721 << Triangle.VertexIdx[0] << ", " << Triangle.VertexIdx[1] << ", " << Triangle.VertexIdx[2]; 722 if (Triangle.SkipDraw) OutStream << ", skipDraw=true;"; 722 << Triangle.VertexIdx[0] << ", " << Triangle.VertexIdx[1] << ", " << Triangle.VertexIdx[2] 723 << ", sg=" << Triangle.SmoothGroups; 724 if (Triangle.SkipDraw) OutStream << ", skipDraw=true"; 723 725 OutStream << " " 724 726 << "},\n"; -
cafu/trunk/Libs/Models/Model_cmdl.hpp
r472 r474 82 82 83 83 unsigned int VertexIdx[3]; ///< The indices to the three vertices that define this triangle. 84 uint32_t SmoothGroups; ///< The smoothing groups that this triangle is in: If bit \c i is set, the triangle is in smoothing group \c i. 84 85 85 86 int NeighbIdx[3]; ///< The array indices of the three neighbouring triangles at the edges 01, 12 and 20. -1 indicates no neighbour, -2 indicates more than one neighbour.
