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 #3283

Merged
merged 5 commits into from
Feb 8, 2025
Merged

Devel #3283

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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if (APPLE AND NOT ANDROID AND NOT EMSCRIPTEN AND NOT ANDROID_PLATFORM)
add_definitions(-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0)
endif ()

project(OGRE VERSION 14.3.4)
project(OGRE VERSION 14.4.0)

# extra version info
set(OGRE_VERSION_SUFFIX "")
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreHardwarePixelBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace Ogre {
@return A pointer to the render target. This pointer has the lifespan of this
PixelBuffer.
*/
RenderTexture *getRenderTarget(size_t slice=0);
RenderTexture *getRenderTarget(size_t slice=0) const;

/// Gets the width of this buffer
uint32 getWidth() const { return mWidth; }
Expand Down
71 changes: 37 additions & 34 deletions OgreMain/include/OgreRenderTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ namespace Ogre {
virtual ~RenderTarget();

/// Retrieve target's name.
virtual const String& getName(void) const;
const String& getName(void) const { return mName; }

/// Retrieve information about the render target.
void getMetrics(unsigned int& width, unsigned int& height);

virtual uint32 getWidth(void) const;
virtual uint32 getHeight(void) const;
uint32 getWidth(void) const { return mWidth; }
uint32 getHeight(void) const { return mHeight; }

/**
* Sets the pool ID this RenderTarget should query from. Default value is POOL_DEFAULT.
Expand All @@ -107,20 +107,20 @@ namespace Ogre {
void setDepthBufferPool( uint16 poolId );

//Returns the pool ID this RenderTarget should query from. @see DepthBuffer
uint16 getDepthBufferPool() const;
uint16 getDepthBufferPool() const { return mDepthBufferPoolId; }

DepthBuffer* getDepthBuffer() const;
DepthBuffer* getDepthBuffer() const { return mDepthBuffer; }

//Returns false if couldn't attach
virtual bool attachDepthBuffer( DepthBuffer *depthBuffer );

virtual void detachDepthBuffer();
void detachDepthBuffer();

/** Detaches DepthBuffer without notifying it from the detach.
Useful when called from the DepthBuffer while it iterates through attached
RenderTargets (@see DepthBuffer::_setPoolId())
*/
virtual void _detachDepthBuffer();
virtual void _detachDepthBuffer() { mDepthBuffer = 0; }

/** Tells the target to update it's contents.

Expand All @@ -144,7 +144,7 @@ namespace Ogre {
queued commands complete. Or, you might do this if you want custom
control over your windows, such as for externally created windows.
*/
virtual void update(bool swapBuffers = true);
void update(bool swapBuffers = true);
/** Swaps the frame buffers to display the next frame.

For targets that are double-buffered so that no
Expand Down Expand Up @@ -178,30 +178,30 @@ namespace Ogre {
@param
height The relative height of the viewport on the target, as a value between 0 and 1.
*/
virtual Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f ,
Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f ,
float width = 1.0f, float height = 1.0f);

/** Returns the number of viewports attached to this target.*/
virtual unsigned short getNumViewports(void) const;
unsigned short getNumViewports(void) const { return static_cast<unsigned short>(mViewportList.size()); }

/** Retrieves a pointer to the viewport with the given index. */
virtual Viewport* getViewport(unsigned short index);
Viewport* getViewport(unsigned short index);

/** Retrieves a pointer to the viewport with the given Z-order.
@remarks throws if not found.
*/
virtual Viewport* getViewportByZOrder(int ZOrder);
Viewport* getViewportByZOrder(int ZOrder);

/** Returns true if and only if a viewport exists at the given Z-order. */
virtual bool hasViewportWithZOrder(int ZOrder);
bool hasViewportWithZOrder(int ZOrder);

/** Removes a viewport at a given Z-order.
*/
virtual void removeViewport(int ZOrder);
void removeViewport(int ZOrder);

/** Removes all viewports on this target.
*/
virtual void removeAllViewports(void);
void removeAllViewports(void);

/** Retrieves details of current rendering performance. */
const FrameStats& getStatistics(void) const {
Expand Down Expand Up @@ -256,13 +256,13 @@ namespace Ogre {
'normal' system rendering.
@par NB this should not be used for frame-based scene updates, use Root::addFrameListener for that.
*/
virtual void addListener(RenderTargetListener* listener);
void addListener(RenderTargetListener* listener);
/** same as addListener, but force the position in the vector, so we can control the call order */
virtual void insertListener(RenderTargetListener* listener, const unsigned int pos = 0);
void insertListener(RenderTargetListener* listener, const unsigned int pos = 0);
/** Removes a RenderTargetListener previously registered using addListener. */
virtual void removeListener(RenderTargetListener* listener);
void removeListener(RenderTargetListener* listener);
/** Removes all listeners from this instance. */
virtual void removeAllListeners(void);
void removeAllListeners(void);

/** Sets the priority of this render target in relation to the others.

Expand All @@ -271,17 +271,17 @@ namespace Ogre {
at the time the render target is attached to the render system, changes
afterwards will not affect the ordering.
*/
virtual void setPriority( uchar priority ) { mPriority = priority; }
void setPriority( uchar priority ) { mPriority = priority; }
/** Gets the priority of a render target. */
virtual uchar getPriority() const { return mPriority; }
uchar getPriority() const { return mPriority; }

/** Used to retrieve or set the active state of the render target.
*/
virtual bool isActive() const;
virtual bool isActive() const { return mActive; }

/** Used to set the active state of the render target.
*/
virtual void setActive( bool state );
void setActive( bool state ) { mActive = state; }

/** Sets whether this target should be automatically updated if Ogre's rendering
loop or Root::_updateAllRenderTargets is being used.
Expand All @@ -294,11 +294,11 @@ namespace Ogre {
loop or when Root::_updateAllRenderTargets is called. If false, the
target is only updated when its update() method is called explicitly.
*/
virtual void setAutoUpdated(bool autoupdate);
void setAutoUpdated(bool autoupdate) { mAutoUpdate = autoupdate; }
/** Gets whether this target is automatically updated if Ogre's rendering
loop or Root::_updateAllRenderTargets is being used.
*/
virtual bool isAutoUpdated(void) const;
bool isAutoUpdated(void) const { return mAutoUpdate; }

/** Copies the current contents of the render target to a pixelbox.
@remarks See suggestPixelFormat for a tip as to the best pixel format to
Expand Down Expand Up @@ -326,25 +326,25 @@ namespace Ogre {

/** Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file.
@return the name of the file used.*/
virtual String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix);
String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix);

virtual bool requiresTextureFlipping() const = 0;

/** Utility method to notify a render target that a camera has been removed,
in case it was referring to it as a viewer.
*/
virtual void _notifyCameraRemoved(const Camera* cam);
void _notifyCameraRemoved(const Camera* cam);

/** Indicates whether this target is the primary window. The
primary window is special in that it is destroyed when
ogre is shut down, and cannot be destroyed directly.
This is the case because it holds the context for vertex,
index buffers and textures.
*/
virtual bool isPrimary(void) const;
virtual bool isPrimary(void) const { return false; }

/** Indicates whether stereo is currently enabled for this target. Default is false. */
virtual bool isStereoEnabled(void) const;
virtual bool isStereoEnabled(void) const { return mStereoEnabled; }

/** Indicates whether on rendering, linear colour space is converted to
sRGB gamma colour space. This is the exact opposite conversion of
Expand All @@ -353,14 +353,14 @@ namespace Ogre {
enabled through the 'gamma' creation misc parameter. For textures,
it is enabled through the hwGamma parameter to the create call.
*/
virtual bool isHardwareGammaEnabled() const { return mHwGamma; }
bool isHardwareGammaEnabled() const { return mHwGamma; }

/** Indicates whether multisampling is performed on rendering and at what level.
*/
virtual uint getFSAA() const { return mFSAA; }
uint getFSAA() const { return mFSAA; }

/// RenderSystem specific FSAA option. See @ref RenderSystem::_createRenderWindow for details.
virtual const String& getFSAAHint() const { return mFSAAHint; }
const String& getFSAAHint() const { return mFSAAHint; }

/** Set the level of multisample AA to be used if hardware support it.
This option will be ignored if the hardware does not support it
Expand Down Expand Up @@ -404,7 +404,10 @@ namespace Ogre {
@param zorder The zorder of the viewport to update.
@param updateStatistics Whether you want to update statistics or not.
*/
virtual void _updateViewport(int zorder, bool updateStatistics = true);
void _updateViewport(int zorder, bool updateStatistics = true)
{
_updateViewport(getViewportByZOrder(zorder), updateStatistics);
}

/** Method for manual management of rendering - renders the given viewport (even if it is not autoupdated)

Expand All @@ -424,7 +427,7 @@ namespace Ogre {
@param updateStatistics Whether you want to update statistics or not.
@see _beginUpdate()
*/
virtual void _updateAutoUpdatedViewports(bool updateStatistics = true);
void _updateAutoUpdatedViewports(bool updateStatistics = true);

/** Method for manual management of rendering - finishes statistics calculation
and fires 'postRenderTargetUpdate'.
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/src/OgreHardwarePixelBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ namespace Ogre
}
//-----------------------------------------------------------------------------

RenderTexture *HardwarePixelBuffer::getRenderTarget(size_t zoffset)
RenderTexture *HardwarePixelBuffer::getRenderTarget(size_t zoffset) const
{
assert(mUsage & TU_RENDERTARGET);
return mSliceTRT.at(zoffset);
Expand Down
83 changes: 1 addition & 82 deletions OgreMain/src/OgreRenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,11 @@ namespace Ogre {

}

const String& RenderTarget::getName(void) const
{
return mName;
}


void RenderTarget::getMetrics(unsigned int& width, unsigned int& height)
{
width = mWidth;
height = mHeight;
}

unsigned int RenderTarget::getWidth(void) const
{
return mWidth;
}
unsigned int RenderTarget::getHeight(void) const
{
return mHeight;
}
//-----------------------------------------------------------------------
void RenderTarget::setDepthBufferPool( uint16 poolId )
{
Expand All @@ -106,16 +91,6 @@ namespace Ogre {
}
}
//-----------------------------------------------------------------------
uint16 RenderTarget::getDepthBufferPool() const
{
return mDepthBufferPoolId;
}
//-----------------------------------------------------------------------
DepthBuffer* RenderTarget::getDepthBuffer() const
{
return mDepthBuffer;
}
//-----------------------------------------------------------------------
bool RenderTarget::attachDepthBuffer( DepthBuffer *depthBuffer )
{
bool retVal = false;
Expand All @@ -135,14 +110,9 @@ namespace Ogre {
if( mDepthBuffer )
{
mDepthBuffer->_notifyRenderTargetDetached( this );
mDepthBuffer = 0;
_detachDepthBuffer();
}
}
//-----------------------------------------------------------------------
void RenderTarget::_detachDepthBuffer()
{
mDepthBuffer = 0;
}

void RenderTarget::updateImpl(void)
{
Expand Down Expand Up @@ -199,20 +169,6 @@ namespace Ogre {
fireViewportPostUpdate(viewport);
}

void RenderTarget::_updateViewport(int zorder, bool updateStatistics)
{
ViewportList::iterator it = mViewportList.find(zorder);
if (it != mViewportList.end())
{
_updateViewport((*it).second,updateStatistics);
}
else
{
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,"No viewport with given zorder : "
+ StringConverter::toString(zorder), "RenderTarget::_updateViewport");
}
}

Viewport* RenderTarget::addViewport(Camera* cam, int ZOrder, float left, float top ,
float width , float height)
{
Expand Down Expand Up @@ -371,12 +327,6 @@ namespace Ogre {
}
}
//-----------------------------------------------------------------------
unsigned short RenderTarget::getNumViewports(void) const
{
return (unsigned short)mViewportList.size();

}
//-----------------------------------------------------------------------
Viewport* RenderTarget::getViewport(unsigned short index)
{
assert (index < mViewportList.size() && "Index out of bounds");
Expand Down Expand Up @@ -404,16 +354,6 @@ namespace Ogre {
return i != mViewportList.end();
}
//-----------------------------------------------------------------------
bool RenderTarget::isActive() const
{
return mActive;
}
//-----------------------------------------------------------------------
void RenderTarget::setActive( bool state )
{
mActive = state;
}
//-----------------------------------------------------------------------
void RenderTarget::fireViewportPreUpdate(Viewport* vp)
{
RenderTargetViewportEvent evt;
Expand Down Expand Up @@ -504,27 +444,6 @@ namespace Ogre {
}
}
//-----------------------------------------------------------------------
void RenderTarget::setAutoUpdated(bool autoup)
{
mAutoUpdate = autoup;
}
//-----------------------------------------------------------------------
bool RenderTarget::isAutoUpdated(void) const
{
return mAutoUpdate;
}
//-----------------------------------------------------------------------
bool RenderTarget::isPrimary(void) const
{
// RenderWindow will override and return true for the primary window
return false;
}
//-----------------------------------------------------------------------
bool RenderTarget::isStereoEnabled(void) const
{
return mStereoEnabled;
}
//-----------------------------------------------------------------------
void RenderTarget::update(bool swap)
{
GpuEventScope profileScope(mName);
Expand Down
1 change: 0 additions & 1 deletion RenderSystems/GL/include/OgreGLFBOMultiRenderTarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ namespace Ogre {

/// Override so we can attach the depth buffer to the FBO
bool attachDepthBuffer( DepthBuffer *depthBuffer ) override;
void detachDepthBuffer() override;
void _detachDepthBuffer() override;
private:
void bindSurfaceImpl(size_t attachment, RenderTexture *target) override;
Expand Down
1 change: 0 additions & 1 deletion RenderSystems/GL/include/OgreGLFBORenderTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ namespace Ogre {

/// Override so we can attach the depth buffer to the FBO
bool attachDepthBuffer( DepthBuffer *depthBuffer ) override;
void detachDepthBuffer() override;
void _detachDepthBuffer() override;

GLContext* getContext() const override { return mFB.getContext(); }
Expand Down
Loading