本文整理汇总了C++中Shader::GetGlossiness方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::GetGlossiness方法的具体用法?C++ Shader::GetGlossiness怎么用?C++ Shader::GetGlossiness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::GetGlossiness方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildShaders
// --[ Method ]---------------------------------------------------------------
//
// - Class : CStravaganzaMaxTools
//
// - prototype : bool BuildShaders()
//
// - Purpose : Builds the shader list from MAX's materials.
// Preview mode requires texture files to be stored with full
// path in order to load them. When we export, we only store the
// filename. Another thing is that in the export mode, we copy
// all textures into the path specified by the user if that
// option is checked.
//
// -----------------------------------------------------------------------------
bool CStravaganzaMaxTools::BuildShaders()
{
std::vector<Mtl*>::iterator it;
assert(m_vecShaders.empty());
if(!m_bPreview && m_bCopyTextures && m_strTexturePath == "")
{
CLogger::NotifyWindow("Textures won't be copied\nSpecify a valid output texture path first");
}
LOG.Write("\n\n-Building shaders: ");
for(it = m_vecMaterials.begin(); it != m_vecMaterials.end(); ++it)
{
Mtl* pMaxMaterial = *it;
assert(pMaxMaterial);
LOG.Write("\n %s", pMaxMaterial->GetName().data());
CShaderStandard* pShaderStd = new CShaderStandard;
pShaderStd->SetName(pMaxMaterial->GetName().data());
// Properties
StdMat2 *pMaxStandardMtl = NULL;
StdMat2 *pMaxBakedMtl = NULL;
float fAlpha;
if(pMaxMaterial->ClassID() == Class_ID(DMTL_CLASS_ID, 0))
{
pMaxStandardMtl = (StdMat2 *)pMaxMaterial;
}
else if(pMaxMaterial->ClassID() == Class_ID(BAKE_SHELL_CLASS_ID, 0))
{
pMaxStandardMtl = (StdMat2 *)pMaxMaterial->GetSubMtl(0);
pMaxBakedMtl = (StdMat2 *)pMaxMaterial->GetSubMtl(1);
}
if(pMaxStandardMtl)
{
// Standard material
fAlpha = pMaxStandardMtl->GetOpacity(0);
Shader* pMaxShader = pMaxStandardMtl->GetShader();
CVector4 v4Specular = ColorToVector4(pMaxStandardMtl->GetSpecular(0), 0.0f) * pMaxShader->GetSpecularLevel(0, 0);
pShaderStd->SetAmbient (ColorToVector4(pMaxStandardMtl->GetAmbient(0), 0.0f));
pShaderStd->SetDiffuse (ColorToVector4(pMaxStandardMtl->GetDiffuse(0), fAlpha));
pShaderStd->SetSpecular (v4Specular);
pShaderStd->SetShininess(pMaxShader->GetGlossiness(0, 0) * 128.0f);
if(pMaxStandardMtl->GetTwoSided() == TRUE)
{
pShaderStd->SetTwoSided(true);
}
// Need to cast to StdMat2 in order to get access to IsFaceted().
// ¿Is StdMat2 always the interface for standard materials?
if(((StdMat2*)pMaxStandardMtl)->IsFaceted())
{
pShaderStd->SetFaceted(true);
}
if(pMaxStandardMtl->GetWire() == TRUE)
{
pShaderStd->SetPostWire(true);
pShaderStd->SetWireLineThickness(pMaxStandardMtl->GetWireSize(0));
}
}
else
{
// Material != Standard
fAlpha = 1.0f; // pMaxMaterial->GetXParency();
pShaderStd->SetAmbient (ColorToVector4(pMaxMaterial->GetAmbient(), 0.0f));
pShaderStd->SetDiffuse (ColorToVector4(pMaxMaterial->GetDiffuse(), fAlpha));
pShaderStd->SetSpecular (CVector4(0.0f, 0.0f, 0.0f, 0.0f));
pShaderStd->SetShininess(0.0f);
}
// Layers
//.........这里部分代码省略.........