00001 00032 #ifndef LL_LLFLOATERIMAGEPREVIEW_H 00033 #define LL_LLFLOATERIMAGEPREVIEW_H 00034 00035 #include "llfloaternamedesc.h" 00036 #include "lldynamictexture.h" 00037 #include "llquaternion.h" 00038 00039 class LLComboBox; 00040 class LLJoint; 00041 class LLViewerJointMesh; 00042 class LLVOAvatar; 00043 class LLTextBox; 00044 00045 class LLImagePreviewSculpted : public LLDynamicTexture 00046 { 00047 public: 00048 LLImagePreviewSculpted(S32 width, S32 height); 00049 virtual ~LLImagePreviewSculpted(); 00050 00051 void setPreviewTarget(LLImageRaw *imagep, F32 distance); 00052 void setTexture(U32 name) { mTextureName = name; } 00053 00054 BOOL render(); 00055 void refresh(); 00056 void rotate(F32 yaw_radians, F32 pitch_radians); 00057 void zoom(F32 zoom_amt); 00058 void pan(F32 right, F32 up); 00059 virtual BOOL needsRender() { return mNeedsUpdate; } 00060 00061 protected: 00062 BOOL mNeedsUpdate; 00063 U32 mTextureName; 00064 F32 mCameraDistance; 00065 F32 mCameraYaw; 00066 F32 mCameraPitch; 00067 F32 mCameraZoom; 00068 LLVector3 mCameraOffset; 00069 LLPointer<LLVolume> mVolume; 00070 }; 00071 00072 00073 class LLImagePreviewAvatar : public LLDynamicTexture 00074 { 00075 public: 00076 LLImagePreviewAvatar(S32 width, S32 height); 00077 virtual ~LLImagePreviewAvatar(); 00078 00079 void setPreviewTarget(const char* joint_name, const char *mesh_name, LLImageRaw* imagep, F32 distance, BOOL male); 00080 void setTexture(U32 name) { mTextureName = name; } 00081 00082 BOOL render(); 00083 void refresh(); 00084 void rotate(F32 yaw_radians, F32 pitch_radians); 00085 void zoom(F32 zoom_amt); 00086 void pan(F32 right, F32 up); 00087 virtual BOOL needsRender() { return mNeedsUpdate; } 00088 00089 protected: 00090 BOOL mNeedsUpdate; 00091 LLJoint* mTargetJoint; 00092 LLViewerJointMesh* mTargetMesh; 00093 F32 mCameraDistance; 00094 F32 mCameraYaw; 00095 F32 mCameraPitch; 00096 F32 mCameraZoom; 00097 LLVector3 mCameraOffset; 00098 LLPointer<LLVOAvatar> mDummyAvatar; 00099 U32 mTextureName; 00100 }; 00101 00102 class LLFloaterImagePreview : public LLFloaterNameDesc 00103 { 00104 public: 00105 LLFloaterImagePreview(const char* filename); 00106 virtual ~LLFloaterImagePreview(); 00107 00108 virtual BOOL postBuild(); 00109 00110 BOOL handleMouseDown(S32 x, S32 y, MASK mask); 00111 BOOL handleMouseUp(S32 x, S32 y, MASK mask); 00112 BOOL handleHover(S32 x, S32 y, MASK mask); 00113 BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); 00114 00115 static void onMouseCaptureLost(LLMouseHandler*); 00116 static void setUploadAmount(S32 amount) { sUploadAmount = amount; } 00117 00118 protected: 00119 static void onPreviewTypeCommit(LLUICtrl*,void*); 00120 void draw(); 00121 bool loadImage(const char* filename); 00122 00123 LLPointer<LLImageRaw> mRawImagep; 00124 LLImagePreviewAvatar* mAvatarPreview; 00125 LLImagePreviewSculpted* mSculptedPreview; 00126 S32 mLastMouseX; 00127 S32 mLastMouseY; 00128 LLRect mPreviewRect; 00129 LLRectf mPreviewImageRect; 00130 GLuint mGLName; 00131 00132 static S32 sUploadAmount; 00133 }; 00134 00135 #endif // LL_LLFLOATERIMAGEPREVIEW_H