|
@@ -34,7 +34,6 @@ THE SOFTWARE.
|
|
|
#include "CmRenderSystemManager.h"
|
|
#include "CmRenderSystemManager.h"
|
|
|
|
|
|
|
|
namespace Ogre {
|
|
namespace Ogre {
|
|
|
- OrientationMode Viewport::mDefaultOrientationMode = OR_DEGREE_0;
|
|
|
|
|
//---------------------------------------------------------------------
|
|
//---------------------------------------------------------------------
|
|
|
Viewport::Viewport(RenderTarget* target, Real left, Real top, Real width, Real height, int ZOrder)
|
|
Viewport::Viewport(RenderTarget* target, Real left, Real top, Real width, Real height, int ZOrder)
|
|
|
:mTarget(target)
|
|
:mTarget(target)
|
|
@@ -47,17 +46,7 @@ namespace Ogre {
|
|
|
, mBackColour(ColourValue::Black)
|
|
, mBackColour(ColourValue::Black)
|
|
|
, mClearEveryFrame(true)
|
|
, mClearEveryFrame(true)
|
|
|
, mClearBuffers(FBT_COLOUR | FBT_DEPTH)
|
|
, mClearBuffers(FBT_COLOUR | FBT_DEPTH)
|
|
|
- , mUpdated(false)
|
|
|
|
|
- , mShowOverlays(true)
|
|
|
|
|
- , mShowSkies(true)
|
|
|
|
|
- , mShowShadows(true)
|
|
|
|
|
- , mVisibilityMask(0xFFFFFFFF)
|
|
|
|
|
- , mMaterialSchemeName("NotUsedInPort")
|
|
|
|
|
- , mIsAutoUpdated(true)
|
|
|
|
|
{
|
|
{
|
|
|
- // Set the default orientation mode
|
|
|
|
|
- mOrientationMode = mDefaultOrientationMode;
|
|
|
|
|
-
|
|
|
|
|
// Calculate actual dimensions
|
|
// Calculate actual dimensions
|
|
|
_updateDimensions();
|
|
_updateDimensions();
|
|
|
}
|
|
}
|
|
@@ -65,16 +54,6 @@ namespace Ogre {
|
|
|
Viewport::~Viewport()
|
|
Viewport::~Viewport()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- bool Viewport::_isUpdated(void) const
|
|
|
|
|
- {
|
|
|
|
|
- return mUpdated;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::_clearUpdatedFlag(void)
|
|
|
|
|
- {
|
|
|
|
|
- mUpdated = false;
|
|
|
|
|
}
|
|
}
|
|
|
//---------------------------------------------------------------------
|
|
//---------------------------------------------------------------------
|
|
|
void Viewport::_updateDimensions(void)
|
|
void Viewport::_updateDimensions(void)
|
|
@@ -86,8 +65,6 @@ namespace Ogre {
|
|
|
mActTop = (int) (mRelTop * height);
|
|
mActTop = (int) (mRelTop * height);
|
|
|
mActWidth = (int) (mRelWidth * width);
|
|
mActWidth = (int) (mRelWidth * width);
|
|
|
mActHeight = (int) (mRelHeight * height);
|
|
mActHeight = (int) (mRelHeight * height);
|
|
|
-
|
|
|
|
|
- mUpdated = true;
|
|
|
|
|
}
|
|
}
|
|
|
//---------------------------------------------------------------------
|
|
//---------------------------------------------------------------------
|
|
|
int Viewport::getZOrder(void) const
|
|
int Viewport::getZOrder(void) const
|
|
@@ -152,60 +129,6 @@ namespace Ogre {
|
|
|
void Viewport::update(void)
|
|
void Viewport::update(void)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::setOrientationMode(OrientationMode orientationMode, bool setDefault)
|
|
|
|
|
- {
|
|
|
|
|
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE != 0
|
|
|
|
|
- OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
|
|
|
|
|
- "Setting Viewport orientation mode is not supported",
|
|
|
|
|
- __FUNCTION__);
|
|
|
|
|
-#endif
|
|
|
|
|
- mOrientationMode = orientationMode;
|
|
|
|
|
-
|
|
|
|
|
- if (setDefault)
|
|
|
|
|
- {
|
|
|
|
|
- setDefaultOrientationMode(orientationMode);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Update the render system config
|
|
|
|
|
- RenderSystem* rs = CamelotEngine::RenderSystemManager::getActive();
|
|
|
|
|
- if(mOrientationMode == OR_LANDSCAPELEFT)
|
|
|
|
|
- rs->setConfigOption("Orientation", "Landscape Left");
|
|
|
|
|
- else if(mOrientationMode == OR_LANDSCAPERIGHT)
|
|
|
|
|
- rs->setConfigOption("Orientation", "Landscape Right");
|
|
|
|
|
- else if(mOrientationMode == OR_PORTRAIT)
|
|
|
|
|
- rs->setConfigOption("Orientation", "Portrait");
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- OrientationMode Viewport::getOrientationMode() const
|
|
|
|
|
- {
|
|
|
|
|
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE != 0
|
|
|
|
|
- OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
|
|
|
|
|
- "Getting Viewport orientation mode is not supported",
|
|
|
|
|
- __FUNCTION__);
|
|
|
|
|
-#endif
|
|
|
|
|
- return mOrientationMode;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::setDefaultOrientationMode(OrientationMode orientationMode)
|
|
|
|
|
- {
|
|
|
|
|
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE != 0
|
|
|
|
|
- OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
|
|
|
|
|
- "Setting default Viewport orientation mode is not supported",
|
|
|
|
|
- __FUNCTION__);
|
|
|
|
|
-#endif
|
|
|
|
|
- mDefaultOrientationMode = orientationMode;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- OrientationMode Viewport::getDefaultOrientationMode()
|
|
|
|
|
- {
|
|
|
|
|
-#if OGRE_NO_VIEWPORT_ORIENTATIONMODE != 0
|
|
|
|
|
- OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
|
|
|
|
|
- "Getting default Viewport orientation mode is not supported",
|
|
|
|
|
- __FUNCTION__);
|
|
|
|
|
-#endif
|
|
|
|
|
- return mDefaultOrientationMode;
|
|
|
|
|
}
|
|
}
|
|
|
//---------------------------------------------------------------------
|
|
//---------------------------------------------------------------------
|
|
|
void Viewport::setBackgroundColour(const ColourValue& colour)
|
|
void Viewport::setBackgroundColour(const ColourValue& colour)
|
|
@@ -259,77 +182,6 @@ namespace Ogre {
|
|
|
width = mActWidth;
|
|
width = mActWidth;
|
|
|
height = mActHeight;
|
|
height = mActHeight;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::setAutoUpdated(bool inAutoUpdated)
|
|
|
|
|
- {
|
|
|
|
|
- mIsAutoUpdated = inAutoUpdated;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- bool Viewport::isAutoUpdated() const
|
|
|
|
|
- {
|
|
|
|
|
- return mIsAutoUpdated;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::setOverlaysEnabled(bool enabled)
|
|
|
|
|
- {
|
|
|
|
|
- mShowOverlays = enabled;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- bool Viewport::getOverlaysEnabled(void) const
|
|
|
|
|
- {
|
|
|
|
|
- return mShowOverlays;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::setSkiesEnabled(bool enabled)
|
|
|
|
|
- {
|
|
|
|
|
- mShowSkies = enabled;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- bool Viewport::getSkiesEnabled(void) const
|
|
|
|
|
- {
|
|
|
|
|
- return mShowSkies;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- void Viewport::setShadowsEnabled(bool enabled)
|
|
|
|
|
- {
|
|
|
|
|
- mShowShadows = enabled;
|
|
|
|
|
- }
|
|
|
|
|
- //---------------------------------------------------------------------
|
|
|
|
|
- bool Viewport::getShadowsEnabled(void) const
|
|
|
|
|
- {
|
|
|
|
|
- return mShowShadows;
|
|
|
|
|
- }
|
|
|
|
|
- //-----------------------------------------------------------------------
|
|
|
|
|
- void Viewport::pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv)
|
|
|
|
|
- {
|
|
|
|
|
- pointOrientedToScreen(v.x, v.y, orientationMode, outv.x, outv.y);
|
|
|
|
|
- }
|
|
|
|
|
- //-----------------------------------------------------------------------
|
|
|
|
|
- void Viewport::pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode,
|
|
|
|
|
- Real &screenX, Real &screenY)
|
|
|
|
|
- {
|
|
|
|
|
- Real orX = orientedX;
|
|
|
|
|
- Real orY = orientedY;
|
|
|
|
|
- switch (orientationMode)
|
|
|
|
|
- {
|
|
|
|
|
- case 1:
|
|
|
|
|
- screenX = orY;
|
|
|
|
|
- screenY = Real(1.0) - orX;
|
|
|
|
|
- break;
|
|
|
|
|
- case 2:
|
|
|
|
|
- screenX = Real(1.0) - orX;
|
|
|
|
|
- screenY = Real(1.0) - orY;
|
|
|
|
|
- break;
|
|
|
|
|
- case 3:
|
|
|
|
|
- screenX = Real(1.0) - orY;
|
|
|
|
|
- screenY = orX;
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- screenX = orX;
|
|
|
|
|
- screenY = orY;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
//-----------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------
|
|
|
}
|
|
}
|