PageRenderTime 46ms CodeModel.GetById 2ms app.highlight 39ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/test_apps/llplugintest/llmediaplugintest.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 207 lines | 153 code | 23 blank | 31 comment | 0 complexity | 0d3b4563851a6d563ada1caee2f6b88a MD5 | raw file
  1/**
  2 * @file LLMediaPluginTest.cpp
  3 * @brief Primary test application for LLMedia (Separate Process) Plugin system
  4 *
  5 * $LicenseInfo:firstyear=2008&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_MEDIA_PLUGIN_TEST_H
 28#define LL_MEDIA_PLUGIN_TEST_H
 29
 30#include <vector>
 31#include <string>
 32#include "llpluginclassmedia.h"
 33#include "llgl.h"
 34
 35// Forward declarations
 36class GLUI_Rotation;
 37class GLUI_Translation;
 38class GLUI_Listbox;
 39class GLUI_EditText;
 40class GLUI_StaticText;
 41class GLUI;
 42class GLUI_Button;
 43
 44////////////////////////////////////////////////////////////////////////////////
 45//
 46struct mediaPanel
 47{
 48	public:
 49		mediaPanel();
 50		~mediaPanel();
 51		int mId;
 52		std::string mStartUrl;
 53		std::string mMimeType;
 54		std::string mTarget;
 55		LLPluginClassMedia *mMediaSource;
 56		int mMediaWidth;
 57		int mMediaHeight;
 58		int mTextureWidth;
 59		int mTextureHeight;
 60		double mTextureScaleX;
 61		double mTextureScaleY;
 62		GLuint mMediaTextureHandle;
 63		GLuint mPickTextureHandle;
 64		unsigned char* mPickTexturePixels;
 65		bool mAppTextureCoordsOpenGL;
 66		bool mReadyToRender;
 67};
 68
 69////////////////////////////////////////////////////////////////////////////////
 70//
 71class LLMediaPluginTest : public LLPluginClassMediaOwner
 72{
 73	public:
 74		LLMediaPluginTest( int app_window, int window_width, int window_height );
 75		~LLMediaPluginTest();
 76
 77		void reshape( int width, int height );
 78		void display();
 79		void idle();
 80		void gluiCallback( int control_id );
 81		void keyboard( int key );
 82		void mousePassive( int x, int y );
 83		void mouseButton( int button, int state, int x, int y );
 84		void mouseMove( int x, int y );
 85
 86		void bindTexture(GLuint texture, GLint row_length = 0, GLint alignment = 1);
 87		bool checkGLError(const char *name = "OpenGL");
 88		void drawGeometry( int panel, bool selected );
 89		void startPanelHighlight( float red, float green, float blue, float line_width );
 90		void endPanelHighlight();
 91		enum { DrawTypePickTexture, DrawTypeMediaTexture };
 92		void draw( int draw_type );
 93		void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id );
 94
 95		mediaPanel* addMediaPanel( std::string url );
 96		void updateMediaPanel( mediaPanel* panel );
 97		void remMediaPanel( mediaPanel* panel );
 98		mediaPanel* replaceMediaPanel( mediaPanel* panel, std::string url );
 99		void getRandomMediaSize( int& width, int& height, std::string mime_type );
100		void navigateToNewURI( std::string uri );
101        void initUrlHistory( std::string uri );
102		void selectPanelById( int id );
103		void selectPanel( mediaPanel* panel );
104		mediaPanel* findMediaPanel( LLPluginClassMedia* panel );
105		mediaPanel* findMediaPanel( const std::string &target_name );
106		void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels );
107		void makeChrome();
108		void resetView();
109
110		void dumpPanelInfo();
111		void updateStatusBar();
112
113		GLfloat distanceToCamera( GLfloat point_x, GLfloat point_y, GLfloat point_z );
114		
115
116	// Inherited from LLPluginClassMediaOwner
117	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent);
118
119	private:
120		const int mVersionMajor;
121		const int mVersionMinor;
122		const int mVersionPatch;
123		const int mMaxPanels;
124		int mAppWindow;
125		int mWindowWidth;
126		int mWindowHeight;
127		int mCurMouseX;
128		int mCurMouseY;
129		unsigned char mPixelReadColor[ 3 ];
130		bool mFuzzyMedia;
131		const std::string mHomeWebUrl;
132
133		std::vector< mediaPanel* > mMediaPanels;
134		mediaPanel* mSelectedPanel;
135		std::string mimeTypeFromUrl( std::string& url );
136		std::string pluginNameFromMimeType( std::string& mime_type );
137
138		GLUI_Rotation* mViewRotationCtrl;
139		GLUI_Translation* mViewScaleCtrl;
140		GLUI_Translation* mViewTranslationCtrl;
141		float mViewportAspect;
142		float mViewPos[ 3 ];
143		float mViewRotation[ 16 ];
144
145		float mDistanceCameraToSelectedGeometry;
146
147		int mIdControlAddPanel;
148		int mIdControlRemPanel;
149
150		std::vector< std::pair< std::string, std::string > > mBookmarks;
151		GLUI_Listbox* mBookmarkList;
152		int mIdBookmarks;
153		int mIdUrlEdit;
154		GLUI_EditText* mUrlEdit;
155        int mIdUrlInitHistoryEdit;
156		GLUI_EditText* mUrlInitHistoryEdit;
157		int mSelBookmark;
158		int mIdRandomPanelCount;
159		int mRandomPanelCount;
160		int mIdRandomBookmarks;
161		int mRandomBookmarks;
162		int mIdDisableTimeout;
163		int mDisableTimeout;
164		int mIdUsePluginReadThread;
165		int mUsePluginReadThread;
166		int mIdLargePanelSpacing;
167		int mLargePanelSpacing;
168		int mIdControlCrashPlugin;
169		int mIdControlHangPlugin;
170		int mIdControlExitApp;
171
172		GLUI* mGluiMediaTimeControlWindow;
173		int mIdMediaTimeControlPlay;
174		int mIdMediaTimeControlLoop;
175		int mIdMediaTimeControlPause;
176		int mIdMediaTimeControlStop;
177		int mIdMediaTimeControlSeek;
178		int mIdMediaTimeControlVolume;
179		int mMediaTimeControlVolume;
180		int mIdMediaTimeControlSeekSeconds;
181		int mMediaTimeControlSeekSeconds;
182		int mIdMediaTimeControlRewind;
183		int mIdMediaTimeControlFastForward;
184
185		GLUI* mGluiMediaBrowserControlWindow;
186		int mIdMediaBrowserControlBack;
187		GLUI_Button* mMediaBrowserControlBackButton;
188		int mIdMediaBrowserControlStop;
189		int mIdMediaBrowserControlForward;
190		GLUI_Button* mMediaBrowserControlForwardButton;
191		bool mGluiMediaTimeControlWindowFlag;
192		bool mGluiMediaBrowserControlWindowFlag;
193		bool mMediaBrowserControlBackButtonFlag;
194		bool mMediaBrowserControlForwardButtonFlag;
195		int mIdMediaBrowserControlHome;
196		int mIdMediaBrowserControlReload;
197		int mIdMediaBrowserControlClearCache;
198		int mIdMediaBrowserControlClearCookies;
199		int mIdMediaBrowserControlEnableCookies;
200		int mMediaBrowserControlEnableCookies;
201
202		GLUI* mBottomGLUIWindow;
203		GLUI_StaticText* mStatusText;
204};
205
206#endif	// LL_MEDIA_PLUGIN_TEST_H
207