Skip to content

Commit

Permalink
Merge branch 'main' into chapulina/7/switcher_crash
Browse files Browse the repository at this point in the history
  • Loading branch information
iche033 authored Mar 22, 2022
2 parents 2241990 + 6f5faaf commit dbbbad7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/ignition/rendering/base/BaseCamera.hh
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ namespace ignition
{
math::Pose3d targetCamPose = math::Pose3d(this->followOffset,
this->WorldRotation());
targetCamPose += this->followNode->WorldPose();
targetCamPose = this->followNode->WorldPose() * targetCamPose;

math::Vector3d pos = this->WorldPosition() +
(targetCamPose.Pos() - this->WorldPosition()) * this->followPGain;
Expand All @@ -375,7 +375,7 @@ namespace ignition
}
else
{
targetPose += this->trackNode->WorldPose();
targetPose = this->trackNode->WorldPose() * targetPose;
}

math::Pose3d p =
Expand Down
2 changes: 1 addition & 1 deletion include/ignition/rendering/base/BaseJointVisual.hh
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ namespace ignition

// get rotation of joint visual in model frame
ignition::math::Quaterniond quatFromModel =
(this->LocalPose() + parentInitPose).Rot();
(parentInitPose * this->LocalPose()).Rot();

// rotate arrow visual so that the axis vector applies to the model
// frame.
Expand Down
2 changes: 1 addition & 1 deletion include/ignition/rendering/base/BaseNode.hh
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ namespace ignition
return pose;
}

return pose + parent->WorldPose();
return parent->WorldPose() * pose;
}

//////////////////////////////////////////////////
Expand Down
23 changes: 16 additions & 7 deletions ogre2/src/Ogre2Material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,11 @@ void Ogre2Material::UpdateShaderParams(ConstShaderParamsPtr _params,
continue;
}

if (!_ogreParams->_findNamedConstantDefinition(name_param.first))
if (!_ogreParams->_findNamedConstantDefinition(name_param.first) &&
!(Ogre2RenderEngine::Instance()->GraphicsAPI() !=
GraphicsAPI::OPENGL &&
(ShaderParam::PARAM_TEXTURE == name_param.second.Type() ||
ShaderParam::PARAM_TEXTURE_CUBE == name_param.second.Type())))
{
ignwarn << "Unable to find GPU program parameter: "
<< name_param.first << std::endl;
Expand Down Expand Up @@ -862,12 +866,6 @@ Ogre::MaterialPtr Ogre2Material::Material()
IGN_ASSERT(false, "Impossible path!");
}

auto mat = this->dataPtr->ogreSolidColorMat;
auto pass = mat->getTechnique(0u)->getPass(0);
pass->setFragmentProgram(this->dataPtr->ogreSolidColorShader->getName());
auto psParams = pass->getFragmentProgramParameters();
psParams->setNamedAutoConstant("inColor",
Ogre::GpuProgramParameters::ACT_CUSTOM, 1u);
}

return this->ogreMaterial;
Expand Down Expand Up @@ -1210,6 +1208,17 @@ void Ogre2Material::SetVertexShader(const std::string &_path)
this->dataPtr->ogreSolidColorShader->setParameter(
"shader_reflection_pair_hint", vertexShader->getName());

// Set 'inColor' on the cloned pixel shader. For Metal this must occur
// after vertex shader has been created and the reflection pair set.
{
auto mat = this->dataPtr->ogreSolidColorMat;
auto pass = mat->getTechnique(0u)->getPass(0);
pass->setFragmentProgram(this->dataPtr->ogreSolidColorShader->getName());
auto psParams = pass->getFragmentProgramParameters();
psParams->setNamedAutoConstant("inColor",
Ogre::GpuProgramParameters::ACT_CUSTOM, 1u);
}

Ogre::MaterialPtr mat[2] = { mainMat, this->dataPtr->ogreSolidColorMat };

for (int i = 0; i < 2; ++i)
Expand Down

0 comments on commit dbbbad7

Please sign in to comment.