guiOffscreenCanvas.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _GUIOFFSCREENCANVAS_H_
  2. #define _GUIOFFSCREENCANVAS_H_
  3. #include "math/mMath.h"
  4. #include "gui/core/guiCanvas.h"
  5. #include "core/util/tVector.h"
  6. #ifndef _MATTEXTURETARGET_H_
  7. #include "materials/matTextureTarget.h"
  8. #endif
  9. class GuiTextureDebug;
  10. class GuiOffscreenCanvas : public GuiCanvas
  11. {
  12. public:
  13. typedef GuiCanvas Parent;
  14. GuiOffscreenCanvas();
  15. ~GuiOffscreenCanvas();
  16. bool onAdd() override;
  17. void onRemove() override;
  18. void renderFrame(bool preRenderOnly, bool bufferSwap) override;
  19. virtual void onFrameRendered();
  20. Point2I getWindowSize() override;
  21. Point2I getCursorPos() override;
  22. void setCursorPos(const Point2I &pt) override;
  23. void showCursor(bool state) override;
  24. bool isCursorShown() override;
  25. void _onTextureEvent( GFXTexCallbackCode code );
  26. void _setupTargets();
  27. void _teardownTargets();
  28. NamedTexTargetRef getTarget() { return &mNamedTarget; }
  29. bool canInteract() { return mCanInteract; }
  30. F32 getMaxInteractDistance() { return mMaxInteractDistance; }
  31. void markDirty() { mTargetDirty = true; }
  32. static void initPersistFields();
  33. DECLARE_CONOBJECT(GuiOffscreenCanvas);
  34. protected:
  35. GFXTextureTargetRef mTarget;
  36. NamedTexTarget mNamedTarget;
  37. GFXTexHandle mTargetTexture;
  38. GFXFormat mTargetFormat;
  39. Point2I mTargetSize;
  40. String mTargetName;
  41. bool mTargetDirty;
  42. bool mDynamicTarget;
  43. bool mUseDepth;
  44. GFXTexHandle mTargetDepth;
  45. bool mCanInteract;
  46. F32 mMaxInteractDistance;
  47. public:
  48. static Vector<GuiOffscreenCanvas*> sList;
  49. static GuiOffscreenCanvas* sActiveOffscreenCanvas;
  50. };
  51. #endif