void VisitPointTool::UpdateTool() { hotPoints[0].pt = avtVector((double*)Interface.GetPoint()); if (proxy.GetFullFrameMode()) { // // Translate the hotPoints so they appear in the correct position // in full-frame mode. // double scale; int type; proxy.GetScaleFactorAndType(scale, type); if (type == 0 ) // x_axis hotPoints[0].pt.x *= scale; else // x_axis hotPoints[0].pt.y *= scale; } double axisscale[3]; if (proxy.Get3DAxisScalingFactors(axisscale)) { hotPoints[0].pt.x *= axisscale[0]; hotPoints[0].pt.y *= axisscale[1]; hotPoints[0].pt.z *= axisscale[2]; } UpdateSphere(); UpdateText(); }
void cFrustum::SetViewProjMatrix(const cMatrixf& a_mtxProj, const cMatrixf& a_mtxView, float afFarPlane, float afNearPlane,float afFOV,float afAspect, const cVector3f &avOrigin, bool abInfFarPlane) { m_mtxViewProj = cMath::MatrixMul(a_mtxProj, a_mtxView); m_mtxModelView = a_mtxView; mfFarPlane = afFarPlane; mfNearPlane = afNearPlane; mfFOV = afFOV; mfAspect = afAspect; mvOrigin = avOrigin; mbInfFarPlane = abInfFarPlane; //This could be made more accurate. mOriginBV.SetSize(afNearPlane*2); mOriginBV.SetPosition(mvOrigin); UpdatePlanes(); UpdateSphere(); UpdateEndPoints(); UpdateBV(); }
void VisitPointTool::UpdateView() { if(IsEnabled()) { UpdateText(); UpdateSphere(); } }
void VisitPointTool::CreateSphere() { sphereData = NULL; sphereMapper = vtkPolyDataMapper::New(); sphereActor = vtkActor::New(); sphereActor->SetMapper(sphereMapper); UpdateSphere(); }
void cFrustum::SetViewProjMatrix(const cMatrixf &a_mtxProj, const cMatrixf &a_mtxView, float a_fFarPlane, float a_fNearPlane, float a_fFOV, float a_fAspect, const cVector3f &a_vOrigin, bool a_bInfFarPlane) { m_mtxViewProj = cMath::MatrixMul(a_mtxProj, a_mtxView); m_mtxModelView = a_mtxView; m_fFarPlane = a_fFarPlane; m_fNearPlane = a_fNearPlane; m_fFOV = a_fFOV; m_fAspect = a_fAspect; m_vOrigin = a_vOrigin; m_bInfFarPlane = a_bInfFarPlane; m_OriginBV.SetSize(a_fNearPlane*2); m_OriginBV.SetPosition(m_vOrigin); UpdatePlanes(); UpdateSphere(); UpdateEndPoints(); UpdateBV(); }
void VisitPointTool::Translate(CB_ENUM e, int ctrl, int shift, int x, int y, int) { if (axisTranslate == none) { if (shift && !ctrl) if (window3D) axisTranslate = inAndOut; else axisTranslate = none; else if (shift && ctrl) axisTranslate = leftAndRight; else if (ctrl) axisTranslate = upAndDown; else axisTranslate = none; } if(e == CB_START) { vtkRenderer *ren = proxy.GetCanvas(); vtkCamera *camera = ren->GetActiveCamera(); double ViewFocus[3]; camera->GetFocalPoint(ViewFocus); ComputeWorldToDisplay(ViewFocus[0], ViewFocus[1], ViewFocus[2], ViewFocus); // Store the focal depth. focalDepth = ViewFocus[2]; if (axisTranslate != none) { translationDistance = ComputeTranslationDistance(axisTranslate); } // Make the right actors active. InitialActorSetup(); } else if(e == CB_MIDDLE) { avtVector newPoint = ComputeDisplayToWorld(avtVector(x,y,focalDepth)); // // Have to recalculate the old mouse point since the viewport has // moved, so we can't move it outside the loop // avtVector oldPoint = ComputeDisplayToWorld(avtVector(lastX,lastY,focalDepth)); avtVector motion(newPoint - oldPoint); if (axisTranslate) { double delta; if (axisTranslate == leftAndRight) delta = x - lastX; else delta = y - lastY; motion = translationDistance * delta; } hotPoints[0].pt = (hotPoints[0].pt + motion); // Update the text actors. UpdateText(); // Update the guide and the sphere. UpdateGuide(); UpdateSphere(); // Render the window proxy.Render(); if (proxy.GetToolUpdateMode() == UPDATE_CONTINUOUS) CallCallback(); } else { // Call the tool's callback. if (proxy.GetToolUpdateMode() != UPDATE_ONCLOSE) CallCallback(); // Remove the right actors. FinalActorSetup(); axisTranslate = none; } }