本文整理汇总了C++中CShader::setVec2D方法的典型用法代码示例。如果您正苦于以下问题:C++ CShader::setVec2D方法的具体用法?C++ CShader::setVec2D怎么用?C++ CShader::setVec2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShader
的用法示例。
在下文中一共展示了CShader::setVec2D方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareMaterial
bool CRenderSystem::prepareMaterial(/*const */CMaterial& material, float fOpacity) // 由于使用了自动注册纹理的机制,很遗憾的导致不能用“const”
{
CTextureMgr& TM = GetTextureMgr();
for (size_t i=0;i<8;++i)
{
if (material.uTexture[i]==-1)
{
material.uTexture[i] = TM.RegisterTexture(material.getTexture(i));
}
// ----
SetTexture(i, material.uTexture[i]);
// ----
if (material.uTexture[i]==0)
{
break;
}
}
if (material.uShader==-1)
{
material.uShader = GetShaderMgr().registerItem(material.getShader());
}
// ----
SetLightingEnabled(material.bLightingEnabled);
SetCullingMode((CullingMode)material.uCull);
// ----
SetAlphaTestFunc(material.bAlphaTest, (CompareFunction)material.nAlphaTestCompare, material.uAlphaTestValue);
SetBlendFunc(material.bBlend, (SceneBlendOperation)material.nBlendOP, (SceneBlendFactor)material.nBlendSrc, (SceneBlendFactor)material.nBlendDest);
SetDepthBufferFunc(material.bDepthTest,material.bDepthWrite);
// ----
if (0==material.uShader)
{
for (size_t i=0;i<8;++i)
{
CMaterial::TextureOP& texOP = material.textureOP[i];
SetTextureColorOP(i, (TextureBlendOperation)texOP.nColorOP, (TextureBlendSource)texOP.nColorSrc1, (TextureBlendSource)texOP.nColorSrc2);
SetTextureColorOP(i, (TextureBlendOperation)texOP.nAlphaOP, (TextureBlendSource)texOP.nAlphaSrc1, (TextureBlendSource)texOP.nAlphaSrc2);
if (TBOP_DISABLE == texOP.nColorOP)
{
break;
}
}
}
else
{
CShader* pShader = GetShaderMgr().getSharedShader();
if (pShader)
{
// for Terrain
pShader->setVec2D("g_fScaleUV",material.vUVScale);
}
SetShader(material.uShader);
}
return true;
/* if (material.bLightingEnabled)
{
SetMaterial(material.vAmbient,material.vDiffuse);
}
if (0==material.uShader)
{
//SetSamplerAddressUV(0,ADDRESS_WRAP,ADDRESS_WRAP);
if (material.vTexAnim.lengthSquared()>0.0f)
{
Matrix matTex=Matrix::UNIT;
float fTime = (float)GetGlobalTimer().GetTime();
matTex._13=fTime*material.vTexAnim.x;
matTex._23=fTime*material.vTexAnim.y;
setTextureMatrix(0, TTF_COUNT3, matTex);
}
Color32 cFactor = material.cEmissive;
if (material.m_fOpacity<0.0f)
{
fOpacity = (float)(rand()%255)/255.0f;
}
else
{
fOpacity *= material.m_fOpacity;
}
if (material.uDiffuse)
{
SetTexture(0, material.uDiffuse);
cFactor.a=(unsigned char)(cFactor.a*fOpacity);
SetTextureFactor(cFactor);
if (material.bLightingEnabled)
{
SetTextureColorOP(0, TBOP_MODULATE, TBS_TEXTURE, TBS_DIFFUSE);
}
else
{
SetTextureColorOP(0, TBOP_MODULATE, TBS_TEXTURE, TBS_TFACTOR);
}
if(material.bBlend||material.m_fOpacity<1.0f)
{
SetBlendFunc(true, BLENDOP_ADD, SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA);
}
if (material.m_fOpacity<1.0f)
{
//.........这里部分代码省略.........