mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- fixed some warnings in OBJ model code.
(This clearly shows that using 'long' as parameters in any interface must be stopped. It is fundamentally unsafe to have a type whose size is not reliable - it's either an int-sized nor a pointer sized value, depending on the platform, and essentially worthless.)
This commit is contained in:
parent
2d53ad6f10
commit
53ee7cfc7b
1 changed files with 4 additions and 4 deletions
|
@ -54,7 +54,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
||||||
}
|
}
|
||||||
if (nlpos == -1)
|
if (nlpos == -1)
|
||||||
{
|
{
|
||||||
nlpos = objBuf.Len();
|
nlpos = (long)objBuf.Len();
|
||||||
}
|
}
|
||||||
FString lineStr(objBuf.GetChars() + bpos, nlpos - bpos);
|
FString lineStr(objBuf.GetChars() + bpos, nlpos - bpos);
|
||||||
mtlUsages.Push(lineStr);
|
mtlUsages.Push(lineStr);
|
||||||
|
@ -72,7 +72,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
||||||
nlpos = objBuf.IndexOf('\n', bpos);
|
nlpos = objBuf.IndexOf('\n', bpos);
|
||||||
if (nlpos == -1)
|
if (nlpos == -1)
|
||||||
{
|
{
|
||||||
nlpos = objBuf.Len();
|
nlpos = (long)objBuf.Len();
|
||||||
}
|
}
|
||||||
memcpy(wObjBuf + bpos, mtlUsages[i].GetChars(), nlpos - bpos);
|
memcpy(wObjBuf + bpos, mtlUsages[i].GetChars(), nlpos - bpos);
|
||||||
}
|
}
|
||||||
|
@ -384,10 +384,10 @@ void FOBJModel::BuildVertexBuffer(FModelRenderer *renderer)
|
||||||
{
|
{
|
||||||
// https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
|
// https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal
|
||||||
// Find other sides of triangle
|
// Find other sides of triangle
|
||||||
int nextSidx = side + 2;
|
auto nextSidx = side + 2;
|
||||||
if (nextSidx >= 3) nextSidx -= 3;
|
if (nextSidx >= 3) nextSidx -= 3;
|
||||||
|
|
||||||
int lastSidx = side + 1;
|
auto lastSidx = side + 1;
|
||||||
if (lastSidx >= 3) lastSidx -= 3;
|
if (lastSidx >= 3) lastSidx -= 3;
|
||||||
|
|
||||||
OBJFaceSide &nextSide = surfaces[i].tris[j].sides[nextSidx];
|
OBJFaceSide &nextSide = surfaces[i].tris[j].sides[nextSidx];
|
||||||
|
|
Loading…
Reference in a new issue