本文整理汇总了C++中BitmapTex::GetMapName方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapTex::GetMapName方法的具体用法?C++ BitmapTex::GetMapName怎么用?C++ BitmapTex::GetMapName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapTex
的用法示例。
在下文中一共展示了BitmapTex::GetMapName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStdMatBitmapTex
BitmapTex* SceneExportUtil::getStdMatBitmapTex( StdMat* stdmat, int id )
{
StdMat2* stdmat2 = 0;
int channel = id;
if ( stdmat->SupportsShaders() )
{
stdmat2 = static_cast<StdMat2*>( stdmat );
channel = stdmat2->StdIDToChannel( id );
}
if ( stdmat->MapEnabled(channel) )
{
Texmap* tex = stdmat->GetSubTexmap(channel);
if ( tex && tex->ClassID() == Class_ID(BMTEX_CLASS_ID,0) &&
(!stdmat2 || 2 == stdmat2->GetMapState(channel)) )
{
BitmapTex* bmptex = static_cast<BitmapTex*>(tex);
if ( bmptex->GetMapName() )
{
return bmptex;
}
}
}
return 0;
}
示例2: reload_texture_cf
Value* reload_texture_cf (Value** arg_list, int count)
{
// Make sure we have the correct number of arguments (1)
check_arg_count(reload_texture, 1, count);
char *message = "NelReloadTexture [BitmapTex]";
//type_check (arg_list[0], TextureMap, message);
// Get a good interface pointer
Interface *ip = MAXScript_interface;
theCNelExport.init (false, false, ip, true);
// The 2 filenames
Texmap *texmap = arg_list[0]->to_texmap ();
// BitmapTex ?
if (texmap->ClassID() == Class_ID (BMTEX_CLASS_ID, 0))
{
// Cast
BitmapTex *bitmap = (BitmapTex*)texmap;
// Reload
bitmap->ReloadBitmapAndUpdate ();
// Tell the bitmap has changed
BroadcastNotification (NOTIFY_BITMAP_CHANGED, (void *)bitmap->GetMapName());
return &true_value;
}
return &false_value;
}
示例3: ExtractTexName
//----------------------------------------------------------------------------
// Material parsing
//----------------------------------------------------------------------------
BOOL CEditableObject::ExtractTexName(Texmap *src, LPSTR dest)
{
if( src->ClassID() != Class_ID(BMTEX_CLASS_ID,0) )
return FALSE;
BitmapTex *bmap = (BitmapTex*)src;
_splitpath( bmap->GetMapName(), 0, 0, dest, 0 );
EFS.AppendFolderToName(dest,1,TRUE);
return TRUE;
}
示例4: GetStdMtlChannelBitmapFileName
bool SGP_MaxInterface::GetStdMtlChannelBitmapFileName( StdMat* pStdMat, int nChannel, TCHAR szFileName[] )
{
if( !pStdMat )
{
assert( false );
return false;
}
Texmap *tx = pStdMat->GetSubTexmap(nChannel);
if( !tx )
return false;
if(tx->ClassID() != Class_ID(BMTEX_CLASS_ID,0))
return false;
BitmapTex *bmt = (BitmapTex*)tx;
_tcscpy( szFileName, bmt->GetMapName() );
return true;
}
示例5: IOException
P(GmMaterial) GmUtil::createGmMaterial( Mtl* material, Mtl* bakedmaterial )
{
require( material );
P(GmMaterial) s = new GmMaterial;
// get name
static int unnamedCount = 0;
if ( material->GetName().data() )
s->name = material->GetName().data();
else
s->name = "noname #"+String::valueOf( ++unnamedCount );
// Standard material (+Diffuse) (+ Reflection)
if ( material->ClassID() == Class_ID(DMTL_CLASS_ID,0) )
{
StdMat* stdmat = static_cast<StdMat*>(material);
StdMat* bakedmat = static_cast<StdMat*>(bakedmaterial);
// StdMat2?
StdMat2* stdmat2 = 0;
if ( stdmat->SupportsShaders() )
stdmat2 = static_cast<StdMat2*>( stdmat );
// uniform transparency
s->opacity = stdmat->GetOpacity(0);
// self illumination
s->selfIllum = stdmat->GetSelfIllum(0);
// two-sided material?
s->twosided = ( 0 != stdmat->GetTwoSided() );
// blending mode
s->blend = GmMaterial::BLEND_COPY;
if ( s->opacity < 1.f )
s->blend = GmMaterial::BLEND_MULTIPLY;
if ( stdmat->GetTransparencyType() == TRANSP_ADDITIVE )
s->blend = GmMaterial::BLEND_ADD;
// diffuse color
s->diffuseColor = toColorf( stdmat->GetDiffuse(0) );
// specular highlights
float shinStr = stdmat->GetShinStr(0);
s->specular = (shinStr > 0.f);
if ( s->specular )
{
float shininess = stdmat->GetShininess(0);
s->specularExponent = Math::pow( 2.f, shininess*10.f + 2.f );
s->specularColor = toColorf( stdmat->GetSpecular(0) ) * shinStr;
}
if ( bakedmat )
{
shinStr = bakedmat->GetShinStr(0);
s->specular = (shinStr > 0.f);
if ( s->specular )
{
float shininess = bakedmat->GetShininess(0);
s->specularExponent = Math::pow( 2.f, shininess*10.f + 2.f );
s->specularColor = toColorf( bakedmat->GetSpecular(0) ) * shinStr;
}
}
// diffuse texture layer
BitmapTex* tex = SceneExportUtil::getStdMatBitmapTex( stdmat, ID_DI );
if ( tex )
{
GmMaterial::TextureLayer& layer = s->diffuseLayer;
setLayerTex( layer, tex, s->name );
}
// opacity texture layer
tex = SceneExportUtil::getStdMatBitmapTex( stdmat, ID_OP );
if ( tex )
{
GmMaterial::TextureLayer& layer = s->opacityLayer;
setLayerTex( layer, tex, s->name );
// check alpha channel validity
Bitmap* bmp = tex->GetBitmap(0);
if ( bmp && !bmp->HasAlpha() )
Debug::printlnError( "Material \"{0}\" opacity map \"{1}\" must have image alpha channel.", s->name, tex->GetMapName() );
//throw IOException( Format("Material \"{0}\" opacity map \"{1}\" must have image alpha channel.", s->name, tex->GetMapName()) );
s->blend = GmMaterial::BLEND_MULTIPLY;
// check that opacity map is the same as diffuse map
if ( s->opacityLayer.filename != s->diffuseLayer.filename )
throw IOException( Format("Material \"{0}\" diffuse bitmap needs to be the same in opacity map.(diffuse map is \"{1}\" and opacity map is \"{2}\")", s->name, s->diffuseLayer.filename, s->opacityLayer.filename) );
if ( s->opacityLayer.coordset != s->diffuseLayer.coordset )
throw IOException( Format("Material \"{0}\" diffuse map texture coordinate set needs to be the same in opacity map.", s->name) );
if ( s->opacityLayer.env != s->diffuseLayer.env )
throw IOException( Format("Material \"{0}\" diffuse map texture coordinate generator needs to be the same in opacity map.", s->name) );
}
// reflection texture layer
tex = SceneExportUtil::getStdMatBitmapTex( stdmat, ID_RL );
if ( tex )
{
GmMaterial::TextureLayer& layer = s->reflectionLayer;
//.........这里部分代码省略.........
示例6: callback
//.........这里部分代码省略.........
mtlidFace = 0;
}
Mtl *pmtlFace = pmtlNode->GetSubMtl(mtlidFace);
ASSERT_AND_ABORT(pmtlFace != NULL, "NULL Sub-material returned");
if ((pmtlFace->ClassID() == Class_ID(MULTI_CLASS_ID, 0) && pmtlFace->IsMultiMtl()))
{
// it's a sub-sub material. Gads.
pmtlFace = pmtlFace->GetSubMtl(mtlidFace);
ASSERT_AND_ABORT(pmtlFace != NULL, "NULL Sub-material returned");
}
if (!(pmtlFace->ClassID() == Class_ID(DMTL_CLASS_ID, 0)))
{
sprintf(st_szDBG,
"ERROR--Sub-material with index %d (used in node %s) isn't a 'default/standard' material [%x].",
mtlidFace, (char*)strNodeName, pmtlFace->ClassID());
ASSERT_AND_ABORT(FALSE, st_szDBG);
}
StdMat *pstdmtlFace = (StdMat*)pmtlFace;
Texmap *ptexmap = pstdmtlFace->GetSubTexmap(ID_DI);
// ASSERT_AND_ABORT(ptexmap != NULL, "NULL diffuse texture")
if (ptexmap != NULL)
{
if (!(ptexmap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0)))
{
sprintf(st_szDBG,
"ERROR--Sub-material with index %d (used in node %s) doesn't have a bitmap as its diffuse texture.",
mtlidFace, (char*)strNodeName);
ASSERT_AND_ABORT(FALSE, st_szDBG);
}
BitmapTex *pbmptex = (BitmapTex*)ptexmap;
strcpy(szBitmapName, pbmptex->GetMapName());
TSTR strPath, strFile;
SplitPathFile(TSTR(szBitmapName), &strPath, &strFile);
strcpy(szBitmapName,strFile);
}
}
UVVert UVvertex0( 0, 0, 0 );
UVVert UVvertex1( 1, 0, 0 );
UVVert UVvertex2( 0, 1, 0 );
// All faces must have textures assigned to them
if (pface->flags & HAS_TVERTS)
{
// Get TVface's 3 indexes into the Mesh's TVertex array(s).
DWORD iTVertex0 = ptvface->getTVert(0);
DWORD iTVertex1 = ptvface->getTVert(1);
DWORD iTVertex2 = ptvface->getTVert(2);
ASSERT_AND_ABORT((int)iTVertex0 < pmesh->getNumTVerts(), "Bogus TVertex 0 index");
ASSERT_AND_ABORT((int)iTVertex1 < pmesh->getNumTVerts(), "Bogus TVertex 1 index");
ASSERT_AND_ABORT((int)iTVertex2 < pmesh->getNumTVerts(), "Bogus TVertex 2 index");
// Get the 3 TVertex's for this TVFace
// NOTE: I'm using getRVertPtr instead of getRVert to work around a 3DSMax bug
UVvertex0 = pmesh->getTVert(iTVertex0);
UVvertex1 = pmesh->getTVert(iTVertex1);
UVvertex2 = pmesh->getTVert(iTVertex2);
}
else
{
//sprintf(st_szDBG, "ERROR--Node %s has a textureless face. All faces must have an applied texture.", (char*)strNodeName);
//ASSERT_AND_ABORT(FALSE, st_szDBG);
}
示例7: ConvertMaterial
//----------------------------------------------------------------------------
void SceneBuilder::ConvertMaterial (Mtl &mtl, MtlTree &mtlTree)
{
// 光照属性
PX2::Shine *shine = new0 PX2::Shine;
Color color = mtl.GetAmbient();
float alpha = 1.0f - mtl.GetXParency();
shine->Ambient = PX2::Float4(color.r, color.g, color.b, 1.0f);
color = mtl.GetDiffuse();
shine->Diffuse = PX2::Float4(color.r, color.g, color.b, alpha);
color = mtl.GetSpecular();
float shininess = mtl.GetShininess()*2.0f;
shine->Specular = PX2::Float4(color.r, color.g, color.b, shininess);
const char *name = (const char*)mtl.GetName();
shine->SetName(name);
mtlTree.SetShine(shine);
bool IsDirect9Shader = false;
if (mtl.ClassID() == Class_ID(CMTL_CLASS_ID, 0)
|| mtl.ClassID() == Class_ID(DMTL_CLASS_ID, 0))
{
StdMat2 *stdMat2 = (StdMat2*)(&mtl);
Interval valid = FOREVER;
stdMat2->Update(mTimeStart, valid);
std::string strName(stdMat2->GetName());
bool doubleSide = (stdMat2->GetTwoSided()==1);
char strBitMapName[256];
memset(strBitMapName, 0, 256*sizeof(char));
std::string resourcePath;
PX2::Shader::SamplerFilter filter = PX2::Shader::SF_LINEAR_LINEAR;
PX2::Shader::SamplerCoordinate uvCoord = PX2::Shader::SC_REPEAT;
PX2_UNUSED(uvCoord);
if (stdMat2->MapEnabled(ID_DI))
{
BitmapTex *tex = (BitmapTex*)stdMat2->GetSubTexmap(ID_DI);
BitmapInfo bI;
const char *mapName = tex->GetMapName();
TheManager->GetImageInfo(&bI, mapName);
strcpy(strBitMapName, bI.Name());
std::string fullName = std::string(strBitMapName);
std::string::size_type sizeT = fullName.find_first_not_of(mSettings->SrcRootDir);
resourcePath = std::string(strBitMapName).substr(sizeT);
StdUVGen* uvGen = tex->GetUVGen();
PX2_UNUSED(uvGen);
int filType = tex->GetFilterType();
switch (filType)
{
case FILTER_PYR:
filter = PX2::Shader::SF_LINEAR_LINEAR;
break;
case FILTER_SAT:
filter = PX2::Shader::SF_NEAREST;
break;
default:
break;
}
}
else
{
sprintf(strBitMapName, "%s/%s", mSettings->SrcRootDir, PX2_DEFAULT_TEXTURE);
resourcePath = PX2_DEFAULT_TEXTURE;
}
PX2::Texture2D *tex2d = PX2::DynamicCast<PX2::Texture2D>(
PX2::ResourceManager::GetSingleton().BlockLoad(strBitMapName));
tex2d->SetResourcePath(resourcePath);
if (tex2d)
{
PX2::Texture2DMaterial *tex2dMtl = new0 PX2::Texture2DMaterial(filter,
uvCoord, uvCoord);
if (doubleSide)
{
tex2dMtl->GetCullProperty(0, 0)->Enabled = false;
}
PX2::MaterialInstance *instance = tex2dMtl->CreateInstance(tex2d);
mtlTree.SetMaterialInstance(instance);
}
else
{
PX2::VertexColor4Material *vcMtl = new0 PX2::VertexColor4Material();
PX2::MaterialInstance *instance = vcMtl->CreateInstance();
mtlTree.SetMaterialInstance(instance);
}
}
else if (mtl.ClassID() == Class_ID(MULTI_CLASS_ID, 0))
{
}
//.........这里部分代码省略.........