Make SCollisionHit::TriangleSelector and SCollisionTriangleRange::Selector both const.

Avoids lots of const casts and there shouldn't be a good reason to have those non-const.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6396 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-05-14 14:29:56 +00:00
parent bd7e357f77
commit 66dcb86e5f
5 changed files with 11 additions and 11 deletions

View File

@ -30,7 +30,7 @@ namespace scene
core::triangle3df Triangle;
//! Triangle selector which contained the colliding triangle (useful when having MetaTriangleSelector)
ITriangleSelector* TriangleSelector;
const ITriangleSelector* TriangleSelector;
//! Node which contained the triangle (is 0 when selector doesn't have that information)
ISceneNode* Node;

View File

@ -49,7 +49,7 @@ struct SCollisionTriangleRange
irr::u32 RangeSize;
//! Real selector which contained those triangles (useful when working with MetaTriangleSelector)
ITriangleSelector* Selector;
const ITriangleSelector* Selector;
//! SceneNode from which the triangles are from
ISceneNode* SceneNode;

View File

@ -180,7 +180,7 @@ void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles,
{
SCollisionTriangleRange triRange;
triRange.RangeSize = trianglesWritten;
triRange.Selector = const_cast<COctreeTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
triRange.MeshBuffer = MeshBuffer;
triRange.MaterialIndex = MaterialIndex;
@ -272,7 +272,7 @@ void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arr
{
SCollisionTriangleRange triRange;
triRange.RangeSize = trianglesWritten;
triRange.Selector = const_cast<COctreeTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
triRange.MeshBuffer = MeshBuffer;
triRange.MaterialIndex = MaterialIndex;

View File

@ -115,7 +115,7 @@ void CTerrainTriangleSelector::getTriangles(core::triangle3df* triangles,
{
SCollisionTriangleRange triRange;
triRange.RangeSize = tIndex;
triRange.Selector = const_cast<CTerrainTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
outTriangleInfo->push_back(triRange);
}
@ -163,7 +163,7 @@ void CTerrainTriangleSelector::getTriangles(core::triangle3df* triangles,
{
SCollisionTriangleRange triRange;
triRange.RangeSize = tIndex;
triRange.Selector = const_cast<CTerrainTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
outTriangleInfo->push_back(triRange);
}
@ -209,7 +209,7 @@ void CTerrainTriangleSelector::getTriangles(core::triangle3df* triangles,
{
SCollisionTriangleRange triRange;
triRange.RangeSize = tIndex;
triRange.Selector = const_cast<CTerrainTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
outTriangleInfo->push_back(triRange);
}

View File

@ -293,7 +293,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
triRange.RangeStart = 0;
triRange.RangeSize = cnt;
triRange.Selector = const_cast<CTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
triRange.MeshBuffer = MeshBuffer;
triRange.MaterialIndex = MaterialIndex;
@ -313,7 +313,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
triRange.MeshBuffer = BufferRanges[rangeIndex].MeshBuffer;
triRange.RangeStart = BufferRanges[rangeIndex].RangeStart;
triRange.RangeSize = core::min_( cnt-BufferRanges[rangeIndex].RangeStart, BufferRanges[rangeIndex].RangeSize);
triRange.Selector = const_cast<CTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
outTriangleInfo->push_back(triRange);
@ -370,7 +370,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
{
irr::u32 activeRange = 0;
SCollisionTriangleRange triRange;
triRange.Selector = const_cast<CTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
triRange.RangeStart = triangleCount;
triRange.MeshBuffer = BufferRanges[activeRange].MeshBuffer;
@ -433,7 +433,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
{
SCollisionTriangleRange triRange;
triRange.RangeSize = triangleCount;
triRange.Selector = const_cast<CTriangleSelector*>(this);
triRange.Selector = this;
triRange.SceneNode = SceneNode;
triRange.MeshBuffer = MeshBuffer;
triRange.MaterialIndex = MaterialIndex;