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-2011 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 00036 namespace Ogre { 00056 class _OgreExport Viewport : public ViewportAlloc 00057 { 00058 public: 00081 Viewport( 00082 Camera* camera, 00083 RenderTarget* target, 00084 Real left, Real top, 00085 Real width, Real height, 00086 int ZOrder); 00087 00090 virtual ~Viewport(); 00091 00099 void _updateDimensions(void); 00100 00103 void update(void); 00104 00117 void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH, 00118 const ColourValue& colour = ColourValue::Black, 00119 Real depth = 1.0f, unsigned short stencil = 0); 00120 00123 RenderTarget* getTarget(void) const; 00124 00127 Camera* getCamera(void) const; 00128 00130 void setCamera(Camera* cam); 00131 00133 int getZOrder(void) const; 00137 Real getLeft(void) const; 00138 00142 Real getTop(void) const; 00143 00148 Real getWidth(void) const; 00153 Real getHeight(void) const; 00158 int getActualLeft(void) const; 00163 int getActualTop(void) const; 00167 int getActualWidth(void) const; 00172 int getActualHeight(void) const; 00173 00186 void setDimensions(Real left, Real top, Real width, Real height); 00187 00190 void setOrientationMode(OrientationMode orientationMode, bool setDefault = true); 00191 00194 OrientationMode getOrientationMode() const; 00195 00198 static void setDefaultOrientationMode(OrientationMode orientationMode); 00199 00202 static OrientationMode getDefaultOrientationMode(); 00203 00207 void setBackgroundColour(const ColourValue& colour); 00208 00211 const ColourValue& getBackgroundColour(void) const; 00212 00222 void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH); 00223 00226 bool getClearEveryFrame(void) const; 00227 00229 unsigned int getClearBuffers(void) const; 00230 00242 void setAutoUpdated(bool autoupdate); 00246 bool isAutoUpdated() const; 00247 00255 void setMaterialScheme(const String& schemeName) 00256 { mMaterialSchemeName = schemeName; } 00257 00260 const String& getMaterialScheme(void) const 00261 { return mMaterialSchemeName; } 00262 00265 void getActualDimensions( 00266 int &left, int &top, int &width, int &height ) const; 00267 00268 bool _isUpdated(void) const; 00269 void _clearUpdatedFlag(void); 00270 00273 unsigned int _getNumRenderedFaces(void) const; 00274 00277 unsigned int _getNumRenderedBatches(void) const; 00278 00289 void setOverlaysEnabled(bool enabled); 00290 00293 bool getOverlaysEnabled(void) const; 00294 00305 void setSkiesEnabled(bool enabled); 00306 00309 bool getSkiesEnabled(void) const; 00310 00319 void setShadowsEnabled(bool enabled); 00320 00323 bool getShadowsEnabled(void) const; 00324 00325 00334 void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; } 00335 00339 uint getVisibilityMask(void) const { return mVisibilityMask; } 00340 00353 virtual void setRenderQueueInvocationSequenceName(const String& sequenceName); 00355 virtual const String& getRenderQueueInvocationSequenceName(void) const; 00357 RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void); 00358 00360 void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv); 00361 void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode, 00362 Real &screenX, Real &screenY); 00363 00364 protected: 00365 Camera* mCamera; 00366 RenderTarget* mTarget; 00367 // Relative dimensions, irrespective of target dimensions (0..1) 00368 float mRelLeft, mRelTop, mRelWidth, mRelHeight; 00369 // Actual dimensions, based on target dimensions 00370 int mActLeft, mActTop, mActWidth, mActHeight; 00372 int mZOrder; 00374 ColourValue mBackColour; 00375 bool mClearEveryFrame; 00376 unsigned int mClearBuffers; 00377 bool mUpdated; 00378 bool mShowOverlays; 00379 bool mShowSkies; 00380 bool mShowShadows; 00381 uint32 mVisibilityMask; 00382 // Render queue invocation sequence name 00383 String mRQSequenceName; 00384 RenderQueueInvocationSequence* mRQSequence; 00386 String mMaterialSchemeName; 00388 OrientationMode mOrientationMode; 00389 static OrientationMode mDefaultOrientationMode; 00390 00392 bool mIsAutoUpdated; 00393 }; 00397 } 00398 00399 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sat Jan 14 2012 18:40:44