本文整理汇总了C++中BitmapTex::SetAlphaSource方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapTex::SetAlphaSource方法的具体用法?C++ BitmapTex::SetAlphaSource怎么用?C++ BitmapTex::SetAlphaSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapTex
的用法示例。
在下文中一共展示了BitmapTex::SetAlphaSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testStream
Texmap* M2Importer::createTexture(LPCTSTR fileName)
{
BitmapManager* bmpMgr = TheManager;
size_t pathSlashPos = m_modelName.find_last_of('\\');
string pathName = m_modelName.substr(0, pathSlashPos + 1);
// 将贴图文件名改为当前目录下的tga文件
string origFileName = fileName;
size_t dotPos = origFileName.find_last_of('.');
if (dotPos != string::npos)
origFileName = origFileName.substr(0, dotPos);
size_t slashPos = origFileName.find_last_of('\\');
if (slashPos != string::npos)
{
++slashPos;
origFileName = origFileName.substr(slashPos, origFileName.length() - slashPos);
}
pathName += string("texture\\");
pathName += origFileName;
pathName.append(".tga");
m_logStream << "Model Texture Name: " << pathName << endl;
TSTR newFileName = pathName.c_str();
if (origFileName.length())
{
// 改成用系统的检查文件是否存在的API
ifstream testStream(newFileName, ios::binary | ios::in);
if (testStream.fail())
{
string errstr = string("Load texture error. filename: ") + string(newFileName);
errstr += string("\n\nOriginal file: ");
errstr += string(fileName);
MessageBox(NULL, errstr.c_str(), "TBD: Error.", MB_OK);
m_logStream << errstr << endl;
}
else
testStream.close();
}
if (bmpMgr->CanImport(newFileName))
{
BitmapTex* bmpTex = NewDefaultBitmapTex();
bmpTex->SetName(newFileName);
bmpTex->SetMapName(newFileName);
bmpTex->SetAlphaAsMono(TRUE);
bmpTex->SetAlphaSource(ALPHA_FILE);
return bmpTex;
}
return 0;
}
示例2: CreateTexture
Texmap* NifImporter::CreateTexture(const string& filename)
{
if (filename.empty())
return NULL;
BitmapManager *bmpMgr = TheManager;
if (bmpMgr->CanImport(filename.c_str())){
BitmapTex *bmpTex = NewDefaultBitmapTex();
string name = filename;
if (name.empty()) {
TCHAR buffer[MAX_PATH];
_tcscpy(buffer, PathFindFileName(filename.c_str()));
PathRemoveExtension(buffer);
name = buffer;
}
bmpTex->SetName(name.c_str());
bmpTex->SetMapName(const_cast<TCHAR*>(FindImage(filename).c_str()));
bmpTex->SetAlphaAsMono(TRUE);
bmpTex->SetAlphaSource(ALPHA_DEFAULT);
bmpTex->SetFilterType(FILTER_PYR);
if (showTextures) {
bmpTex->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE);
bmpTex->ActivateTexDisplay(TRUE);
bmpTex->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
}
if (UVGen *uvGen = bmpTex->GetTheUVGen()){
uvGen->SetTextureTiling(0);
}
return bmpTex;
}
return NULL;
}