gui3DProjectionCtrl.h 3.1 KB

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