mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-10 09:43:52 +01:00
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:
parent
cfb27d9a74
commit
1dbab53e5a
@ -193,8 +193,8 @@ namespace scene
|
||||
Vertices.reallocate(vertexCount+numVertices);
|
||||
for (i=0; i<numVertices; ++i)
|
||||
{
|
||||
Vertices.push_back(reinterpret_cast<const T*>(vertices)[i]);
|
||||
BoundingBox.addInternalPoint(reinterpret_cast<const T*>(vertices)[i].Pos);
|
||||
Vertices.push_back(static_cast<const T*>(vertices)[i]);
|
||||
BoundingBox.addInternalPoint(static_cast<const T*>(vertices)[i].Pos);
|
||||
}
|
||||
|
||||
Indices.reallocate(getIndexCount()+numIndices);
|
||||
|
@ -206,7 +206,7 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame()
|
||||
// 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.
|
||||
|
||||
CSkinnedMesh* skinnedMesh = reinterpret_cast<CSkinnedMesh*>(Mesh);
|
||||
CSkinnedMesh* skinnedMesh = static_cast<CSkinnedMesh*>(Mesh);
|
||||
|
||||
if (JointMode == EJUOR_CONTROL)//write to mesh
|
||||
skinnedMesh->transferJointsToMesh(JointChildSceneNodes);
|
||||
@ -949,7 +949,7 @@ void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions)
|
||||
checkJoints();
|
||||
const f32 frame = getFrameNr(); //old?
|
||||
|
||||
CSkinnedMesh* skinnedMesh=reinterpret_cast<CSkinnedMesh*>(Mesh);
|
||||
CSkinnedMesh* skinnedMesh=static_cast<CSkinnedMesh*>(Mesh);
|
||||
|
||||
skinnedMesh->transferOnlyJointsHintsToMesh( JointChildSceneNodes );
|
||||
skinnedMesh->animateMesh(frame, 1.0f);
|
||||
|
@ -1192,7 +1192,7 @@ void CD3D9Driver::removeOcclusionQuery(scene::ISceneNode* node)
|
||||
if (index != -1)
|
||||
{
|
||||
if (OcclusionQueries[index].PID != 0)
|
||||
reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Release();
|
||||
static_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Release();
|
||||
CNullDriver::removeOcclusionQuery(node);
|
||||
}
|
||||
}
|
||||
@ -1210,10 +1210,10 @@ void CD3D9Driver::runOcclusionQuery(scene::ISceneNode* node, bool visible)
|
||||
if (index != -1)
|
||||
{
|
||||
if (OcclusionQueries[index].PID)
|
||||
reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Issue(D3DISSUE_BEGIN);
|
||||
static_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Issue(D3DISSUE_BEGIN);
|
||||
CNullDriver::runOcclusionQuery(node,visible);
|
||||
if (OcclusionQueries[index].PID)
|
||||
reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Issue(D3DISSUE_END);
|
||||
static_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Issue(D3DISSUE_END);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1232,12 +1232,12 @@ void CD3D9Driver::updateOcclusionQuery(scene::ISceneNode* node, bool block)
|
||||
bool available = block?true:false;
|
||||
int tmp=0;
|
||||
if (!block)
|
||||
available=(reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->GetData(&tmp, sizeof(DWORD), 0)==S_OK);
|
||||
available=(static_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->GetData(&tmp, sizeof(DWORD), 0)==S_OK);
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
HRESULT hr = reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->GetData(&tmp, sizeof(DWORD), D3DGETDATA_FLUSH);
|
||||
HRESULT hr = static_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->GetData(&tmp, sizeof(DWORD), D3DGETDATA_FLUSH);
|
||||
available = (hr == S_OK);
|
||||
if (hr!=S_FALSE)
|
||||
break;
|
||||
@ -2945,7 +2945,7 @@ bool CD3D9Driver::reset()
|
||||
{
|
||||
if (OcclusionQueries[i].PID)
|
||||
{
|
||||
reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[i].PID)->Release();
|
||||
static_cast<IDirect3DQuery9*>(OcclusionQueries[i].PID)->Release();
|
||||
OcclusionQueries[i].PID=0;
|
||||
}
|
||||
}
|
||||
|
@ -1304,7 +1304,7 @@ bool CIrrDeviceWin32::present(video::IImage* image, void* windowId, core::rect<s
|
||||
{
|
||||
HWND hwnd = HWnd;
|
||||
if ( windowId )
|
||||
hwnd = reinterpret_cast<HWND>(windowId);
|
||||
hwnd = static_cast<HWND>(windowId);
|
||||
|
||||
HDC dc = GetDC(hwnd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user