Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5532: Add utility mapping Material::SurfaceType <=> string
- Loading branch information
1 parent
1c0f9a7
commit 195e303
Showing
9 changed files
with
123 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#pragma once | ||
|
||
#include <map> | ||
#include "ishaders.h" | ||
|
||
namespace shaders | ||
{ | ||
|
||
constexpr std::pair<const char*, Material::SurfaceType> SurfaceTypeMapping[] | ||
{ | ||
{ "metal", Material::SURFTYPE_METAL }, | ||
{ "stone", Material::SURFTYPE_STONE }, | ||
{ "flesh", Material::SURFTYPE_FLESH }, | ||
{ "wood", Material::SURFTYPE_WOOD }, | ||
{ "cardboard", Material::SURFTYPE_CARDBOARD }, | ||
{ "liquid", Material::SURFTYPE_LIQUID }, | ||
{ "glass", Material::SURFTYPE_GLASS }, | ||
{ "plastic", Material::SURFTYPE_PLASTIC }, | ||
{ "ricochet", Material::SURFTYPE_RICOCHET }, | ||
{ "surftype10", Material::SURFTYPE_10 }, | ||
{ "surftype11", Material::SURFTYPE_11 }, | ||
{ "surftype12", Material::SURFTYPE_12 }, | ||
{ "surftype13", Material::SURFTYPE_13 }, | ||
{ "surftype14", Material::SURFTYPE_14 }, | ||
{ "surftype15", Material::SURFTYPE_15 } | ||
}; | ||
|
||
inline std::string getStringForSurfaceType(Material::SurfaceType type) | ||
{ | ||
for (const auto& pair : SurfaceTypeMapping) | ||
{ | ||
if (type == pair.second) | ||
{ | ||
return pair.first; | ||
} | ||
} | ||
|
||
return std::string(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.