PageRenderTime 49ms CodeModel.GetById 18ms app.highlight 26ms RepoModel.GetById 1ms 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
  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
 27#ifndef LL_LLFLOATERIMAGEPREVIEW_H
 28#define LL_LLFLOATERIMAGEPREVIEW_H
 29
 30#include "llfloaternamedesc.h"
 31#include "lldynamictexture.h"
 32#include "llpointer.h"
 33#include "llquaternion.h"
 34
 35class LLComboBox;
 36class LLJoint;
 37class LLViewerJointMesh;
 38class LLVOAvatar;
 39class LLTextBox;
 40class LLVertexBuffer;
 41class LLVolume;
 42
 43class LLImagePreviewSculpted : public LLViewerDynamicTexture
 44{
 45protected:
 46	virtual ~LLImagePreviewSculpted();
 47
 48 public:
 49	LLImagePreviewSculpted(S32 width, S32 height);	
 50
 51	/*virtual*/ S8 getType() const ;
 52
 53	void setPreviewTarget(LLImageRaw *imagep, F32 distance);
 54	void setTexture(U32 name) { mTextureName = name; }
 55
 56	BOOL render();
 57	void refresh();
 58	void rotate(F32 yaw_radians, F32 pitch_radians);
 59	void zoom(F32 zoom_amt);
 60	void pan(F32 right, F32 up);
 61	virtual BOOL needsRender() { return mNeedsUpdate; }
 62
 63 protected:
 64	BOOL        mNeedsUpdate;
 65	U32         mTextureName;
 66	F32			mCameraDistance;
 67	F32			mCameraYaw;
 68	F32			mCameraPitch;
 69	F32			mCameraZoom;
 70	LLVector3	mCameraOffset;
 71	LLPointer<LLVolume> mVolume;
 72	LLPointer<LLVertexBuffer> mVertexBuffer;
 73};
 74
 75
 76class LLImagePreviewAvatar : public LLViewerDynamicTexture
 77{
 78protected:
 79	virtual ~LLImagePreviewAvatar();
 80
 81public:
 82	LLImagePreviewAvatar(S32 width, S32 height);	
 83
 84	/*virtual*/ S8 getType() const ;
 85
 86	void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male);
 87	void setTexture(U32 name) { mTextureName = name; }
 88	void clearPreviewTexture(const std::string& mesh_name);
 89
 90	BOOL	render();
 91	void	refresh();
 92	void	rotate(F32 yaw_radians, F32 pitch_radians);
 93	void	zoom(F32 zoom_amt);
 94	void	pan(F32 right, F32 up);
 95	virtual BOOL needsRender() { return mNeedsUpdate; }
 96
 97protected:
 98	BOOL		mNeedsUpdate;
 99	LLJoint*	mTargetJoint;
100	LLViewerJointMesh*	mTargetMesh;
101	F32			mCameraDistance;
102	F32			mCameraYaw;
103	F32			mCameraPitch;
104	F32			mCameraZoom;
105	LLVector3	mCameraOffset;
106	LLPointer<LLVOAvatar> mDummyAvatar;
107	U32			mTextureName;
108};
109
110class LLFloaterImagePreview : public LLFloaterNameDesc
111{
112public:
113	LLFloaterImagePreview(const std::string& filename);
114	virtual ~LLFloaterImagePreview();
115
116	virtual BOOL postBuild();
117	
118	BOOL handleMouseDown(S32 x, S32 y, MASK mask);
119	BOOL handleMouseUp(S32 x, S32 y, MASK mask);
120	BOOL handleHover(S32 x, S32 y, MASK mask);
121	BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); 
122
123	static void onMouseCaptureLostImagePreview(LLMouseHandler*);
124
125	void clearAllPreviewTextures();
126
127protected:
128	static void		onPreviewTypeCommit(LLUICtrl*,void*);
129	void			draw();
130	bool			loadImage(const std::string& filename);
131
132	LLPointer<LLImageRaw> mRawImagep;
133	LLPointer<LLImagePreviewAvatar> mAvatarPreview;
134	LLPointer<LLImagePreviewSculpted> mSculptedPreview;
135	S32				mLastMouseX;
136	S32				mLastMouseY;
137	LLRect			mPreviewRect;
138	LLRectf			mPreviewImageRect;
139	LLPointer<LLViewerTexture> mImagep ;
140	
141	std::string mImageLoadError;
142};
143
144#endif  // LL_LLFLOATERIMAGEPREVIEW_H