Don't use memset to initialise aggregate of floats.
In C3D_RENDER_OGL_LEGACY::setupMaterial(), the struct m_materials (which is made up of floats and glm::vec3f's) is initialised with a memset to 0. This is unsafe, as floating point value representations in C++ are implementation- defined (so 0 in memory is not 0-valued for sure). Use empty-brace aggregate-initialisation, which does the right thing.
This commit is contained in:
parent
c5a2ea1dd8
commit
e52688586a
|
@ -175,8 +175,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_arrows()
|
||||||
|
|
||||||
void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
void C3D_RENDER_OGL_LEGACY::setupMaterials()
|
||||||
{
|
{
|
||||||
|
m_materials = {};
|
||||||
memset( &m_materials, 0, sizeof( m_materials ) );
|
|
||||||
|
|
||||||
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
|
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue