本文整理汇总了C++中IS_FLAG_SET函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_FLAG_SET函数的具体用法?C++ IS_FLAG_SET怎么用?C++ IS_FLAG_SET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_FLAG_SET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SHADER_INIT_PARAMS
END_SHADER_PARAMS
SHADER_INIT_PARAMS()
{
SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING );
if( !params[ENVMAPMASKSCALE]->IsDefined() )
params[ENVMAPMASKSCALE]->SetFloatValue( 1.0f );
if( !params[ENVMAPTINT]->IsDefined() )
params[ENVMAPTINT]->SetVecValue( 1.0f, 1.0f, 1.0f );
if( !params[SELFILLUMTINT]->IsDefined() )
params[SELFILLUMTINT]->SetVecValue( 1.0f, 1.0f, 1.0f );
if( !params[DETAILSCALE]->IsDefined() )
params[DETAILSCALE]->SetFloatValue( 4.0f );
// No envmap uses mode 0, it's one less pass
// Also, if multipass = 0, then go to mode 0 also
if ( ( !params[ENVMAP]->IsDefined() ) ||
( !IS_FLAG_SET(MATERIAL_VAR_MULTIPASS) ) )
{
CLEAR_FLAGS( MATERIAL_VAR_ENVMAPMODE );
}
// Vertex color requires mode 1
if ( IS_FLAG_SET(MATERIAL_VAR_VERTEXCOLOR) )
{
SET_FLAGS( MATERIAL_VAR_ENVMAPMODE );
}
// No texture means no self-illum or env mask in base alpha
if ( !params[BASETEXTURE]->IsDefined() )
{
CLEAR_FLAGS( MATERIAL_VAR_SELFILLUM );
CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
}
// If in decal mode, no debug override...
if ( IS_FLAG_SET(MATERIAL_VAR_DECAL) )
{
SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE );
}
SET_FLAGS2( MATERIAL_VAR2_LIGHTING_VERTEX_LIT );
SET_FLAGS2( MATERIAL_VAR2_NEEDS_SOFTWARE_LIGHTING );
// Get rid of the envmap if it's optional for this dx level.
if( params[ENVMAPOPTIONAL]->IsDefined() && params[ENVMAPOPTIONAL]->GetIntValue() )
{
params[ENVMAP]->SetUndefined();
}
// If mat_specular 0, then get rid of envmap
if( !g_pConfig->UseSpecular() && params[ENVMAP]->IsDefined() && params[BASETEXTURE]->IsDefined() )
{
params[ENVMAP]->SetUndefined();
}
}
示例2:
inline const char *GetPixelShaderName( IMaterialVar** params, bool bBumpedEnvMap )
{
static char const* s_pPixelShaders[] =
{
// Unmasked
"LightmappedGeneric_EnvMapV2",
"LightmappedGeneric_SelfIlluminatedEnvMapV2",
"LightmappedGeneric_BaseAlphaMaskedEnvMapV2",
"LightmappedGeneric_SelfIlluminatedEnvMapV2",
// Env map mask
"LightmappedGeneric_MaskedEnvMapV2",
"LightmappedGeneric_SelfIlluminatedMaskedEnvMapV2",
"LightmappedGeneric_MaskedEnvMapV2",
"LightmappedGeneric_SelfIlluminatedMaskedEnvMapV2",
};
if (!params[BASETEXTURE]->IsTexture())
{
if (params[ENVMAP]->IsTexture() && !bBumpedEnvMap )
{
if (!params[ENVMAPMASK]->IsDefined() )
{
return "LightmappedGeneric_EnvmapNoTexture";
}
else
{
return "LightmappedGeneric_MaskedEnvmapNoTexture";
}
}
else
{
return "LightmappedGeneric_NoTexture";
}
}
else
{
if (params[ENVMAP]->IsTexture() && !bBumpedEnvMap )
{
int pshIndex = 0;
if (IS_FLAG_SET(MATERIAL_VAR_SELFILLUM))
pshIndex |= 0x1;
if (IS_FLAG_SET(MATERIAL_VAR_BASEALPHAENVMAPMASK))
pshIndex |= 0x2;
if (params[ENVMAPMASK]->IsTexture())
pshIndex |= 0x4;
return s_pPixelShaders[pshIndex];
}
else
{
if (IS_FLAG_SET(MATERIAL_VAR_SELFILLUM))
return "LightmappedGeneric_SelfIlluminated";
else
return "LightmappedGeneric";
}
}
}
示例3: mobilebackup_request_restore
/**
* Request that a backup should be restored to the connected device.
*
* @param client The connected MobileBackup client to use.
* @param backup_manifest The backup manifest, a plist_t of type PLIST_DICT
* containing the backup state to be restored.
* @param flags Flags to send with the request. Currently this is a combination
* of the following mobilebackup_flags_t:
* MB_RESTORE_NOTIFY_SPRINGBOARD - let SpringBoard show a 'Restore' screen
* MB_RESTORE_PRESERVE_SETTINGS - do not overwrite any settings
* MB_RESTORE_PRESERVE_CAMERA_ROLL - preserve the photos of the camera roll
* @param proto_version A string denoting the version of the backup protocol
* to use. Latest known version is "1.6". Ideally this value should be
* extracted from the given manifest plist.
*
* @return MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
* one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
* backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
* if a communication error occurs, or MOBILEBACKUP_E_REPLY_NOT_OK
* if the device did not accept the request.
*/
mobilebackup_error_t mobilebackup_request_restore(mobilebackup_client_t client, plist_t backup_manifest, mobilebackup_flags_t flags, const char *proto_version)
{
if (!client || !client->parent || !backup_manifest || !proto_version)
return MOBILEBACKUP_E_INVALID_ARG;
if (backup_manifest && (plist_get_node_type(backup_manifest) != PLIST_DICT))
return MOBILEBACKUP_E_PLIST_ERROR;
mobilebackup_error_t err;
/* construct request plist */
plist_t dict = plist_new_dict();
plist_dict_insert_item(dict, "BackupManifestKey", plist_copy(backup_manifest));
plist_dict_insert_item(dict, "BackupMessageTypeKey", plist_new_string("kBackupMessageRestoreRequest"));
plist_dict_insert_item(dict, "BackupProtocolVersion", plist_new_string(proto_version));
/* add flags */
plist_dict_insert_item(dict, "BackupNotifySpringBoard", plist_new_bool(IS_FLAG_SET(flags, MB_RESTORE_NOTIFY_SPRINGBOARD)));
plist_dict_insert_item(dict, "BackupPreserveSettings", plist_new_bool(IS_FLAG_SET(flags, MB_RESTORE_PRESERVE_SETTINGS)));
plist_dict_insert_item(dict, "BackupPreserveCameraRoll", plist_new_bool(IS_FLAG_SET(flags, MB_RESTORE_PRESERVE_CAMERA_ROLL)));
/* send request */
err = mobilebackup_send_message(client, NULL, dict);
plist_free(dict);
dict = NULL;
if (err != MOBILEBACKUP_E_SUCCESS) {
debug_info("ERROR: Could not send restore request message (%d)!", err);
goto leave;
}
/* now receive and hopefully get a BackupMessageRestoreReplyOK */
err = mobilebackup_receive_message(client, "BackupMessageRestoreReplyOK", &dict);
if (err != MOBILEBACKUP_E_SUCCESS) {
debug_info("ERROR: Could not receive RestoreReplyOK message (%d)!", err);
goto leave;
}
plist_t node = plist_dict_get_item(dict, "BackupProtocolVersion");
if (node) {
char *str = NULL;
plist_get_string_val(node, &str);
if (str) {
if (strcmp(str, proto_version) != 0) {
err = MOBILEBACKUP_E_BAD_VERSION;
}
free(str);
}
}
leave:
if (dict)
plist_free(dict);
return err;
}
示例4: SHADER_INIT_PARAMS
END_SHADER_PARAMS
SHADER_INIT_PARAMS()
{
SET_FLAGS2( MATERIAL_VAR2_LIGHTING_LIGHTMAP );
if( !params[ENVMAPMASKSCALE]->IsDefined() )
params[ENVMAPMASKSCALE]->SetFloatValue( 1.0f );
if( !params[DETAILSCALE]->IsDefined() )
params[DETAILSCALE]->SetFloatValue( 1.0f );
if( !params[ENVMAPTINT]->IsDefined() )
params[ENVMAPTINT]->SetVecValue( 1.0f, 1.0f, 1.0f );
// No texture means no self-illum or env mask in base alpha
if ( !params[BASETEXTURE]->IsDefined() )
{
CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
}
// If in decal mode, no debug override...
if (IS_FLAG_SET(MATERIAL_VAR_DECAL))
{
SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE );
}
}
示例5: OnGetFileAttributes
static int OnGetFileAttributes(HWND hDlg)
{
TFileTestData * pData = GetDialogData(hDlg);
TFlagInfo * pFlags = FileAttributesValues;
TCHAR szFileAttributes[512] = _T("");
DWORD dwAttr;
int nError = ERROR_SUCCESS;
SaveDialog(hDlg);
dwAttr = GetFileAttributes(pData->szFileName1);
if(dwAttr != INVALID_FILE_ATTRIBUTES)
{
for(int i = 0; pFlags->dwValue != 0; i++, pFlags++)
{
if(IS_FLAG_SET(pFlags, dwAttr))
{
if(szFileAttributes[0] != 0)
StringCchCat(szFileAttributes, _countof(szFileAttributes), _T("\n"));
StringCchCat(szFileAttributes, _countof(szFileAttributes), pFlags->szFlagText);
}
}
if(szFileAttributes[0] == 0)
StringCchCopy(szFileAttributes, _countof(szFileAttributes), _T("0"));
MessageBoxRc(hDlg, IDS_FILE_ATTRIBUTES, (UINT_PTR)szFileAttributes);
}
else
nError = GetLastError();
SetResultInfo(hDlg, nError);
return TRUE;
}
示例6: TextureIsTranslucent
//-----------------------------------------------------------------------------
// Does the texture store translucency in its alpha channel?
//-----------------------------------------------------------------------------
bool CBaseShader::TextureIsTranslucent( int textureVar, bool isBaseTexture )
{
if (textureVar < 0)
return false;
IMaterialVar** params = s_ppParams;
if (params[textureVar]->GetType() == MATERIAL_VAR_TYPE_TEXTURE)
{
if (!isBaseTexture)
{
return params[textureVar]->GetTextureValue()->IsTranslucent();
}
else
{
// Override translucency settings if this flag is set.
if (IS_FLAG_SET(MATERIAL_VAR_OPAQUETEXTURE))
return false;
if ( (CurrentMaterialVarFlags() & (MATERIAL_VAR_SELFILLUM | MATERIAL_VAR_BASEALPHAENVMAPMASK)) == 0)
{
if ((CurrentMaterialVarFlags() & MATERIAL_VAR_TRANSLUCENT) ||
(CurrentMaterialVarFlags() & MATERIAL_VAR_ALPHATEST))
{
return params[textureVar]->GetTextureValue()->IsTranslucent();
}
}
}
}
return false;
}
示例7: InitParamsPhong_DX9
//-----------------------------------------------------------------------------
// Initialize shader parameters
//-----------------------------------------------------------------------------
void InitParamsPhong_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, VertexLitGeneric_DX9_Vars_t &info )
{
// FLASHLIGHTFIXME: Do ShaderAPI::BindFlashlightTexture
Assert( info.m_nFlashlightTexture >= 0 );
params[FLASHLIGHTTEXTURE]->SetStringValue( GetFlashlightTextureFilename() );
// Write over $basetexture with $info.m_nBumpmap if we are going to be using diffuse normal mapping.
if( info.m_nAlbedo != -1 && g_pConfig->UseBumpmapping() && info.m_nBumpmap != -1 && params[info.m_nBumpmap]->IsDefined() && params[info.m_nAlbedo]->IsDefined() &&
params[info.m_nBaseTexture]->IsDefined() )
{
params[info.m_nBaseTexture]->SetStringValue( params[info.m_nAlbedo]->GetStringValue() );
}
// This shader can be used with hw skinning
SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING );
SET_FLAGS2( MATERIAL_VAR2_LIGHTING_VERTEX_LIT );
// No texture means no env mask in base alpha
if ( !params[info.m_nBaseTexture]->IsDefined() )
{
CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
}
// If in decal mode, no debug override...
if (IS_FLAG_SET(MATERIAL_VAR_DECAL))
{
SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE );
}
// We always specify we're using user data, therefore we always need tangent spaces
SET_FLAGS2( MATERIAL_VAR2_NEEDS_TANGENT_SPACES );
bool bBump = (info.m_nBumpmap != -1) && g_pConfig->UseBumpmapping() && params[info.m_nBumpmap]->IsDefined();
bool bEnvMap = (info.m_nEnvmap != -1) && params[info.m_nEnvmap]->IsDefined();
bool bDiffuseWarp = (info.m_nDiffuseWarpTexture != -1) && params[info.m_nDiffuseWarpTexture]->IsDefined();
bool bPhong = (info.m_nPhong != -1) && params[info.m_nPhong]->IsDefined();
if( !bBump && !bEnvMap && !bDiffuseWarp && !bPhong )
{
CLEAR_FLAGS( MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK );
}
if ( ( info.m_nSelfIllumFresnelMinMaxExp != -1 ) && ( !params[info.m_nSelfIllumFresnelMinMaxExp]->IsDefined() ) )
{
params[info.m_nSelfIllumFresnelMinMaxExp]->SetVecValue( 0.0f, 1.0f, 1.0f );
}
InitFloatParam( info.m_nEnvmapFresnel, params, 0.0f );
InitFloatParam( info.m_nAmbientOcclusion, params, 0.0f );
InitFloatParam( info.m_nDisplacementWrinkleMap, params, 0.0f );
InitIntParam( info.m_nSelfIllumFresnel, params, 0 );
InitIntParam( info.m_nBaseMapAlphaPhongMask, params, 0 );
InitIntParam( info.m_nBaseMapLuminancePhongMask, params, 0 );
InitIntParam( info.m_nShaderSrgbRead360, params, 0 );
InitIntParam( info.m_nAllowDiffuseModulation, params, 1 );
InitIntParam( info.m_nPhongDisableHalfLambert, params, 0 );
SET_PARAM_STRING_IF_NOT_DEFINED( info.m_nFoW, "_rt_fog_of_war" );
}
示例8: SHADER_INIT_PARAMS
END_SHADER_PARAMS
SHADER_INIT_PARAMS()
{
if( !params[ENVMAPTINT]->IsDefined() )
params[ENVMAPTINT]->SetVecValue( 1.0f, 1.0f, 1.0f );
if( !params[ENVMAPMASKSCALE]->IsDefined() )
params[ENVMAPMASKSCALE]->SetFloatValue( 1.0f );
if( !params[DETAILSCALE]->IsDefined() )
params[DETAILSCALE]->SetFloatValue( 4.0f );
// No texture means no env mask in base alpha
if ( !params[BASETEXTURE]->IsDefined() )
{
CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
}
// If in decal mode, no debug override...
if (IS_FLAG_SET(MATERIAL_VAR_DECAL))
{
SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE );
}
// Get rid of the envmap if it's optional for this dx level.
if( params[ENVMAPOPTIONAL]->IsDefined() && params[ENVMAPOPTIONAL]->GetIntValue() )
{
params[ENVMAP]->SetUndefined();
}
// If mat_specular 0, then get rid of envmap
if( !g_pConfig->UseSpecular() && params[ENVMAP]->IsDefined() && params[BASETEXTURE]->IsDefined() )
{
params[ENVMAP]->SetUndefined();
}
}
示例9: m_status
CNdasDevice::CNdasDevice(
DWORD dwSlotNo,
CONST NDAS_DEVICE_ID& deviceId,
DWORD dwFlags) :
m_status(NDAS_DEVICE_STATUS_DISABLED),
m_lastError(NDAS_DEVICE_ERROR_NONE),
m_dwSlotNo(dwSlotNo),
m_deviceId(deviceId),
m_grantedAccess(0x00000000L),
m_dwLastHeartbeatTick(0),
m_dwCommFailureCount(0),
m_fAutoRegistered(IS_FLAG_SET(dwFlags,NDAS_DEVICE_REG_FLAG_AUTO_REGISTERED)),
m_fVolatile(IS_FLAG_SET(dwFlags,NDAS_DEVICE_REG_FLAG_VOLATILE)),
m_fHidden(IS_FLAG_SET(dwFlags,NDAS_DEVICE_REG_FLAG_HIDDEN))
{
m_szDeviceName[0] = TEXT('\0');
::ZeroMemory(
&m_hwInfo,
sizeof(HARDWARE_INFO));
::ZeroMemory(
m_pUnitDevices,
sizeof(CNdasUnitDevice*) * MAX_NDAS_UNITDEVICE_COUNT);
HRESULT hr = ::StringCchPrintf(
m_szCfgContainer,
30,
TEXT("Devices\\%04d"),
dwSlotNo);
_ASSERT(SUCCEEDED(hr));
//
// After we allocate m_szCfgContainer, we can use SetConfigValue
//
if (m_fAutoRegistered)
{
(VOID) SetConfigValue(_T("AutoRegistered"), m_fAutoRegistered);
}
else
{
(VOID) DeleteConfigValue(_T("AutoRegistered"));
}
DBGPRT_TRACE(_FT("ctor: %s\n"), ToString());
}
示例10: GetDrawFlagsPass1
int GetDrawFlagsPass1(IMaterialVar** params )
{
int flags = SHADER_DRAW_POSITION;
if (IS_FLAG_SET(MATERIAL_VAR_VERTEXCOLOR))
flags |= SHADER_DRAW_COLOR;
flags |= SHADER_DRAW_TEXCOORD0;
return flags;
}
示例11: GetDrawFlagsPass1
int GetDrawFlagsPass1(IMaterialVar** params, bool doDetail)
{
int flags = SHADER_DRAW_POSITION;
if (IS_FLAG_SET(MATERIAL_VAR_VERTEXCOLOR))
flags |= SHADER_DRAW_COLOR;
if (params[BASETEXTURE]->IsTexture())
flags |= SHADER_DRAW_TEXCOORD0;
if (doDetail)
flags |= SHADER_DRAW_TEXCOORD1;
return flags;
}
示例12: RemoveAllInheritedAces
HRESULT RemoveAllInheritedAces(PACL *ppAcl)
{
BOOL bResult = FALSE;
DWORD errorCode = S_OK;
HRESULT hr = S_OK;
ACL_SIZE_INFORMATION aclInformation;
DWORD totalCount;
DWORD aceIndex = 0;
LPVOID ace = nullptr;
BYTE aceFlags = 0;
if ( !ARGUMENT_PRESENT(*ppAcl) )
{
return E_INVALIDARG;
}
bResult = GetAclInformation(
*ppAcl,
&aclInformation,
sizeof(aclInformation),
AclSizeInformation
);
FailGracefullyGLE(bResult, L"GetAclInformation");
totalCount = aclInformation.AceCount;
while ( aceIndex < totalCount )
{
bResult = GetAce(
*ppAcl,
aceIndex,
&ace
);
FailGracefullyGLE(bResult, L"GetAce");
aceFlags = ((PACE_HEADER)ace)->AceFlags;
if (IS_FLAG_SET(aceFlags,INHERITED_ACE))
{
bResult = DeleteAce(
*ppAcl,
aceIndex);
FailGracefullyGLE(bResult, L"DeleteAce");
totalCount--;
}
else
{
aceIndex++;
}
}
exit_gracefully:
return hr;
}
示例13: IsTranslucent
bool IsTranslucent( IMaterialVar **params ) const
{
if ( params[CLOAKPASSENABLED]->GetIntValue() ) // If material supports cloaking
{
if ( ( params[CLOAKFACTOR]->GetFloatValue() > 0.0f ) && ( params[CLOAKFACTOR]->GetFloatValue() < 1.0f ) ) // Per-frame check
return true;
// else, not cloaking this frame, so check flag in case the base material still needs it
}
// Check flag if not drawing cloak pass
return IS_FLAG_SET( MATERIAL_VAR_TRANSLUCENT );
}
示例14: SHADER_INIT_PARAMS
BEGIN_SHADER_PARAMS
END_SHADER_PARAMS
// Set up anything that is necessary to make decisions in SHADER_FALLBACK.
SHADER_INIT_PARAMS()
{
// No texture means no self-illum or env mask in base alpha
CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
// If in decal mode, no debug override...
if (IS_FLAG_SET(MATERIAL_VAR_DECAL))
{
SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE );
}
SET_FLAGS2( MATERIAL_VAR2_LIGHTING_LIGHTMAP );
}
示例15: CreateDialogLayout_PreArranged
// Arranging the dialog layout for pre-arranged dialogs
static void CreateDialogLayout_PreArranged(TFlagDialogData * pData)
{
TFlagInfo * pFlags;
HWND hWndChild;
UINT nChecked;
// Parse all flags and setup every child item
for(pFlags = pData->pFlags; pFlags->nIDCtrl != 0; pFlags++)
{
// Retrieve the child window belonging to this flag
hWndChild = GetDlgItem(pData->hDlg, pFlags->nIDCtrl);
assert(hWndChild != NULL);
// Set the pointer to flag info structure to the child's window data
SetWindowLongPtr(hWndChild, GWLP_USERDATA, (LONG_PTR)pFlags);
// If the flag is set, we need to check that item
nChecked = IS_FLAG_SET(pFlags, pData->dwFlags);
Button_SetCheck(hWndChild, nChecked);
}
}