mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-12 18:43:08 +00:00
Merge branch 'coverityfixes' into 'master'
Correct some things based on Coverity's output See merge request OpenMW/openmw!3272
This commit is contained in:
commit
2c989e4057
2 changed files with 9 additions and 4 deletions
|
|
@ -470,7 +470,11 @@ namespace Bsa
|
||||||
return 0;
|
return 0;
|
||||||
std::replace(str.begin(), str.end(), '/', '\\');
|
std::replace(str.begin(), str.end(), '/', '\\');
|
||||||
Misc::StringUtils::lowerCaseInPlace(str);
|
Misc::StringUtils::lowerCaseInPlace(str);
|
||||||
uint64_t result = str[len - 1] | (len >= 3 ? (str[len - 2] << 8) : 0) | (len << 16) | (str[0] << 24);
|
uint64_t result = str[len - 1];
|
||||||
|
if (len >= 3)
|
||||||
|
result |= str[len - 2] << 8;
|
||||||
|
result |= len << 16;
|
||||||
|
result |= static_cast<uint32_t>(str[0] << 24);
|
||||||
if (len >= 4)
|
if (len >= 4)
|
||||||
{
|
{
|
||||||
uint32_t hash = 0;
|
uint32_t hash = 0;
|
||||||
|
|
|
||||||
|
|
@ -2386,7 +2386,7 @@ namespace NifOsg
|
||||||
auto setBin_Traversal = [](osg::StateSet* ss) { ss->setRenderBinDetails(2, "TraversalOrderBin"); };
|
auto setBin_Traversal = [](osg::StateSet* ss) { ss->setRenderBinDetails(2, "TraversalOrderBin"); };
|
||||||
auto setBin_Inherit = [](osg::StateSet* ss) { ss->setRenderBinToInherit(); };
|
auto setBin_Inherit = [](osg::StateSet* ss) { ss->setRenderBinToInherit(); };
|
||||||
|
|
||||||
int lightmode = 1;
|
auto lightmode = Nif::NiVertexColorProperty::LightMode::LightMode_EmiAmbDif;
|
||||||
float emissiveMult = 1.f;
|
float emissiveMult = 1.f;
|
||||||
float specStrength = 1.f;
|
float specStrength = 1.f;
|
||||||
|
|
||||||
|
|
@ -2442,7 +2442,8 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
case Nif::NiVertexColorProperty::VertexMode::VertMode_SrcAmbDif:
|
case Nif::NiVertexColorProperty::VertexMode::VertMode_SrcAmbDif:
|
||||||
{
|
{
|
||||||
switch (vertprop->mLightingMode)
|
lightmode = vertprop->mLightingMode;
|
||||||
|
switch (lightmode)
|
||||||
{
|
{
|
||||||
case Nif::NiVertexColorProperty::LightMode::LightMode_Emissive:
|
case Nif::NiVertexColorProperty::LightMode::LightMode_Emissive:
|
||||||
{
|
{
|
||||||
|
|
@ -2565,7 +2566,7 @@ namespace NifOsg
|
||||||
if (mVersion <= Nif::NIFFile::VER_MW || !specEnabled)
|
if (mVersion <= Nif::NIFFile::VER_MW || !specEnabled)
|
||||||
mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
mat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||||
|
|
||||||
if (lightmode == 0)
|
if (lightmode == Nif::NiVertexColorProperty::LightMode::LightMode_Emissive)
|
||||||
{
|
{
|
||||||
osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK);
|
osg::Vec4f diffuse = mat->getDiffuse(osg::Material::FRONT_AND_BACK);
|
||||||
diffuse = osg::Vec4f(0, 0, 0, diffuse.a());
|
diffuse = osg::Vec4f(0, 0, 0, diffuse.a());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue