leocad/common/view.h
2014-05-03 06:08:52 +00:00

56 lines
1.3 KiB
C++

#ifndef _VIEW_H_
#define _VIEW_H_
#include "lc_glwidget.h"
class Project;
class View : public lcGLWidget
{
public:
View(Project *project);
virtual ~View();
void OnDraw();
void OnInitialUpdate();
void OnUpdateCursor();
void OnLeftButtonDown();
void OnLeftButtonUp();
void OnLeftButtonDoubleClick();
void OnMiddleButtonDown();
void OnMiddleButtonUp();
void OnRightButtonDown();
void OnRightButtonUp();
void OnMouseMove();
void OnMouseWheel(float Direction);
void SetCamera(Camera* camera, bool ForceCopy);
void SetDefaultCamera();
lcMatrix44 GetProjectionMatrix() const;
LC_CURSOR_TYPE GetCursor() const;
Project* m_Project;
Camera* mCamera;
float m_OverlayScale;
lcVector3 ProjectPoint(const lcVector3& Point) const
{
int Viewport[4] = { 0, 0, mWidth, mHeight };
return lcProjectPoint(Point, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
}
lcVector3 UnprojectPoint(const lcVector3& Point) const
{
int Viewport[4] = { 0, 0, mWidth, mHeight };
return lcUnprojectPoint(Point, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
}
void UnprojectPoints(lcVector3* Points, int NumPoints) const
{
int Viewport[4] = { 0, 0, mWidth, mHeight };
lcUnprojectPoints(Points, NumPoints, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
}
};
#endif // _VIEW_H_