2016-03-10 03:47:37 +00:00
|
|
|
#ifndef __URDE_CGUICAMERA_HPP__
|
|
|
|
#define __URDE_CGUICAMERA_HPP__
|
|
|
|
|
|
|
|
#include "CGuiWidget.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2017-01-22 01:40:12 +00:00
|
|
|
class CSimplePool;
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-12 04:58:56 +00:00
|
|
|
class CGuiCamera : public CGuiWidget
|
|
|
|
{
|
|
|
|
public:
|
2016-06-23 19:40:09 +00:00
|
|
|
enum class EProjection
|
2016-03-12 04:58:56 +00:00
|
|
|
{
|
|
|
|
Perspective,
|
|
|
|
Orthographic
|
|
|
|
};
|
|
|
|
private:
|
2017-04-02 03:03:37 +00:00
|
|
|
EProjection xb8_proj;
|
2016-03-16 03:37:51 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2017-04-02 03:03:37 +00:00
|
|
|
float xbc_left;
|
|
|
|
float xc0_right;
|
|
|
|
float xc4_top;
|
|
|
|
float xc8_bottom;
|
|
|
|
float xcc_znear;
|
|
|
|
float xd0_zfar;
|
2016-03-16 03:37:51 +00:00
|
|
|
};
|
2017-02-15 06:02:30 +00:00
|
|
|
struct
|
|
|
|
{
|
2017-04-02 03:03:37 +00:00
|
|
|
float xbc_fov;
|
|
|
|
float xc0_aspect;
|
|
|
|
float xc4_znear;
|
|
|
|
float xc8_zfar;
|
2017-02-15 06:02:30 +00:00
|
|
|
};
|
2016-03-16 03:37:51 +00:00
|
|
|
};
|
2016-03-12 04:58:56 +00:00
|
|
|
public:
|
2016-03-16 03:37:51 +00:00
|
|
|
CGuiCamera(const CGuiWidgetParms& parms, float left, float right,
|
|
|
|
float top, float bottom,
|
|
|
|
float znear, float zfar);
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiCamera(const CGuiWidgetParms& parms, float fov, float aspect, float znear, float zfar);
|
2017-01-29 03:58:16 +00:00
|
|
|
FourCC GetWidgetTypeID() const { return FOURCC('CAMR'); }
|
|
|
|
|
2017-01-22 01:40:12 +00:00
|
|
|
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
|
2016-03-16 03:37:51 +00:00
|
|
|
|
|
|
|
zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f& vec) const;
|
2017-04-02 03:03:37 +00:00
|
|
|
void SetFov(float fov) { xbc_fov = fov; }
|
2016-03-16 03:37:51 +00:00
|
|
|
void Draw(const CGuiWidgetDrawParms& parms) const;
|
2017-01-22 01:40:12 +00:00
|
|
|
|
|
|
|
std::shared_ptr<CGuiCamera> shared_from_this()
|
|
|
|
{ return std::static_pointer_cast<CGuiCamera>(CGuiObject::shared_from_this()); }
|
2016-03-12 04:58:56 +00:00
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CGUICAMERA_HPP__
|