由于顯示卡技術(shù)發(fā)展迅猛,不同的渲染技術(shù)層出不窮。要對(duì)付這種市場(chǎng)的變化,就不能固定一種特定的顯示特性,那么就需要一個(gè)配置文件來定義這種特性。第二人生這個(gè)游戲,是需要特定顯示特性才能運(yùn)行的,如果不符合這種最低要求的環(huán)境就不能運(yùn)行它。下面就來分析類LLFeatureManager,看看第二人生是怎么樣實(shí)現(xiàn)這個(gè)功能的。
類
LLFeatureManager的聲明代碼如下:
#001?class LLFeatureManager : public LLFeatureList
#002?{
#003?public:
#004?
?? LLFeatureManager() : mInited(FALSE), mTableVersion(0), mSafe(FALSE), mGPUClass(GPU_CLASS_UNKNOWN) {}
#005?
?? ~LLFeatureManager() {cleanupFeatureTables();}
#006?
?
下面函數(shù)加載文件顯示特性。
#007?
?? // initialize this by loading feature table and gpu table
#008?
?? void init();
#009?
#010?
?? void maskCurrentList(const char *name); // Mask the current feature list with the named list
#011?
?
下面函數(shù)從文件里加載顯示特性。
#012?
?? BOOL loadFeatureTables();
#013?
#014?
?? EGPUClass getGPUClass() ??????????? { return mGPUClass; }
#015?
?? std::string& getGPUString() ??????? { return mGPUString; }
#016?
?? BOOL isGPUSupported()?????????????? { return mGPUSupported; }
#017?
??
?
清除顯示特性表。
#018?
?? void cleanupFeatureTables();
#019?
?
獲取特性文件的版本。
#020?
?? S32 getVersion() const????????????? { return mTableVersion; }
#021?
?? void setSafe(const BOOL safe)?????? { mSafe = safe; }
#022?
?? BOOL isSafe() const???????????????? { return mSafe; }
#023?
?
查找給出的名稱屬性表。
#024?
?? LLFeatureList *findMask(const char *name);
#025?
?? BOOL maskFeatures(const char *name);
#026?
#027?
?? // set the graphics to low, medium, high, or ultra.
#028?
?? // skipFeatures forces skipping of mostly hardware settings
#029?
?? // that we don't want to change when we change graphics
#030?
?? // settings
#031?
?? void setGraphicsLevel(S32 level, bool skipFeatures);
#032?
??
?
應(yīng)用
GPU的特性。
#033?
?? void applyBaseMasks();
#034?
?? void applyRecommendedSettings();
#035?
#036?
?? // apply the basic masks.?Also, skip one saved
#037?
?? // in the skip list if true
#038?
?? void applyFeatures(bool skipFeatures);
#039?
#040?protected:
?
加載
GPU的類型。
#041?
?? void loadGPUClass();
#042?
?? void initBaseMask();
#043?
#044?
#045?
?? std::map<LLString, LLFeatureList *> mMaskList;
#046?
?? std::set<LLString> mSkippedFeatures;
#047?
?? BOOL??????? mInited;
#048?
?? S32???????? mTableVersion;
#049?
?? BOOL??????? mSafe;????????????????? // Reinitialize everything to the "safe" mask
#050?
?? EGPUClass?? mGPUClass;
#051?
?? std::string mGPUString;
#052?
?? BOOL??????? mGPUSupported;
#053?};
#054?
?
使用這個(gè)類時(shí),先調(diào)用函數(shù)
init來實(shí)始化,然后通過函數(shù)isFeatureAvailable等獲取顯示特性,根據(jù)這些特性來判斷當(dāng)前的顯示卡是否滿足要求。
?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
