src/editmodes/drawMode.cpp

changeset 996
9ecc878c7dea
parent 968
4b93b7963456
equal deleted inserted replaced
995:7986584e7498 996:9ecc878c7dea
90 QList<Vertex>& verts = m_drawedVerts; 90 QList<Vertex>& verts = m_drawedVerts;
91 LDObjectList objs; 91 LDObjectList objs;
92 92
93 switch (verts.size()) 93 switch (verts.size())
94 { 94 {
95 case 2: 95 case 2:
96 { 96 {
97 // 2 verts - make a line 97 // 2 verts - make a line
98 LDLine* obj = LDSpawn<LDLine> (verts[0], verts[1]); 98 LDLine* obj = LDSpawn<LDLine> (verts[0], verts[1]);
99 obj->setColor (EdgeColor); 99 obj->setColor (EdgeColor);
100 objs << obj; 100 objs << obj;
101 break;
102 } 101 }
102 break;
103 103
104 case 3: 104 case 3:
105 case 4: 105 case 4:
106 { 106 {
107 LDObject* obj = (verts.size() == 3) ? 107 LDVertexObject* obj = (verts.size() == 3) ?
108 static_cast<LDObject*> (LDSpawn<LDTriangle>()) : 108 static_cast<LDVertexObject*> (LDSpawn<LDTriangle>()) :
109 static_cast<LDObject*> (LDSpawn<LDQuad>()); 109 static_cast<LDVertexObject*> (LDSpawn<LDQuad>());
110 110
111 obj->setColor (MainColor); 111 obj->setColor (MainColor);
112 112
113 for (int i = 0; i < verts.size(); ++i) 113 for (int i = 0; i < verts.size(); ++i)
114 obj->setVertex (i, verts[i]); 114 obj->setVertex (i, verts[i]);
115 115
116 objs << obj; 116 objs << obj;
117 break;
118 } 117 }
118 break;
119 } 119 }
120 120
121 finishDraw (objs); 121 finishDraw (objs);
122 } 122 }
123 123

mercurial