-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui3DProjectionCtrl.h
77 lines (58 loc) · 3.06 KB
/
gui3DProjectionCtrl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//-----------------------------------------------------------------------------
// Gui3DProjectionCtrl
// Doppelganger Inc
// Orion Elenzil 200701
//
//
//-----------------------------------------------------------------------------
#ifndef _GUI3DPROJECTIONCTRL_H_
#define _GUI3DPROJECTIONCTRL_H_
#include "gui/core/guiTypes.h"
#include "gui/core/guiControl.h"
#include "gui/3d/guiTSControl.h"
#include "scene/sceneObject.h"
#include "T3D/player.h"
class Gui3DProjectionCtrl : public GuiControl
{
//-----------------------------------------------------------------------------
// stock stuff
public:
Gui3DProjectionCtrl();
typedef GuiControl Parent;
DECLARE_CONOBJECT(Gui3DProjectionCtrl);
static void initPersistFields ();
//-----------------------------------------------------------------------------
// more interesting stuff
GuiTSCtrl* mTSCtrl; /// must be a child of one of these.
SimObjectPtr<SceneObject> mAttachedTo; /// optional object we're attached to.
SimObjectPtr<Player> mAttachedToPlayer; /// same pointer as mAttachedTo, but conveniently casted to player.
Point3F mPtWorld; /// the worldspace point which we're projecting
Point2I mPtProj; /// the screenspace projected point. - note there are further modifiers before
Point2I mPtScreen;
Point3F mOffsetObject; /// object-space offset applied first to the attached point to obtain mPtWorld.
Point3F mOffsetWorld; /// world-space offset applied second to the attached point to obtain mPtWorld.
Point2I mOffsetScreen; /// screen-space offset applied to mPtProj. note we still have centering, etc.
enum alignment
{
min = 0,
center = 1,
max = 2
};
alignment mHAlign; /// horizontal alignment
alignment mVAlign; /// horizontal alignment
bool mAutoDelete; /// optionally self-delete when mAttachedTo is deleted.
Point2I mUseEyePoint; /// optionally use the eye point. x != 0 -> horiz. y != 0 -> vert.
virtual void onRender (Point2I offset, const RectI &updateRect);
virtual void resizeDuringRender ();
virtual bool onWake ();
virtual void onSleep ();
virtual void onDeleteNotify (SimObject *object);
void doPositioning ();
void doProjection ();
void doAlignment ();
void setAttachedTo (SceneObject* obj);
SceneObject* getAttachedTo () { return mAttachedTo; }
void setWorldPt (Point3F& pt) { mPtWorld = pt; }
Point3F getWorldPt () { return mPtWorld; }
};
#endif //_GUI3DPROJECTIONCTRL_H_