Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #3286

Merged
merged 4 commits into from
Feb 9, 2025
Merged

Devel #3286

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions OgreMain/include/OgreCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,19 +397,19 @@ namespace Ogre {

/** Internal method to notify camera of the visible faces in the last render.
*/
void _notifyRenderedFaces(unsigned int numfaces);
void _notifyRenderedFaces(unsigned int numfaces) { mVisFacesLastRender = numfaces; }

/** Internal method to notify camera of the visible batches in the last render.
*/
void _notifyRenderedBatches(unsigned int numbatches);
void _notifyRenderedBatches(unsigned int numbatches) { mVisBatchesLastRender = numbatches; }

/** Internal method to retrieve the number of visible faces in the last render.
*/
unsigned int _getNumRenderedFaces(void) const;
unsigned int _getNumRenderedFaces(void) const { return mVisFacesLastRender; }

/** Internal method to retrieve the number of visible batches in the last render.
*/
unsigned int _getNumRenderedBatches(void) const;
unsigned int _getNumRenderedBatches(void) const { return mVisBatchesLastRender; }

/** Gets the derived orientation of the camera, including any
rotation inherited from a node attachment and reflection matrix. */
Expand Down
8 changes: 4 additions & 4 deletions OgreMain/include/OgreRenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,13 +716,13 @@ namespace Ogre
virtual void _setDepthClamp(bool enable) {}

/** The RenderSystem will keep a count of tris rendered, this resets the count. */
virtual void _beginGeometryCount(void);
void _beginGeometryCount(void);
/** Reports the number of tris rendered since the last _beginGeometryCount call. */
virtual unsigned int _getFaceCount(void) const;
unsigned int _getFaceCount(void) const { return static_cast<unsigned int>(mFaceCount); }
/** Reports the number of batches rendered since the last _beginGeometryCount call. */
virtual unsigned int _getBatchCount(void) const;
unsigned int _getBatchCount(void) const { return static_cast<unsigned int>(mBatchCount); }
/** Reports the number of vertices passed to the renderer since the last _beginGeometryCount call. */
virtual unsigned int _getVertexCount(void) const;
unsigned int _getVertexCount(void) const { return static_cast<unsigned int>(mVertexCount); }

/// @deprecated use ColourValue::getAsBYTE()
OGRE_DEPRECATED static void convertColourValue(const ColourValue& colour, uint32* pDest)
Expand Down
18 changes: 9 additions & 9 deletions OgreMain/include/OgreRenderTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ namespace Ogre {
viewports i.e. picture-in-picture). Higher Z-orders are on top of lower ones. The actual number
is irrelevant, only the relative Z-order matters (you can leave gaps in the numbering)
@param
left The relative position of the left of the viewport on the target, as a value between 0 and 1.
@param
top The relative position of the top of the viewport on the target, as a value between 0 and 1.
@param
width The relative width of the viewport on the target, as a value between 0 and 1.
@param
height The relative height of the viewport on the target, as a value between 0 and 1.
rect The relative position of the viewport on the target, as a value between 0 and 1.
*/
Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f ,
float width = 1.0f, float height = 1.0f);
Viewport* addViewport(Camera* cam, int ZOrder = 0, FloatRect rect = {0.0f, 0.0f, 1.0f, 1.0f});

/// @overload
Viewport* addViewport(Camera* cam, int ZOrder, float left, float top = 0.0f, float width = 1.0f,
float height = 1.0f)
{
return addViewport(cam, ZOrder, {left, top, left + width, top + height});
}

/** Returns the number of viewports attached to this target.*/
unsigned short getNumViewports(void) const { return static_cast<unsigned short>(mViewportList.size()); }
Expand Down
3 changes: 1 addition & 2 deletions OgreMain/include/OgreRenderTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ namespace Ogre
- Not all bound surfaces have the same size
- Not all bound surfaces have the same internal format
*/

virtual void bindSurface(size_t attachment, RenderTexture *target);
void bindSurface(size_t attachment, RenderTexture *target);

/** Unbind attachment.
*/
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ namespace Ogre {
@remarks The buffer is invalidated when the resource is unloaded or destroyed.
Do not use it after the lifetime of the containing texture.
*/
virtual const HardwarePixelBufferSharedPtr& getBuffer(size_t face=0, size_t mipmap=0);
virtual const HardwarePixelBufferSharedPtr& getBuffer(size_t face=0, size_t mipmap=0) const;


/** Populate an Image with the contents of this texture.
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreTextureManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ namespace Ogre {
: Texture(creator, name, handle, group)
{
}
const HardwarePixelBufferSharedPtr& getBuffer(size_t, size_t) override
const HardwarePixelBufferSharedPtr& getBuffer(size_t, size_t) const override
{
static HardwarePixelBufferSharedPtr nullBuffer;
return nullBuffer;
Expand Down
62 changes: 24 additions & 38 deletions OgreMain/include/OgreViewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ namespace Ogre {
Relative Z-order on the target. Lower = further to
the front.
*/
Viewport(Camera* camera, RenderTarget* target, float left, float top, float width, float height, int ZOrder);
Viewport(Camera* camera, RenderTarget* target, float left, float top, float width, float height, int ZOrder)
: Viewport(camera, target, {left, top, left + width, top + height}, ZOrder)
{
}

/// @overload
Viewport(Camera* camera, RenderTarget* target, FloatRect relRect, int ZOrder);

/** Default destructor.
*/
Expand Down Expand Up @@ -134,43 +140,17 @@ namespace Ogre {

/** Gets the Z-Order of this viewport. */
int getZOrder(void) const { return mZOrder; }
/** Gets one of the relative dimensions of the viewport,
a value between 0.0 and 1.0.
*/
float getLeft(void) const { return mRelRect.left; }

/** Gets one of the relative dimensions of the viewport, a value
between 0.0 and 1.0.
*/
/// @name Relative dimensions
/// These methods return the relative dimensions of the viewport, which are
/// expressed as a value between 0.0 and 1.0.
/// @{
float getLeft(void) const { return mRelRect.left; }
float getTop(void) const { return mRelRect.top; }

/** Gets one of the relative dimensions of the viewport, a value
between 0.0 and 1.0.
*/
float getWidth(void) const { return mRelRect.width(); }
/** Gets one of the relative dimensions of the viewport, a value
between 0.0 and 1.0.
*/
float getHeight(void) const { return mRelRect.height(); }
/** Gets one of the actual dimensions of the viewport, a value in
pixels.
*/

int getActualLeft(void) const { return mActRect.left; }
/** Gets one of the actual dimensions of the viewport, a value in
pixels.
*/

int getActualTop(void) const { return mActRect.top; }
/** Gets one of the actual dimensions of the viewport, a value in
pixels.
*/
int getActualWidth(void) const { return mActRect.width(); }
/** Gets one of the actual dimensions of the viewport, a value in
pixels.
*/

int getActualHeight(void) const { return mActRect.height(); }
FloatRect getDimensions(void) const { return mRelRect; }
/// @}

/** Sets the dimensions (after creation).
@param
Expand All @@ -187,6 +167,16 @@ namespace Ogre {
*/
void setDimensions(float left, float top, float width, float height);

/// @name Actual dimensions
/// These methods return the actual dimensions of the viewport in pixels.
/// @{
int getActualLeft(void) const { return mActRect.left; }
int getActualTop(void) const { return mActRect.top; }
int getActualWidth(void) const { return mActRect.width(); }
int getActualHeight(void) const { return mActRect.height(); }
Rect getActualDimensions() const { return mActRect; }
/// @}

/** Sets the initial background colour of the viewport (before
rendering).
*/
Expand Down Expand Up @@ -255,10 +245,6 @@ namespace Ogre {
const String& getMaterialScheme(void) const
{ return mMaterialSchemeName; }

/** Access to actual dimensions (based on target size).
*/
Rect getActualDimensions() const { return mActRect; }

/// @deprecated
OGRE_DEPRECATED void getActualDimensions(int& left, int& top, int& width, int& height) const;

Expand Down
22 changes: 0 additions & 22 deletions OgreMain/src/OgreCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,28 +541,6 @@ namespace Ogre {
return o;
}
//-----------------------------------------------------------------------
void Camera::_notifyRenderedFaces(unsigned int numfaces)
{
mVisFacesLastRender = numfaces;
}

//-----------------------------------------------------------------------
void Camera::_notifyRenderedBatches(unsigned int numbatches)
{
mVisBatchesLastRender = numbatches;
}

//-----------------------------------------------------------------------
unsigned int Camera::_getNumRenderedFaces(void) const
{
return mVisFacesLastRender;
}
//-----------------------------------------------------------------------
unsigned int Camera::_getNumRenderedBatches(void) const
{
return mVisBatchesLastRender;
}
//-----------------------------------------------------------------------
const Quaternion& Camera::getDerivedOrientation(void) const
{
updateView();
Expand Down
16 changes: 0 additions & 16 deletions OgreMain/src/OgreRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,22 +606,6 @@ namespace Ogre {
void RenderSystem::_beginGeometryCount(void)
{
mBatchCount = mFaceCount = mVertexCount = 0;

}
//-----------------------------------------------------------------------
unsigned int RenderSystem::_getFaceCount(void) const
{
return static_cast< unsigned int >( mFaceCount );
}
//-----------------------------------------------------------------------
unsigned int RenderSystem::_getBatchCount(void) const
{
return static_cast< unsigned int >( mBatchCount );
}
//-----------------------------------------------------------------------
unsigned int RenderSystem::_getVertexCount(void) const
{
return static_cast< unsigned int >( mVertexCount );
}
//-----------------------------------------------------------------------
void RenderSystem::_render(const RenderOperation& op)
Expand Down
5 changes: 2 additions & 3 deletions OgreMain/src/OgreRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ namespace Ogre {
fireViewportPostUpdate(viewport);
}

Viewport* RenderTarget::addViewport(Camera* cam, int ZOrder, float left, float top ,
float width , float height)
Viewport* RenderTarget::addViewport(Camera* cam, int ZOrder, FloatRect rect)
{
// Check no existing viewport with this Z-order
ViewportList::iterator it = mViewportList.find(ZOrder);
Expand All @@ -185,7 +184,7 @@ namespace Ogre {
}
// Add viewport to list
// Order based on Z-order
Viewport* vp = OGRE_NEW Viewport(cam, this, left, top, width, height, ZOrder);
Viewport* vp = OGRE_NEW Viewport(cam, this, rect, ZOrder);

mViewportList.emplace(ZOrder, vp);

Expand Down
2 changes: 1 addition & 1 deletion OgreMain/src/OgreTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ namespace Ogre {
}
}
}
const HardwarePixelBufferSharedPtr& Texture::getBuffer(size_t face, size_t mipmap)
const HardwarePixelBufferSharedPtr& Texture::getBuffer(size_t face, size_t mipmap) const
{
OgreAssert(face < getNumFaces(), "out of range");
OgreAssert(mipmap <= mNumMipmaps, "out of range");
Expand Down
4 changes: 2 additions & 2 deletions OgreMain/src/OgreViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ THE SOFTWARE.

namespace Ogre {
//---------------------------------------------------------------------
Viewport::Viewport(Camera* cam, RenderTarget* target, float left, float top, float width, float height, int ZOrder)
Viewport::Viewport(Camera* cam, RenderTarget* target, FloatRect relRect, int ZOrder)
: mCamera(cam)
, mTarget(target)
, mRelRect(left, top, left + width, top + height)
, mRelRect(relRect)
// Actual dimensions will update later
, mZOrder(ZOrder)
, mBackColour(ColourValue::Black)
Expand Down
5 changes: 1 addition & 4 deletions RenderSystems/Direct3D11/src/OgreD3D11MultiRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ namespace Ogre
if(mRenderTargets[y]->getWidth() != target->getWidth() ||
mRenderTargets[y]->getHeight() != target->getHeight())
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"MultiRenderTarget surfaces are not of same size",
"D3D11MultiRenderTarget::bindSurface"
);
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "MultiRenderTarget surfaces are not of same size");
}
}

Expand Down
12 changes: 3 additions & 9 deletions RenderSystems/Direct3D9/src/OgreD3D9MultiRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,15 @@ namespace Ogre
if (mRenderTargets[y]->getWidth() != buffer->getWidth() ||
mRenderTargets[y]->getHeight() != buffer->getHeight())
{
OGRE_EXCEPT(
Exception::ERR_INVALIDPARAMS,
"MultiRenderTarget surfaces are not of same size",
"D3D9MultiRenderTarget::bindSurface");
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "MultiRenderTarget surfaces are not of same size");
}

if (Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(RSC_MRT_SAME_BIT_DEPTHS)
&& (PixelUtil::getNumElemBits(mRenderTargets[y]->getFormat()) !=
PixelUtil::getNumElemBits(buffer->getFormat())))
{
OGRE_EXCEPT(
Exception::ERR_INVALIDPARAMS,
"MultiRenderTarget surfaces are not of same bit depth and hardware requires it",
"D3D9MultiRenderTarget::bindSurface"
);
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"MultiRenderTarget surfaces are not of same bit depth and hardware requires it");
}
}

Expand Down
4 changes: 1 addition & 3 deletions RenderSystems/Metal/src/OgreMetalMultiRenderTarget.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ of this software and associated documentation files (the "Software"), to deal
if( mWidth != target->getWidth() && mHeight != target->getHeight() &&
mFSAA != target->getFSAA() )
{
OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS,
"MultiRenderTarget surfaces are not of same size",
"MetalMultiRenderTarget::bindSurface" );
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "MultiRenderTarget surfaces are not of same size");
}
}

Expand Down