|
32 | 32 | #include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine |
33 | 33 |
|
34 | 34 | #include "ww3d.h" |
| 35 | +#include "texturefilter.h" |
35 | 36 |
|
36 | 37 | #include "Common/AudioSettings.h" |
37 | 38 | #include "Common/GameAudio.h" |
@@ -90,6 +91,49 @@ UnsignedInt OptionPreferences::getAntiAliasing() |
90 | 91 | return level; |
91 | 92 | } |
92 | 93 |
|
| 94 | +UnsignedInt OptionPreferences::getTextureFilterMode() |
| 95 | +{ |
| 96 | + OptionPreferences::const_iterator it = find("TextureFilter"); |
| 97 | + if (it == end()) |
| 98 | + return TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_BILINEAR; |
| 99 | + |
| 100 | + UnsignedInt filter = TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_NONE; |
| 101 | + if(stricmp(it->second.str(), "None") == 0) |
| 102 | + filter = TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_NONE; |
| 103 | + else if(stricmp(it->second.str(), "Point") == 0) |
| 104 | + filter = TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_POINT; |
| 105 | + else if (stricmp(it->second.str(), "Bilinear") == 0) |
| 106 | + filter = TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_BILINEAR; |
| 107 | + else if (stricmp(it->second.str(), "Trilinear") == 0) |
| 108 | + filter = TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_TRILINEAR; |
| 109 | + else if (stricmp(it->second.str(), "Anisotropic") == 0) |
| 110 | + filter = TextureFilterClass::TextureFilterMode::TEXTURE_FILTER_ANISOTROPIC; |
| 111 | + |
| 112 | + return filter; |
| 113 | +} |
| 114 | + |
| 115 | +UnsignedInt OptionPreferences::getTextureAnisotropyLevel() |
| 116 | +{ |
| 117 | + OptionPreferences::const_iterator it = find("AnisotropyLevel"); |
| 118 | + if (it == end()) |
| 119 | + return TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_2X; |
| 120 | + |
| 121 | + UnsignedInt level = atoi(it->second.str()); |
| 122 | + if (level <= TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_2X) |
| 123 | + level = TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_2X; |
| 124 | + else if (level <= TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_4X) |
| 125 | + level = TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_4X; |
| 126 | + else if (level <= TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_8X) |
| 127 | + level = TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_8X; |
| 128 | + else if (level <= TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_16X) |
| 129 | + level = TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_16X; |
| 130 | + |
| 131 | + if (level > TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_16X) |
| 132 | + level = TextureFilterClass::AnisotropicFilterMode::TEXTURE_FILTER_ANISOTROPIC_16X; |
| 133 | + |
| 134 | + return level; |
| 135 | +} |
| 136 | + |
93 | 137 | Int OptionPreferences::getCampaignDifficulty() |
94 | 138 | { |
95 | 139 | OptionPreferences::const_iterator it = find("CampaignDifficulty"); |
|
0 commit comments