00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2013 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 #ifndef __Viewport_H__ 00029 #define __Viewport_H__ 00030 00031 #include "OgrePrerequisites.h" 00032 #include "OgreCommon.h" 00033 #include "OgreColourValue.h" 00034 #include "OgreFrustum.h" 00035 #include "OgreHeaderPrefix.h" 00036 00037 namespace Ogre { 00057 class _OgreExport Viewport : public ViewportAlloc 00058 { 00059 public: 00061 class _OgreExport Listener 00062 { 00063 public: 00064 virtual ~Listener() {} 00065 00067 virtual void viewportCameraChanged(Viewport* viewport) {} 00068 00070 virtual void viewportDimensionsChanged(Viewport* viewport) {} 00071 00073 virtual void viewportDestroyed(Viewport* viewport) {} 00074 }; 00075 00091 Viewport( 00092 Camera* camera, 00093 RenderTarget* target, 00094 Real left, Real top, 00095 Real width, Real height, 00096 int ZOrder); 00097 00100 virtual ~Viewport(); 00101 00109 void _updateDimensions(void); 00110 00113 void update(void); 00114 00127 void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH, 00128 const ColourValue& colour = ColourValue::Black, 00129 Real depth = 1.0f, unsigned short stencil = 0); 00130 00133 RenderTarget* getTarget(void) const; 00134 00137 Camera* getCamera(void) const; 00138 00140 void setCamera(Camera* cam); 00141 00143 int getZOrder(void) const; 00147 Real getLeft(void) const; 00148 00152 Real getTop(void) const; 00153 00158 Real getWidth(void) const; 00163 Real getHeight(void) const; 00168 int getActualLeft(void) const; 00173 int getActualTop(void) const; 00177 int getActualWidth(void) const; 00182 int getActualHeight(void) const; 00183 00197 void setDimensions(Real left, Real top, Real width, Real height); 00198 00201 void setOrientationMode(OrientationMode orientationMode, bool setDefault = true); 00202 00205 OrientationMode getOrientationMode() const; 00206 00209 static void setDefaultOrientationMode(OrientationMode orientationMode); 00210 00213 static OrientationMode getDefaultOrientationMode(); 00214 00218 void setBackgroundColour(const ColourValue& colour); 00219 00222 const ColourValue& getBackgroundColour(void) const; 00223 00227 void setDepthClear( Real depth ); 00228 00231 Real getDepthClear(void) const; 00232 00242 void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH); 00243 00246 bool getClearEveryFrame(void) const; 00247 00249 unsigned int getClearBuffers(void) const; 00250 00262 void setAutoUpdated(bool autoupdate); 00266 bool isAutoUpdated() const; 00267 00275 void setMaterialScheme(const String& schemeName) 00276 { mMaterialSchemeName = schemeName; } 00277 00280 const String& getMaterialScheme(void) const 00281 { return mMaterialSchemeName; } 00282 00285 void getActualDimensions( 00286 int &left, int &top, int &width, int &height ) const; 00287 00288 bool _isUpdated(void) const; 00289 void _clearUpdatedFlag(void); 00290 00293 unsigned int _getNumRenderedFaces(void) const; 00294 00297 unsigned int _getNumRenderedBatches(void) const; 00298 00309 void setOverlaysEnabled(bool enabled); 00310 00313 bool getOverlaysEnabled(void) const; 00314 00325 void setSkiesEnabled(bool enabled); 00326 00329 bool getSkiesEnabled(void) const; 00330 00339 void setShadowsEnabled(bool enabled); 00340 00343 bool getShadowsEnabled(void) const; 00344 00345 00354 void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; } 00355 00359 uint getVisibilityMask(void) const { return mVisibilityMask; } 00360 00373 virtual void setRenderQueueInvocationSequenceName(const String& sequenceName); 00375 virtual const String& getRenderQueueInvocationSequenceName(void) const; 00377 RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void); 00378 00380 void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv); 00381 void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode, 00382 Real &screenX, Real &screenY); 00383 00385 void addListener(Listener* l); 00387 void removeListener(Listener* l); 00388 00389 protected: 00390 Camera* mCamera; 00391 RenderTarget* mTarget; 00393 float mRelLeft, mRelTop, mRelWidth, mRelHeight; 00395 int mActLeft, mActTop, mActWidth, mActHeight; 00397 int mZOrder; 00399 ColourValue mBackColour; 00400 Real mDepthClearValue; 00401 bool mClearEveryFrame; 00402 unsigned int mClearBuffers; 00403 bool mUpdated; 00404 bool mShowOverlays; 00405 bool mShowSkies; 00406 bool mShowShadows; 00407 uint32 mVisibilityMask; 00408 // Render queue invocation sequence name 00409 String mRQSequenceName; 00410 RenderQueueInvocationSequence* mRQSequence; 00412 String mMaterialSchemeName; 00414 OrientationMode mOrientationMode; 00415 static OrientationMode mDefaultOrientationMode; 00416 00418 bool mIsAutoUpdated; 00419 00420 typedef vector<Listener*>::type ListenerList; 00421 ListenerList mListeners; 00422 }; 00426 } 00427 00428 #include "OgreHeaderSuffix.h" 00429 00430 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:48