IVideoDriver::getOcclusionQueryResult works now with const node pointer.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6401 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-05-15 11:51:42 +00:00
parent ea0f2555ed
commit f9e5ef76bd
10 changed files with 20 additions and 21 deletions

View File

@ -460,7 +460,7 @@ namespace video
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger than the The value is a safe approximation, i.e. can be larger than the
actual value of pixels. */ actual value of pixels. */
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const =0; virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const =0;
//! Create render target. //! Create render target.
virtual IRenderTarget* addRenderTarget() = 0; virtual IRenderTarget* addRenderTarget() = 0;

View File

@ -1253,13 +1253,10 @@ void CD3D9Driver::updateOcclusionQuery(scene::ISceneNode* node, bool block)
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger than the The value is a safe approximation, i.e. can be larger than the
actual value of pixels. */ actual value of pixels. */
u32 CD3D9Driver::getOcclusionQueryResult(scene::ISceneNode* node) const u32 CD3D9Driver::getOcclusionQueryResult(const scene::ISceneNode* node) const
{ {
const s32 index = OcclusionQueries.linear_search(SOccQuery(node)); const s32 index = OcclusionQueries.linear_search(node);
if (index != -1) return index < 0 ? ~0 : OcclusionQueries[index].Result;
return OcclusionQueries[index].Result;
else
return ~0;
} }

View File

@ -115,7 +115,7 @@ namespace video
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger then the The value is a safe approximation, i.e. can be larger then the
actual value of pixels. */ actual value of pixels. */
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE; virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
//! Create render target. //! Create render target.
virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE; virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE;

View File

@ -1994,7 +1994,7 @@ void CNullDriver::updateAllOcclusionQueries(bool block)
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger then the The value is a safe approximation, i.e. can be larger then the
actual value of pixels. */ actual value of pixels. */
u32 CNullDriver::getOcclusionQueryResult(scene::ISceneNode* node) const u32 CNullDriver::getOcclusionQueryResult(const scene::ISceneNode* node) const
{ {
return ~0; return ~0;
} }

View File

@ -477,7 +477,7 @@ namespace video
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger than the The value is a safe approximation, i.e. can be larger than the
actual value of pixels. */ actual value of pixels. */
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE; virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
//! Create render target. //! Create render target.
virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE; virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE;
@ -832,6 +832,11 @@ namespace video
return other.Node==Node; return other.Node==Node;
} }
bool operator==(const scene::ISceneNode* other) const
{
return other==Node;
}
scene::ISceneNode* Node; scene::ISceneNode* Node;
const scene::IMesh* Mesh; const scene::IMesh* Mesh;
union union

View File

@ -786,13 +786,10 @@ void COpenGLDriver::updateOcclusionQuery(scene::ISceneNode* node, bool block)
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger than the The value is a safe approximation, i.e. can be larger than the
actual value of pixels. */ actual value of pixels. */
u32 COpenGLDriver::getOcclusionQueryResult(scene::ISceneNode* node) const u32 COpenGLDriver::getOcclusionQueryResult(const scene::ISceneNode* node) const
{ {
const s32 index = OcclusionQueries.linear_search(SOccQuery(node)); const s32 index = OcclusionQueries.linear_search(node);
if (index != -1) return index < 0 ? ~0 : OcclusionQueries[index].Result;
return OcclusionQueries[index].Result;
else
return ~0;
} }

View File

@ -110,7 +110,7 @@ namespace video
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger then the The value is a safe approximation, i.e. can be larger then the
actual value of pixels. */ actual value of pixels. */
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE; virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
//! Create render target. //! Create render target.
virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE; virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE;

View File

@ -1247,7 +1247,7 @@ bool CSceneManager::isCulled(const ISceneNode* node) const
// has occlusion query information // has occlusion query information
if (node->getAutomaticCulling() & scene::EAC_OCC_QUERY) if (node->getAutomaticCulling() & scene::EAC_OCC_QUERY)
{ {
result = (Driver->getOcclusionQueryResult(const_cast<ISceneNode*>(node))==0); result = (Driver->getOcclusionQueryResult(node)==0);
} }
// can be seen by a bounding box ? // can be seen by a bounding box ?

View File

@ -4810,9 +4810,9 @@ void CBurningVideoDriver::updateOcclusionQuery(scene::ISceneNode* node, bool blo
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger than the The value is a safe approximation, i.e. can be larger than the
actual value of pixels. */ actual value of pixels. */
u32 CBurningVideoDriver::getOcclusionQueryResult(scene::ISceneNode* node) const u32 CBurningVideoDriver::getOcclusionQueryResult(const scene::ISceneNode* node) const
{ {
const s32 index = OcclusionQueries.linear_search(SOccQuery(node)); const s32 index = OcclusionQueries.linear_search(node);
return index < 0 ? ~0 : OcclusionQueries[index].Result; return index < 0 ? ~0 : OcclusionQueries[index].Result;
} }

View File

@ -48,7 +48,7 @@ namespace video
/** Return value is the number of visible pixels/fragments. /** Return value is the number of visible pixels/fragments.
The value is a safe approximation, i.e. can be larger then the The value is a safe approximation, i.e. can be larger then the
actual value of pixels. */ actual value of pixels. */
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE; virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
//! sets transformation //! sets transformation
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) IRR_OVERRIDE; virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) IRR_OVERRIDE;