src/toolsets/viewtoolset.cpp

changeset 1437
1a77c6156db7
parent 1436
241d3e452b32
equal deleted inserted replaced
1436:241d3e452b32 1437:1a77c6156db7
161 { 161 {
162 config::toggleDrawWireframe(); 162 config::toggleDrawWireframe();
163 m_window->renderer()->update(); 163 m_window->renderer()->update();
164 } 164 }
165 165
166 void ViewToolset::newTopCamera()
167 {
168 createNewCamera(gl::TopCamera);
169 }
170
171 void ViewToolset::newFrontCamera()
172 {
173 createNewCamera(gl::FrontCamera);
174 }
175
176 void ViewToolset::newLeftCamera()
177 {
178 createNewCamera(gl::LeftCamera);
179 }
180
181 void ViewToolset::newBottomCamera()
182 {
183 createNewCamera(gl::BottomCamera);
184 }
185
186 void ViewToolset::newBackCamera()
187 {
188 createNewCamera(gl::BackCamera);
189 }
190
191 void ViewToolset::newRightCamera()
192 {
193 createNewCamera(gl::RightCamera);
194 }
195
196 void ViewToolset::newFreeCamera()
197 {
198 createNewCamera(gl::FreeCamera);
199 }
200
201 void ViewToolset::selectTopCamera()
202 {
203 selectCamera(gl::TopCamera);
204 }
205
206 void ViewToolset::selectFrontCamera()
207 {
208 selectCamera(gl::FrontCamera);
209 }
210
211 void ViewToolset::selectLeftCamera()
212 {
213 selectCamera(gl::LeftCamera);
214 }
215
216 void ViewToolset::selectBottomCamera()
217 {
218 selectCamera(gl::BottomCamera);
219 }
220
221 void ViewToolset::selectBackCamera()
222 {
223 selectCamera(gl::BackCamera);
224 }
225
226 void ViewToolset::selectRightCamera()
227 {
228 selectCamera(gl::RightCamera);
229 }
230
231 void ViewToolset::selectFreeCamera()
232 {
233 selectCamera(gl::FreeCamera);
234 }
235
236 void ViewToolset::createNewCamera(gl::CameraType cameraType)
237 {
238 m_window->createCameraForDocument(currentDocument(), cameraType);
239 }
240
241 void ViewToolset::selectCamera(gl::CameraType cameraType)
242 {
243 m_window->selectCameraForDocument(currentDocument(), cameraType);
244 }
245
166 void ViewToolset::drawAngles() 246 void ViewToolset::drawAngles()
167 { 247 {
168 config::toggleDrawAngles(); 248 config::toggleDrawAngles();
169 m_window->renderer()->update(); 249 m_window->renderer()->update();
170 } 250 }
176 static Plane drawPlaneFromObject(LDObject* object) 256 static Plane drawPlaneFromObject(LDObject* object)
177 { 257 {
178 switch (object->type()) 258 switch (object->type())
179 { 259 {
180 case LDObjectType::Quadrilateral: 260 case LDObjectType::Quadrilateral:
181 if (not static_cast<LDQuadrilateral*>(object)->isCoPlanar()) 261 case LDObjectType::Triangle:
262 if (
263 object->type() == LDObjectType::Quadrilateral
264 and not static_cast<LDQuadrilateral*>(object)->isCoPlanar()
265 ) {
182 return {}; 266 return {};
183 case LDObjectType::Triangle: 267 }
184 return Plane::fromPoints(object->vertex(0), object->vertex(1), object->vertex(2)); 268 else
269 {
270 return Plane::fromPoints(object->vertex(0), object->vertex(1), object->vertex(2));
271 }
185 272
186 default: 273 default:
187 return {}; 274 return {};
188 } 275 }
189 } 276 }
218 m_window->renderer()->setDrawPlane({}); 305 m_window->renderer()->setDrawPlane({});
219 } 306 }
220 307
221 void ViewToolset::setCullDepth() 308 void ViewToolset::setCullDepth()
222 { 309 {
223 if (m_window->renderer()->camera() == gl::FreeCamera) 310 if (m_window->renderer()->currentCamera().isModelview())
224 return; 311 return;
225 312
226 bool ok; 313 bool ok;
227 double depth = QInputDialog::getDouble( 314 double depth = QInputDialog::getDouble(
228 m_window, 315 m_window,

mercurial