PageRenderTime 36ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llfloaterimagepreview.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 144 lines | 94 code | 25 blank | 25 comment | 0 complexity | 5c06cbf07a1c483c3cf636381031fe3d MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llfloaterimagepreview.h
  3. * @brief LLFloaterImagePreview class definition
  4. *
  5. * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLFLOATERIMAGEPREVIEW_H
  27. #define LL_LLFLOATERIMAGEPREVIEW_H
  28. #include "llfloaternamedesc.h"
  29. #include "lldynamictexture.h"
  30. #include "llpointer.h"
  31. #include "llquaternion.h"
  32. class LLComboBox;
  33. class LLJoint;
  34. class LLViewerJointMesh;
  35. class LLVOAvatar;
  36. class LLTextBox;
  37. class LLVertexBuffer;
  38. class LLVolume;
  39. class LLImagePreviewSculpted : public LLViewerDynamicTexture
  40. {
  41. protected:
  42. virtual ~LLImagePreviewSculpted();
  43. public:
  44. LLImagePreviewSculpted(S32 width, S32 height);
  45. /*virtual*/ S8 getType() const ;
  46. void setPreviewTarget(LLImageRaw *imagep, F32 distance);
  47. void setTexture(U32 name) { mTextureName = name; }
  48. BOOL render();
  49. void refresh();
  50. void rotate(F32 yaw_radians, F32 pitch_radians);
  51. void zoom(F32 zoom_amt);
  52. void pan(F32 right, F32 up);
  53. virtual BOOL needsRender() { return mNeedsUpdate; }
  54. protected:
  55. BOOL mNeedsUpdate;
  56. U32 mTextureName;
  57. F32 mCameraDistance;
  58. F32 mCameraYaw;
  59. F32 mCameraPitch;
  60. F32 mCameraZoom;
  61. LLVector3 mCameraOffset;
  62. LLPointer<LLVolume> mVolume;
  63. LLPointer<LLVertexBuffer> mVertexBuffer;
  64. };
  65. class LLImagePreviewAvatar : public LLViewerDynamicTexture
  66. {
  67. protected:
  68. virtual ~LLImagePreviewAvatar();
  69. public:
  70. LLImagePreviewAvatar(S32 width, S32 height);
  71. /*virtual*/ S8 getType() const ;
  72. void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male);
  73. void setTexture(U32 name) { mTextureName = name; }
  74. void clearPreviewTexture(const std::string& mesh_name);
  75. BOOL render();
  76. void refresh();
  77. void rotate(F32 yaw_radians, F32 pitch_radians);
  78. void zoom(F32 zoom_amt);
  79. void pan(F32 right, F32 up);
  80. virtual BOOL needsRender() { return mNeedsUpdate; }
  81. protected:
  82. BOOL mNeedsUpdate;
  83. LLJoint* mTargetJoint;
  84. LLViewerJointMesh* mTargetMesh;
  85. F32 mCameraDistance;
  86. F32 mCameraYaw;
  87. F32 mCameraPitch;
  88. F32 mCameraZoom;
  89. LLVector3 mCameraOffset;
  90. LLPointer<LLVOAvatar> mDummyAvatar;
  91. U32 mTextureName;
  92. };
  93. class LLFloaterImagePreview : public LLFloaterNameDesc
  94. {
  95. public:
  96. LLFloaterImagePreview(const std::string& filename);
  97. virtual ~LLFloaterImagePreview();
  98. virtual BOOL postBuild();
  99. BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  100. BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  101. BOOL handleHover(S32 x, S32 y, MASK mask);
  102. BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
  103. static void onMouseCaptureLostImagePreview(LLMouseHandler*);
  104. void clearAllPreviewTextures();
  105. protected:
  106. static void onPreviewTypeCommit(LLUICtrl*,void*);
  107. void draw();
  108. bool loadImage(const std::string& filename);
  109. LLPointer<LLImageRaw> mRawImagep;
  110. LLPointer<LLImagePreviewAvatar> mAvatarPreview;
  111. LLPointer<LLImagePreviewSculpted> mSculptedPreview;
  112. S32 mLastMouseX;
  113. S32 mLastMouseY;
  114. LLRect mPreviewRect;
  115. LLRectf mPreviewImageRect;
  116. LLPointer<LLViewerTexture> mImagep ;
  117. std::string mImageLoadError;
  118. };
  119. #endif // LL_LLFLOATERIMAGEPREVIEW_H