mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-25 02:00:30 +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);
|
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);
|
||||||
|
@ -206,7 +206,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);
|
||||||
@ -949,7 +949,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);
|
||||||
|
@ -1192,7 +1192,7 @@ void CD3D9Driver::removeOcclusionQuery(scene::ISceneNode* node)
|
|||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
if (OcclusionQueries[index].PID != 0)
|
if (OcclusionQueries[index].PID != 0)
|
||||||
reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Release();
|
static_cast<IDirect3DQuery9*>(OcclusionQueries[index].PID)->Release();
|
||||||
CNullDriver::removeOcclusionQuery(node);
|
CNullDriver::removeOcclusionQuery(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1210,10 +1210,10 @@ void CD3D9Driver::runOcclusionQuery(scene::ISceneNode* node, bool visible)
|
|||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
if (OcclusionQueries[index].PID)
|
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);
|
CNullDriver::runOcclusionQuery(node,visible);
|
||||||
if (OcclusionQueries[index].PID)
|
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;
|
bool available = block?true:false;
|
||||||
int tmp=0;
|
int tmp=0;
|
||||||
if (!block)
|
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
|
else
|
||||||
{
|
{
|
||||||
do
|
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);
|
available = (hr == S_OK);
|
||||||
if (hr!=S_FALSE)
|
if (hr!=S_FALSE)
|
||||||
break;
|
break;
|
||||||
@ -2945,7 +2945,7 @@ bool CD3D9Driver::reset()
|
|||||||
{
|
{
|
||||||
if (OcclusionQueries[i].PID)
|
if (OcclusionQueries[i].PID)
|
||||||
{
|
{
|
||||||
reinterpret_cast<IDirect3DQuery9*>(OcclusionQueries[i].PID)->Release();
|
static_cast<IDirect3DQuery9*>(OcclusionQueries[i].PID)->Release();
|
||||||
OcclusionQueries[i].PID=0;
|
OcclusionQueries[i].PID=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1304,7 +1304,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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user