Prefer static_cast to reinterpret_cast where possible.

Just safer. Could probably do in a lot more places... another time.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6293 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-01-08 18:22:20 +00:00 committed by sfan5
parent 1b8be72ccb
commit 684293f527
3 changed files with 5 additions and 5 deletions

View File

@ -193,8 +193,8 @@ namespace scene
Vertices.reallocate(vertexCount+numVertices); Vertices.reallocate(vertexCount+numVertices);
for (i=0; i<numVertices; ++i) for (i=0; i<numVertices; ++i)
{ {
Vertices.push_back(reinterpret_cast<const T*>(vertices)[i]); Vertices.push_back(static_cast<const T*>(vertices)[i]);
BoundingBox.addInternalPoint(reinterpret_cast<const T*>(vertices)[i].Pos); BoundingBox.addInternalPoint(static_cast<const T*>(vertices)[i].Pos);
} }
Indices.reallocate(getIndexCount()+numIndices); Indices.reallocate(getIndexCount()+numIndices);

View File

@ -192,7 +192,7 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame()
// As multiple scene nodes may be sharing the same skinned mesh, we have to // As multiple scene nodes may be sharing the same skinned mesh, we have to
// re-animate it every frame to ensure that this node gets the mesh that it needs. // re-animate it every frame to ensure that this node gets the mesh that it needs.
CSkinnedMesh* skinnedMesh = reinterpret_cast<CSkinnedMesh*>(Mesh); CSkinnedMesh* skinnedMesh = static_cast<CSkinnedMesh*>(Mesh);
if (JointMode == EJUOR_CONTROL)//write to mesh if (JointMode == EJUOR_CONTROL)//write to mesh
skinnedMesh->transferJointsToMesh(JointChildSceneNodes); skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
@ -747,7 +747,7 @@ void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions)
checkJoints(); checkJoints();
const f32 frame = getFrameNr(); //old? const f32 frame = getFrameNr(); //old?
CSkinnedMesh* skinnedMesh=reinterpret_cast<CSkinnedMesh*>(Mesh); CSkinnedMesh* skinnedMesh=static_cast<CSkinnedMesh*>(Mesh);
skinnedMesh->transferOnlyJointsHintsToMesh( JointChildSceneNodes ); skinnedMesh->transferOnlyJointsHintsToMesh( JointChildSceneNodes );
skinnedMesh->animateMesh(frame, 1.0f); skinnedMesh->animateMesh(frame, 1.0f);

View File

@ -1140,7 +1140,7 @@ bool CIrrDeviceWin32::present(video::IImage* image, void* windowId, core::rect<s
{ {
HWND hwnd = HWnd; HWND hwnd = HWnd;
if ( windowId ) if ( windowId )
hwnd = reinterpret_cast<HWND>(windowId); hwnd = static_cast<HWND>(windowId);
HDC dc = GetDC(hwnd); HDC dc = GetDC(hwnd);