mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
Merge branch 'const_casts' into 'master'
Don't cast away const when we can avoid it See merge request OpenMW/openmw!2085
This commit is contained in:
commit
f3dfb5d939
@ -115,7 +115,7 @@ class ESMWriter
|
|||||||
void writeT(const T& data)
|
void writeT(const T& data)
|
||||||
{
|
{
|
||||||
static_assert(!std::is_pointer_v<T>);
|
static_assert(!std::is_pointer_v<T>);
|
||||||
write((char*)&data, sizeof(T));
|
write(reinterpret_cast<const char*>(&data), sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, std::size_t size>
|
template<typename T, std::size_t size>
|
||||||
|
@ -22,7 +22,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Utf8Stream (const char * str) :
|
Utf8Stream (const char * str) :
|
||||||
cur ((unsigned char*) str), nxt ((unsigned char*) str), end ((unsigned char*) str + strlen(str)), val(Utf8Stream::sBadChar())
|
cur (reinterpret_cast<const unsigned char*>(str)),
|
||||||
|
nxt (reinterpret_cast<const unsigned char*>(str)),
|
||||||
|
end (reinterpret_cast<const unsigned char*>(str) + strlen(str)),
|
||||||
|
val(Utf8Stream::sBadChar())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glVertexPointer(3, GL_FLOAT, sizeof(MyGUI::Vertex), (char*)vbo->getArray(0)->getDataPointer());
|
glVertexPointer(3, GL_FLOAT, sizeof(MyGUI::Vertex), reinterpret_cast<const char*>(vbo->getArray(0)->getDataPointer()));
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyGUI::Vertex), (char*)vbo->getArray(0)->getDataPointer() + 12);
|
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MyGUI::Vertex), reinterpret_cast<const char*>(vbo->getArray(0)->getDataPointer()) + 12);
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(MyGUI::Vertex), (char*)vbo->getArray(0)->getDataPointer() + 16);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(MyGUI::Vertex), reinterpret_cast<const char*>(vbo->getArray(0)->getDataPointer()) + 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, batch.mVertexCount);
|
glDrawArrays(GL_TRIANGLES, 0, batch.mVertexCount);
|
||||||
|
@ -1284,7 +1284,7 @@ namespace NifOsg
|
|||||||
if (strip.size() < 3)
|
if (strip.size() < 3)
|
||||||
continue;
|
continue;
|
||||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP, strip.size(),
|
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP, strip.size(),
|
||||||
(unsigned short*)strip.data()));
|
reinterpret_cast<const unsigned short*>(strip.data())));
|
||||||
hasGeometry = true;
|
hasGeometry = true;
|
||||||
}
|
}
|
||||||
if (!hasGeometry)
|
if (!hasGeometry)
|
||||||
@ -1299,7 +1299,7 @@ namespace NifOsg
|
|||||||
if (line.empty())
|
if (line.empty())
|
||||||
return;
|
return;
|
||||||
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::LINES, line.size(),
|
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::LINES, line.size(),
|
||||||
(unsigned short*)line.data()));
|
reinterpret_cast<const unsigned short*>(line.data())));
|
||||||
}
|
}
|
||||||
handleNiGeometryData(geometry, niGeometryData, boundTextures, nifNode->name);
|
handleNiGeometryData(geometry, niGeometryData, boundTextures, nifNode->name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user