Changeset 380
- Timestamp:
- 09/15/11 10:29:13 (8 months ago)
- Location:
- cafu/trunk/CaWE/ModelEditor
- Files:
-
- 3 modified
-
ScenePropGrid.cpp (modified) (4 diffs)
-
ScenePropGrid.hpp (modified) (1 diff)
-
SceneView3D.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/ModelEditor/ScenePropGrid.cpp
r318 r380 27 27 #include "../GameConfig.hpp" 28 28 #include "../MapBrush.hpp" 29 #include "../Options.hpp" 29 30 #include "MaterialSystem/MapComposition.hpp" 30 31 #include "MaterialSystem/TextureMap.hpp" … … 43 44 m_BackgroundColor(wxColour(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/BackgroundColor", "rgb(0, 128, 255)"))), 44 45 m_ShowOrigin(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/ShowOrigin", 1l)!=0), 46 m_ShowGrid(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/ShowGrid", 0l)!=0), 47 m_GridSpacing(Options.Grid.InitialSpacing), 45 48 m_GroundPlane_Show(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/GroundPlane_Show", 1l)!=0), 46 49 m_Model_ShowMesh(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/Model_ShowMesh", 1l)!=0), … … 84 87 AppendIn(GeneralCat, new wxColourProperty("Background Color", wxPG_LABEL, m_BackgroundColor)); 85 88 AppendIn(GeneralCat, new wxBoolProperty("Show Origin", wxPG_LABEL, m_ShowOrigin)); 89 AppendIn(GeneralCat, new wxBoolProperty("Show Grid", wxPG_LABEL, m_ShowGrid)); 90 AppendIn(GeneralCat, new wxFloatProperty("Grid Spacing", wxPG_LABEL, m_GridSpacing)); 86 91 87 92 … … 182 187 if (PropName=="Background Color") m_BackgroundColor << Prop->GetValue(); 183 188 else if (PropName=="Show Origin") m_ShowOrigin=Prop->GetValue().GetBool(); 189 else if (PropName=="Show Grid") m_ShowGrid=Prop->GetValue().GetBool(); 190 else if (PropName=="Grid Spacing") m_GridSpacing=PropValueF; 184 191 else if (PropName=="Camera.Pos.x") Camera.Pos.x=PropValueF; 185 192 else if (PropName=="Camera.Pos.y") Camera.Pos.y=PropValueF; -
cafu/trunk/CaWE/ModelEditor/ScenePropGrid.hpp
r318 r380 51 51 wxColour m_BackgroundColor; 52 52 bool m_ShowOrigin; 53 bool m_ShowGrid; 54 float m_GridSpacing; 53 55 bool m_GroundPlane_Show; 54 56 bool m_Model_ShowMesh; -
cafu/trunk/CaWE/ModelEditor/SceneView3D.cpp
r360 r380 600 600 } 601 601 602 // Render the grid. 603 if (ScenePropGrid->m_ShowGrid) 604 { 605 for (unsigned int PlaneNr=0; PlaneNr<3; PlaneNr++) 606 { 607 static MatSys::MeshT Mesh(MatSys::MeshT::Lines); 608 609 const unsigned int NumLines=17; 610 const float Spacing =ScenePropGrid->m_GridSpacing; 611 const float MaxCoord=Spacing * ((NumLines-1)/2); 612 613 if (Mesh.Vertices.Size()==0) 614 { 615 Mesh.Vertices.PushBackEmptyExact(NumLines*2); 616 617 const float r=Options.Grid.ColorHighlight1.Red() / 255.0f; 618 const float g=Options.Grid.ColorHighlight1.Green() / 255.0f; 619 const float b=Options.Grid.ColorHighlight1.Blue() / 255.0f; 620 621 for (unsigned int LineNr=0; LineNr<NumLines; LineNr++) 622 { 623 Mesh.Vertices[LineNr*2 ].SetColor(r, g, b); 624 Mesh.Vertices[LineNr*2+1].SetColor(r, g, b); 625 } 626 } 627 628 for (unsigned int DirNr=0; DirNr<2; DirNr++) 629 { 630 for (unsigned int LineNr=0; LineNr<NumLines; LineNr++) 631 { 632 Vector3fT A; 633 Vector3fT B; 634 635 A[(PlaneNr+1+DirNr) % 3]=-MaxCoord; 636 A[(PlaneNr+2-DirNr) % 3]=Spacing*LineNr - MaxCoord; 637 638 B[(PlaneNr+1+DirNr) % 3]=MaxCoord; 639 B[(PlaneNr+2-DirNr) % 3]=Spacing*LineNr - MaxCoord; 640 641 Mesh.Vertices[LineNr*2 ].SetOrigin(A); 642 Mesh.Vertices[LineNr*2+1].SetOrigin(B); 643 } 644 645 MatSys::Renderer->SetCurrentMaterial(m_Renderer.GetRMatWireframe()); 646 MatSys::Renderer->RenderMesh(Mesh); 647 } 648 } 649 } 650 602 651 // Render a small cross at the (world-space) position of each active light source. 603 652 const ArrayT<ModelDocumentT::LightSourceT*>& LightSources=m_Parent->GetModelDoc()->GetLightSources();
