You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
#ifndef NMVTKPIVOTCAMERAINTERACTORSTYLE_H
|
|
#define NMVTKPIVOTCAMERAINTERACTORSTYLE_H
|
|
|
|
#include "nmRender_global.h"
|
|
|
|
#include <vtkInteractorStyleTrackballCamera.h>
|
|
|
|
class nmVTKCameraController;
|
|
|
|
/**
|
|
* @brief 使用独立世界坐标枢轴的 TrackballCamera 交互样式。
|
|
*
|
|
* Rotate 和 Spin 将相机位置、焦点及 ViewUp 作为刚体绕独立枢轴变换,
|
|
* 不要求枢轴等于 vtkCamera::FocalPoint。Pan、Dolly 和滚轮行为继续复用
|
|
* VTK 7.1 的默认实现。
|
|
*/
|
|
class NM_RENDER_EXPORT nmVTKPivotCameraInteractorStyle
|
|
: public vtkInteractorStyleTrackballCamera
|
|
{
|
|
public:
|
|
static nmVTKPivotCameraInteractorStyle* New();
|
|
vtkTypeMacro(nmVTKPivotCameraInteractorStyle,
|
|
vtkInteractorStyleTrackballCamera);
|
|
|
|
/** @brief 绑定旋转中心状态提供者;不增加其所有权。 */
|
|
void setCameraController(nmVTKCameraController* pController);
|
|
/** @brief 返回当前旋转中心状态提供者的非所有权指针。 */
|
|
nmVTKCameraController* getCameraController() const;
|
|
|
|
/** @brief 按 VTK Trackball 灵敏度绕独立枢轴执行水平和垂直旋转。 */
|
|
virtual void Rotate();
|
|
/** @brief 绕穿过独立枢轴的观察方向轴执行屏幕内旋转。 */
|
|
virtual void Spin();
|
|
|
|
protected:
|
|
nmVTKPivotCameraInteractorStyle();
|
|
virtual ~nmVTKPivotCameraInteractorStyle();
|
|
|
|
private:
|
|
nmVTKPivotCameraInteractorStyle(
|
|
const nmVTKPivotCameraInteractorStyle&);
|
|
void operator=(const nmVTKPivotCameraInteractorStyle&);
|
|
|
|
/** @brief 查询与当前 Renderer 匹配的有限旋转中心。 */
|
|
bool getCurrentRotationCenter(double dCenter[3]) const;
|
|
/** @brief 写回相机姿态、维护裁剪和灯光,并提交一次交互渲染。 */
|
|
void finishCameraMotion(const double dPosition[3],
|
|
const double dFocalPoint[3],
|
|
const double dViewUp[3]);
|
|
|
|
nmVTKCameraController* m_pCameraController; ///< 非所有权指针。
|
|
};
|
|
|
|
#endif // NMVTKPIVOTCAMERAINTERACTORSTYLE_H
|