MCPcopy Create free account
hub / github.com/baldurk/renderdoc / UI_ResetArcball

Method UI_ResetArcball

qrenderdoc/Windows/BufferViewer.cpp:4579–4636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4577}
4578
4579void BufferViewer::UI_ResetArcball()
4580{
4581 BBoxData bbox;
4582
4583 {
4584 QMutexLocker autolock(&m_BBoxLock);
4585 if(m_BBoxes.contains(m_Ctx.CurEvent()))
4586 bbox = m_BBoxes[m_Ctx.CurEvent()];
4587 }
4588
4589 BufferItemModel *model = currentBufferModel();
4590 int stage = currentStageIndex();
4591
4592 if(model)
4593 {
4594 int posEl = model->posColumn();
4595 if(posEl >= 0 && posEl < model->getConfig().columns.count() &&
4596 posEl < bbox.bounds[stage].Min.count())
4597 {
4598 FloatVector diag;
4599 diag.x = bbox.bounds[stage].Max[posEl].x - bbox.bounds[stage].Min[posEl].x;
4600 diag.y = bbox.bounds[stage].Max[posEl].y - bbox.bounds[stage].Min[posEl].y;
4601 diag.z = bbox.bounds[stage].Max[posEl].z - bbox.bounds[stage].Min[posEl].z;
4602
4603 float len = qSqrt(diag.x * diag.x + diag.y * diag.y + diag.z * diag.z);
4604
4605 if(diag.x >= 0.0f && diag.y >= 0.0f && diag.z >= 0.0f && len >= 1.0e-6f && len <= 1.0e+10f)
4606 {
4607 FloatVector mid;
4608 mid.x = bbox.bounds[stage].Min[posEl].x + diag.x * 0.5f;
4609 mid.y = bbox.bounds[stage].Min[posEl].y + diag.y * 0.5f;
4610 mid.z = bbox.bounds[stage].Min[posEl].z + diag.z * 0.5f;
4611
4612 if(!isCurrentRasterOut())
4613 {
4614 // apply axis mapping to midpoint
4615 FloatVector transformedMid;
4616 transformedMid.x = m_Config.axisMapping.xAxis.x * mid.x +
4617 m_Config.axisMapping.yAxis.x * mid.y +
4618 m_Config.axisMapping.zAxis.x * mid.z;
4619 transformedMid.y = m_Config.axisMapping.xAxis.y * mid.x +
4620 m_Config.axisMapping.yAxis.y * mid.y +
4621 m_Config.axisMapping.zAxis.y * mid.z;
4622 transformedMid.z = m_Config.axisMapping.xAxis.z * mid.x +
4623 m_Config.axisMapping.yAxis.z * mid.y +
4624 m_Config.axisMapping.zAxis.z * mid.z;
4625 mid = transformedMid;
4626 }
4627
4628 m_Arcball->Reset(mid, len * 0.7f);
4629
4630 GUIInvoke::call(this, [this, len]() { ui->camSpeed->setValue(len / 200.0f); });
4631 }
4632 }
4633 }
4634
4635 INVOKE_MEMFN(RT_UpdateAndDisplay);
4636}

Callers

nothing calls this directly

Calls 7

qSqrtFunction · 0.85
posColumnMethod · 0.80
containsMethod · 0.45
CurEventMethod · 0.45
countMethod · 0.45
ResetMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected