Changeset 429 for cafu/trunk
- Timestamp:
- 11/23/11 10:59:48 (6 months ago)
- Location:
- cafu/trunk
- Files:
-
- 2 added
- 7 modified
-
CaWE/ModelEditor/Commands/UpdateTriangle.cpp (added)
-
CaWE/ModelEditor/Commands/UpdateTriangle.hpp (added)
-
CaWE/ModelEditor/SceneView3D.cpp (modified) (4 diffs)
-
Games/DeathMatch/Code/StaticDetailModel.hpp (modified) (1 diff)
-
Libs/MaterialSystem/MapComposition.cpp (modified) (2 diffs)
-
Libs/Models/AnimPose.cpp (modified) (3 diffs)
-
Libs/Models/Loader_cmdl.cpp (modified) (1 diff)
-
Libs/Models/Model_cmdl.cpp (modified) (2 diffs)
-
Libs/Models/Model_cmdl.hpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/ModelEditor/SceneView3D.cpp
r428 r429 25 25 #include "ScenePropGrid.hpp" 26 26 #include "Commands/UpdateGuiFixture.hpp" 27 #include "Commands/UpdateTriangle.hpp" 27 28 #include "../AppCaWE.hpp" 28 29 #include "../Camera.hpp" … … 228 229 ID_MENU_SET_GUIFIX_ORIGIN, 229 230 ID_MENU_SET_GUIFIX_ENDPOINT_X, 230 ID_MENU_SET_GUIFIX_ENDPOINT_Y 231 ID_MENU_SET_GUIFIX_ENDPOINT_Y, 232 ID_MENU_TRIANGLE_INFO, 233 ID_MENU_TRIANGLE_SKIPDRAW 231 234 }; 232 235 … … 244 247 } 245 248 249 246 250 wxMenu Menu; 247 251 const ArrayT<unsigned int>& Sel=m_Parent->GetModelDoc()->GetSelection(GFIX); … … 269 273 } 270 274 271 const int PointNr=GetPopupMenuSelectionFromUser(Menu)-ID_MENU_SET_GUIFIX_ORIGIN; 272 273 if (HaveModelHit && PointNr>=0 && PointNr<=2) 274 { 275 CafuModelT::GuiFixtureT GF=Model->GetGuiFixtures()[Sel[0]]; 276 277 GF.Points[PointNr].MeshNr =ModelTR.MeshNr; 278 GF.Points[PointNr].VertexNr=BestVertexNr; 279 280 m_Parent->SubmitCommand(new CommandUpdateGuiFixtureT(m_Parent->GetModelDoc(), Sel[0], GF)); 275 if (HaveModelHit) 276 { 277 const bool SkipDraw=Model->GetMeshes()[ModelTR.MeshNr].Triangles[ModelTR.TriNr].SkipDraw; 278 279 Menu.AppendSeparator(); 280 Menu.Append(ID_MENU_TRIANGLE_INFO, wxString::Format("Mesh %u, Triangle %u:", ModelTR.MeshNr, ModelTR.TriNr))->Enable(false); 281 Menu.AppendCheckItem(ID_MENU_TRIANGLE_SKIPDRAW, "Hide Triangle (skip drawing)")->Check(SkipDraw); 282 } 283 284 285 const int MenuSelID=GetPopupMenuSelectionFromUser(Menu); 286 287 switch (MenuSelID) 288 { 289 case ID_MENU_TRIANGLE_SKIPDRAW: 290 { 291 if (HaveModelHit) 292 { 293 const bool SkipDraw=Model->GetMeshes()[ModelTR.MeshNr].Triangles[ModelTR.TriNr].SkipDraw; 294 295 m_Parent->SubmitCommand(new CommandUpdateTriangleT(m_Parent->GetModelDoc(), ModelTR.MeshNr, ModelTR.TriNr, !SkipDraw)); 296 } 297 } 298 299 default: 300 { 301 const int PointNr=MenuSelID-ID_MENU_SET_GUIFIX_ORIGIN; 302 303 if (HaveModelHit && PointNr>=0 && PointNr<=2) 304 { 305 CafuModelT::GuiFixtureT GF=Model->GetGuiFixtures()[Sel[0]]; 306 307 GF.Points[PointNr].MeshNr =ModelTR.MeshNr; 308 GF.Points[PointNr].VertexNr=BestVertexNr; 309 310 m_Parent->SubmitCommand(new CommandUpdateGuiFixtureT(m_Parent->GetModelDoc(), Sel[0], GF)); 311 } 312 } 281 313 } 282 314 } -
cafu/trunk/Games/DeathMatch/Code/StaticDetailModel.hpp
r427 r429 76 76 float m_FrameNr; ///< The current frame of the played animation sequence. Used <em>independently</em> on the server and the clients; only a <em>restart</em> of a sequence is sync'ed over the network via the EventID_RestartSequ event. 77 77 std::string GuiName; ///< If our "gui" entity key is set, store the value here. 78 cf::GuiSys::GuiI* Gui; ///< If the Model can display a GUI (it has a "Textures/meta/EntityGUI" surface), we load ithere, *both* on the server- as well as on the client-side.78 cf::GuiSys::GuiI* Gui; ///< If the model has GUI fixtures, we load the GUI here, *both* on the server- as well as on the client-side. 79 79 80 80 -
cafu/trunk/Libs/MaterialSystem/MapComposition.cpp
r308 r429 712 712 { 713 713 const static MapCompositionT RefMapComp; // Use a reference object here, just in case we ever change the defaults. 714 const std::string BaseString=GetString(); 714 715 std::string OptionsString=""; 716 717 if (BaseString=="") 718 { 719 // If the base string is empty, don't attempt to attach any options. 720 return ""; 721 } 715 722 716 723 if (MinFilter!=RefMapComp.MinFilter) … … 779 786 } 780 787 781 return GetString()+ OptionsString;788 return BaseString + OptionsString; 782 789 } 783 790 -
cafu/trunk/Libs/Models/AnimPose.cpp
r428 r429 91 91 // m_Draw_Meshes[MeshNr].Winding=MatSys::MeshT::CW; // CW is the default. 92 92 93 if (m_Draw_Meshes[MeshNr].Vertices.Size()!=Mesh.Triangles.Size()*3) 93 unsigned long NumDrawTris=0; 94 for (unsigned long TriNr=0; TriNr<Mesh.Triangles.Size(); TriNr++) 95 if (!Mesh.Triangles[TriNr].SkipDraw) 96 NumDrawTris++; 97 98 if (m_Draw_Meshes[MeshNr].Vertices.Size()!=NumDrawTris*3) 94 99 { 95 100 m_Draw_Meshes[MeshNr].Vertices.Overwrite(); 96 m_Draw_Meshes[MeshNr].Vertices.PushBackEmptyExact( Mesh.Triangles.Size()*3);101 m_Draw_Meshes[MeshNr].Vertices.PushBackEmptyExact(NumDrawTris*3); 97 102 } 98 103 } … … 398 403 for (unsigned long MeshNr=0; MeshNr<Meshes.Size(); MeshNr++) 399 404 { 400 const MeshT& Mesh =Meshes[MeshNr]; 401 const MeshInfoT& MeshInfo=m_MeshInfos[MeshNr]; 405 const MeshT& Mesh =Meshes[MeshNr]; 406 const MeshInfoT& MeshInfo =m_MeshInfos[MeshNr]; 407 unsigned long DrawTriNr=0; 402 408 403 409 for (unsigned long TriNr=0; TriNr<Mesh.Triangles.Size(); TriNr++) 404 410 { 411 if (Mesh.Triangles[TriNr].SkipDraw) 412 continue; 413 405 414 for (unsigned long i=0; i<3; i++) 406 415 { … … 408 417 const MeshInfoT::VertexT& VertexInfo=MeshInfo.Vertices[VertexIdx]; 409 418 410 m_Draw_Meshes[MeshNr].Vertices[TriNr*3+i].SetOrigin(VertexInfo.Pos.x, VertexInfo.Pos.y, VertexInfo.Pos.z); 411 m_Draw_Meshes[MeshNr].Vertices[TriNr*3+i].SetTextureCoord(Mesh.Vertices[VertexIdx].u, Mesh.Vertices[VertexIdx].v); 412 m_Draw_Meshes[MeshNr].Vertices[TriNr*3+i].SetNormal (VertexInfo.Normal.x, VertexInfo.Normal.y, VertexInfo.Normal.z ); 413 m_Draw_Meshes[MeshNr].Vertices[TriNr*3+i].SetTangent (VertexInfo.Tangent.x, VertexInfo.Tangent.y, VertexInfo.Tangent.z ); 414 m_Draw_Meshes[MeshNr].Vertices[TriNr*3+i].SetBiNormal(VertexInfo.BiNormal.x, VertexInfo.BiNormal.y, VertexInfo.BiNormal.z); 415 } 419 m_Draw_Meshes[MeshNr].Vertices[DrawTriNr*3+i].SetOrigin(VertexInfo.Pos.x, VertexInfo.Pos.y, VertexInfo.Pos.z); 420 m_Draw_Meshes[MeshNr].Vertices[DrawTriNr*3+i].SetTextureCoord(Mesh.Vertices[VertexIdx].u, Mesh.Vertices[VertexIdx].v); 421 m_Draw_Meshes[MeshNr].Vertices[DrawTriNr*3+i].SetNormal (VertexInfo.Normal.x, VertexInfo.Normal.y, VertexInfo.Normal.z ); 422 m_Draw_Meshes[MeshNr].Vertices[DrawTriNr*3+i].SetTangent (VertexInfo.Tangent.x, VertexInfo.Tangent.y, VertexInfo.Tangent.z ); 423 m_Draw_Meshes[MeshNr].Vertices[DrawTriNr*3+i].SetBiNormal(VertexInfo.BiNormal.x, VertexInfo.BiNormal.y, VertexInfo.BiNormal.z); 424 } 425 426 DrawTriNr++; 416 427 } 417 428 } -
cafu/trunk/Libs/Models/Loader_cmdl.cpp
r428 r429 272 272 lua_pop(m_LuaState, 1); 273 273 } 274 275 lua_getfield(m_LuaState, -1, "skipDraw"); 276 Triangle.SkipDraw=lua_toboolean(m_LuaState, -1)!=0; 277 lua_pop(m_LuaState, 1); 274 278 } 275 279 lua_pop(m_LuaState, 1); -
cafu/trunk/Libs/Models/Model_cmdl.cpp
r428 r429 80 80 81 81 CafuModelT::MeshT::TriangleT::TriangleT(unsigned int v0, unsigned int v1, unsigned int v2) 82 : Polarity(false) 82 : Polarity(false), 83 SkipDraw(false) 83 84 { 84 85 VertexIdx[0]=v0; … … 706 707 OutStream << "\t\t\t" 707 708 << "{ " 708 << Triangle.VertexIdx[0] << ", " << Triangle.VertexIdx[1] << ", " << Triangle.VertexIdx[2] << " " 709 << Triangle.VertexIdx[0] << ", " << Triangle.VertexIdx[1] << ", " << Triangle.VertexIdx[2]; 710 if (Triangle.SkipDraw) OutStream << ", skipDraw=true;"; 711 OutStream << " " 709 712 << "},\n"; 710 713 } -
cafu/trunk/Libs/Models/Model_cmdl.hpp
r428 r429 50 50 namespace ModelEditor { class CommandUpdateChannelT; } 51 51 namespace ModelEditor { class CommandUpdateGuiFixtureT; } 52 namespace ModelEditor { class CommandUpdateTriangleT; } 52 53 53 54 … … 82 83 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. 83 84 bool Polarity; ///< True if this triangle has positive polarity (texture is not mirrored), or false if it has negative polarity (texture is mirrored, SxT points inward). 85 bool SkipDraw; ///< True if this triangle should be skipped when drawing the mesh (but not for casting stencil shadows and not for collision detection). This is useful for hiding triangles that are in the same plane as GUI panels and would otherwise cause z-fighting. 84 86 85 87 Vector3fT gts_Normal; ///< The draw normal for this triangle, required for the shadow-silhouette determination. … … 303 305 friend class ModelEditor::CommandUpdateChannelT; 304 306 friend class ModelEditor::CommandUpdateGuiFixtureT; 307 friend class ModelEditor::CommandUpdateTriangleT; 305 308 306 309 CafuModelT(const CafuModelT&); ///< Use of the Copy Constructor is not allowed.
