Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/actor_animation/GlutWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ void updatePose(double _time)
for (auto &v : g_visuals)
{
//! [update pose]
std::map<std::string, gz::math::Matrix4d> animFrames;
animFrames = g_skelAnim->PoseAt(_time, true);
std::map<std::string, gz::math::Matrix4d> animFrames =
g_skelAnim->PoseAt(_time, true);
std::map<std::string, gz::math::Matrix4d> skinFrames;
for (auto pair : animFrames)
for (const auto &pair : animFrames)
{
std::string animNodeName = pair.first;
auto animTf = pair.second;
const auto &animNodeName = pair.first;
const auto &animTf = pair.second;

std::string skinName =
g_skel->NodeNameAnimToSkin(g_animIdx, animNodeName);
Expand Down
4 changes: 2 additions & 2 deletions examples/actor_animation/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ int main(int _argc, char** _argv)
std::vector<VisualPtr> visuals;
ic::SkeletonPtr skel = nullptr;

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
std::cout << "Starting engine [" << engineName << "]" << std::endl;
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand Down
8 changes: 4 additions & 4 deletions examples/boundingbox_camera/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ int main(int _argc, char** _argv)
const std::string type3d = "3D";
const std::string type2dVisible = "2D_visible";
const std::string type2dFull = "2D_full";
if (type2dVisible.compare(_argv[1]) == 0)
if (type2dVisible == _argv[1])
{
bboxType = BoundingBoxType::BBT_VISIBLEBOX2D;
}
else if (type2dFull.compare(_argv[1]) == 0)
else if (type2dFull == _argv[1])
{
bboxType = BoundingBoxType::BBT_FULLBOX2D;
}
else if (type3d.compare(_argv[1]) != 0)
else if (type3d != _argv[1])
{
gzerr << "Invalid bounding box type given. Valid options are: "
<< type3d << ", " << type2dVisible << ", or "
Expand All @@ -298,7 +298,7 @@ int main(int _argc, char** _argv)
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand Down
5 changes: 2 additions & 3 deletions examples/camera_tracking/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand All @@ -163,7 +163,6 @@ int main(int _argc, char** _argv)
}
catch (...)
{
// std::cout << ex.what() << std::endl;
std::cerr << "Error starting up: " << engineName << std::endl;
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_scene_viewer/ManualSceneDemo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ CameraPtr ManualSceneDemo::CurrentCamera()
//////////////////////////////////////////////////
void ManualSceneDemo::Run()
{
for (auto builder : this->builders)
for (auto &builder : this->builders)
{
builder->SetScenes(this->scenes);
builder->SetCameras(this->cameras);
Expand Down Expand Up @@ -199,7 +199,7 @@ int main(int _argc, char** _argv)
}

std::map<std::string, std::string> params;
if (ogreEngineName.compare("ogre2") == 0
if (ogreEngineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand Down
32 changes: 16 additions & 16 deletions examples/custom_scene_viewer/SceneBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void SceneBuilder::SetCameras(const CameraList &_cameras)
//////////////////////////////////////////////////
void SceneBuilder::BuildScenes()
{
for (auto scene : this->scenes)
for (auto &scene : this->scenes)
{
this->ClearScene(scene);
this->BuildScene(scene);
Expand All @@ -65,7 +65,7 @@ void SceneBuilder::BuildScenes()
//////////////////////////////////////////////////
void SceneBuilder::ResetCameras()
{
for (auto camera : this->cameras)
for (auto &camera : this->cameras)
{
this->ResetCamera(camera);
}
Expand All @@ -74,7 +74,7 @@ void SceneBuilder::ResetCameras()
//////////////////////////////////////////////////
void SceneBuilder::UpdateScenes()
{
for (auto scene : this->scenes)
for (auto &scene : this->scenes)
{
this->UpdateScene(scene);
}
Expand Down Expand Up @@ -110,7 +110,7 @@ void SceneBuilder::UpdateScene(ScenePtr)
//////////////////////////////////////////////////
void SceneBuilder::RegisterMaterials()
{
for (auto scene : this->scenes)
for (auto &scene : this->scenes)
{
this->RegisterMaterials(scene);
}
Expand Down Expand Up @@ -139,7 +139,6 @@ void SceneBuilder::RegisterMaterials(ScenePtr _scene)
mat->SetReflectivity(0);
}


if (!_scene->MaterialRegistered("Green"))
{
MaterialPtr mat = _scene->CreateMaterial("Green");
Expand Down Expand Up @@ -170,14 +169,15 @@ void SceneBuilder::RegisterMaterials(ScenePtr _scene)
mat->SetReflectivity(0);
}

std::vector<std::string> baseNames;
baseNames.push_back("Blue");
baseNames.push_back("Green");
baseNames.push_back("Red");
baseNames.push_back("White");
baseNames.push_back("Yellow");
std::vector<std::string> baseNames = {
"Blue",
"Green",
"Red",
"White",
"Yellow"
};

for (auto baseName : baseNames)
for (const auto &baseName : baseNames)
{
std::string parentName = baseName;
std::string childName = "Texture" + baseName;
Expand All @@ -189,7 +189,7 @@ void SceneBuilder::RegisterMaterials(ScenePtr _scene)
}
}

for (auto baseName : baseNames)
for (const auto &baseName : baseNames)
{
std::string parentName = "Texture" + baseName;
std::string childName = "Normal" + baseName;
Expand All @@ -202,7 +202,7 @@ void SceneBuilder::RegisterMaterials(ScenePtr _scene)
}
}

for (auto baseName : baseNames)
for (const auto &baseName : baseNames)
{
std::string parentName = "Texture" + baseName;
std::string childName = "Reflect" + baseName;
Expand All @@ -214,7 +214,7 @@ void SceneBuilder::RegisterMaterials(ScenePtr _scene)
}
}

for (auto baseName : baseNames)
for (const auto &baseName : baseNames)
{
std::string parentName = "Normal" + baseName;
std::string childName = "NormalReflect" + baseName;
Expand All @@ -226,7 +226,7 @@ void SceneBuilder::RegisterMaterials(ScenePtr _scene)
}
}

for (auto baseName : baseNames)
for (const auto &baseName : baseNames)
{
std::string parentName = baseName;
std::string childName = "Trans" + baseName;
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_shaders_uniforms/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand Down
2 changes: 1 addition & 1 deletion examples/depth_camera/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int main(int _argc, char** _argv)
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand Down
5 changes: 2 additions & 3 deletions examples/frustum_visual/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand All @@ -178,7 +178,6 @@ int main(int _argc, char** _argv)
}
catch (...)
{
// std::cout << ex.what() << std::endl;
std::cerr << "Error starting up: " << engineName << std::endl;
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/global_illumination/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ int main(int _argc, char **_argv)
std::vector<CameraPtr> cameras;

std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::VULKAN)
{
params["vulkan"] = "1";
Expand Down
5 changes: 2 additions & 3 deletions examples/heightmap/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand All @@ -358,7 +358,6 @@ int main(int _argc, char** _argv)
}
catch (...)
{
// std::cout << ex.what() << std::endl;
std::cerr << "Error starting up: " << engineName << std::endl;
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lidar_visual/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
std::cout << "Starting engine [" << engineName << "]" << std::endl;
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand Down
4 changes: 2 additions & 2 deletions examples/lux_core_engine/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ int main(int _argc, char **_argv)

engineNames.push_back("LuxCoreEngine");

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
Expand All @@ -194,7 +194,7 @@ int main(int _argc, char **_argv)
{
cameras.push_back(camera);
}
} catch (std::exception &ex) {
} catch (const std::exception &ex) {
std::cout << ex.what() << std::endl;
}
}
Expand Down
5 changes: 2 additions & 3 deletions examples/mesh_viewer/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand All @@ -187,7 +187,6 @@ int main(int _argc, char** _argv)
}
catch (...)
{
// std::cout << ex.what() << std::endl;
std::cerr << "Error starting up: " << engineName << std::endl;
}
}
Expand Down
5 changes: 2 additions & 3 deletions examples/mouse_picking/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ int main(int _argc, char** _argv)

engineNames.push_back(ogreEngineName);

for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand All @@ -166,7 +166,6 @@ int main(int _argc, char** _argv)
}
catch (...)
{
// std::cout << ex.what() << std::endl;
std::cerr << "Error starting up: " << engineName << std::endl;
}
}
Expand Down
5 changes: 2 additions & 3 deletions examples/ogre2_demo/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ int main(int _argc, char** _argv)
}

engineNames.push_back("ogre2");
for (auto engineName : engineNames)
for (const auto &engineName : engineNames)
{
try
{
std::map<std::string, std::string> params;
if (engineName.compare("ogre2") == 0
if (engineName == "ogre2"
&& graphicsApi == GraphicsAPI::METAL)
{
params["metal"] = "1";
Expand All @@ -350,7 +350,6 @@ int main(int _argc, char** _argv)
}
catch (...)
{
// std::cout << ex.what() << std::endl;
std::cerr << "Error starting up: " << engineName << std::endl;
}
}
Expand Down
Loading
Loading