本文整理汇总了C++中IMaterialVar::IsDefined方法的典型用法代码示例。如果您正苦于以下问题:C++ IMaterialVar::IsDefined方法的具体用法?C++ IMaterialVar::IsDefined怎么用?C++ IMaterialVar::IsDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMaterialVar
的用法示例。
在下文中一共展示了IMaterialVar::IsDefined方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPixelShaderTextureScaledTransform
void CBaseVSShader::SetPixelShaderTextureScaledTransform( int pixelReg, int transformVar, int scaleVar )
{
Vector4D transformation[2];
IMaterialVar* pTransformationVar = s_ppParams[transformVar];
if (pTransformationVar && (pTransformationVar->GetType() == MATERIAL_VAR_TYPE_MATRIX))
{
const VMatrix &mat = pTransformationVar->GetMatrixValue();
transformation[0].Init( mat[0][0], mat[0][1], mat[0][2], mat[0][3] );
transformation[1].Init( mat[1][0], mat[1][1], mat[1][2], mat[1][3] );
}
else
{
transformation[0].Init( 1.0f, 0.0f, 0.0f, 0.0f );
transformation[1].Init( 0.0f, 1.0f, 0.0f, 0.0f );
}
Vector2D scale( 1, 1 );
IMaterialVar* pScaleVar = s_ppParams[scaleVar];
if (pScaleVar)
{
if (pScaleVar->GetType() == MATERIAL_VAR_TYPE_VECTOR)
pScaleVar->GetVecValue( scale.Base(), 2 );
else if (pScaleVar->IsDefined())
scale[0] = scale[1] = pScaleVar->GetFloatValue();
}
// Apply the scaling
transformation[0][0] *= scale[0];
transformation[0][1] *= scale[1];
transformation[1][0] *= scale[0];
transformation[1][1] *= scale[1];
transformation[0][3] *= scale[0];
transformation[1][3] *= scale[1];
s_pShaderAPI->SetPixelShaderConstant( pixelReg, transformation[0].Base(), 2 );
}
示例2: if
void CBaseOES2Shader::SetTextureScaledTransform(int reg, int transformVar, int scaleVar)
{
Vector4D transformation[2];
IMaterialVar *pTransformationVar = s_ppParams[transformVar];
if (pTransformationVar && (pTransformationVar->GetType() == MATERIAL_VAR_TYPE_MATRIX))
{
const VMatrix &mat = pTransformationVar->GetMatrixValue();
transformation[0].Init(mat[0][0], mat[0][1], mat[0][2], mat[0][3]);
transformation[1].Init(mat[1][0], mat[1][1], mat[1][2], mat[1][3]);
}
else
{
transformation[0].Init(1.0f, 0.0f, 0.0f, 0.0f);
transformation[1].Init(0.0f, 1.0f, 0.0f, 0.0f);
}
float scale[2] = {1.0f, 1.0f};
IMaterialVar *pScaleVar = s_ppParams[scaleVar];
if (pScaleVar)
{
if (pScaleVar->GetType() == MATERIAL_VAR_TYPE_VECTOR)
pScaleVar->GetVecValue(scale, 2);
else if (pScaleVar->IsDefined())
scale[0] = scale[1] = pScaleVar->GetFloatValue();
}
transformation[0][0] *= scale[0];
transformation[0][1] *= scale[1];
transformation[1][0] *= scale[0];
transformation[1][1] *= scale[1];
transformation[0][3] *= scale[0];
transformation[1][3] *= scale[1];
s_pShaderAPI->Uniform4fv(reg, 2, transformation[0].Base());
}
示例3: LoadCubeMap
//-----------------------------------------------------------------------------
// Loads a cubemap
//-----------------------------------------------------------------------------
void CBaseShader::LoadCubeMap( int nTextureVar )
{
if ((!s_ppParams) || (nTextureVar == -1))
return;
IMaterialVar* pNameVar = s_ppParams[nTextureVar];
if( pNameVar && pNameVar->IsDefined() )
{
s_pShaderInit->LoadCubeMap( s_ppParams, pNameVar );
}
}
示例4: LoadTexture
//-----------------------------------------------------------------------------
// Loads a texture
//-----------------------------------------------------------------------------
void CBaseShader::LoadTexture( int nTextureVar )
{
if ((!s_ppParams) || (nTextureVar == -1))
return;
IMaterialVar* pNameVar = s_ppParams[nTextureVar];
if( pNameVar && pNameVar->IsDefined() )
{
s_pShaderInit->LoadTexture( pNameVar, s_pTextureGroupName );
}
}
示例5: SetPixelShaderTextureScale
void CBaseVSShader::SetPixelShaderTextureScale( int pixelReg, int scaleVar )
{
float scale[2] = {1, 1};
IMaterialVar* pScaleVar = s_ppParams[scaleVar];
if (pScaleVar)
{
if (pScaleVar->GetType() == MATERIAL_VAR_TYPE_VECTOR)
pScaleVar->GetVecValue( scale, 2 );
else if (pScaleVar->IsDefined())
scale[0] = scale[1] = pScaleVar->GetFloatValue();
}
Vector4D scaleMatrix[2];
scaleMatrix[0].Init( scale[0], 0.0f, 0.0f, 0.0f );
scaleMatrix[1].Init( 0.0f, scale[1], 0.0f, 0.0f );
s_pShaderAPI->SetPixelShaderConstant( pixelReg, scaleMatrix[0].Base(), 2 );
}
示例6: SetFixedFunctionTextureScaledTransform
void CBaseShader::SetFixedFunctionTextureScaledTransform( MaterialMatrixMode_t textureTransform,
int transformVar, int scaleVar )
{
Assert( !IsSnapshotting() );
float mat[16];
IMaterialVar* pTransformationVar = s_ppParams[transformVar];
if (pTransformationVar && (pTransformationVar->GetType() == MATERIAL_VAR_TYPE_MATRIX))
{
Vector2D scale( 1, 1 );
IMaterialVar* pScaleVar = s_ppParams[scaleVar];
if (pScaleVar)
{
if (pScaleVar->GetType() == MATERIAL_VAR_TYPE_VECTOR)
pScaleVar->GetVecValue( scale.Base(), 2 );
else if (pScaleVar->IsDefined())
scale[0] = scale[1] = pScaleVar->GetFloatValue();
}
s_pShaderAPI->MatrixMode( textureTransform );
const VMatrix &transformation = pTransformationVar->GetMatrixValue();
// only do the upper 3x3 since this is a 2D matrix
mat[0] = transformation[0][0] * scale[0]; mat[1] = transformation[1][0] * scale[0]; mat[2] = transformation[3][0] * scale[0];
mat[4] = transformation[0][1] * scale[1]; mat[5] = transformation[1][1] * scale[1]; mat[6] = transformation[3][1] * scale[1];
mat[8] = transformation[0][3]; mat[9] = transformation[1][3]; mat[10] = transformation[3][3];
// Better set the stuff we don't set with some sort of value!
mat[3] = mat[7] = mat[11] = 0;
mat[12] = mat[13] = mat[14] = 0;
mat[15] = 1;
s_pShaderAPI->LoadMatrix( mat );
}
else
{
SetFixedFunctionTextureScale( textureTransform, scaleVar );
}
}